/* Global Styles */
* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

    body.light-theme {
        background-color: #f4f4f4;
        color: #333;
    }

    body.dark-theme {
        background-color: #1a1a1a;
        color: #f4f4f4;
    }

.container {
    max-width: 1200px; /* Wider for tables/graphs */
    margin: 0 auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    transition: background-color 0.3s;
}

body.light-theme .container {
    background: white;
}

body.dark-theme .container {
    background: #2d2d2d;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    transition: color 0.3s;
}

body.light-theme h1 {
    color: #333;
}

body.dark-theme h1 {
    color: #f4f4f4;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

body.light-theme .theme-toggle {
    background-color: #2196F3;
    color: white;
}

body.dark-theme .theme-toggle {
    background-color: #4CAF50;
    color: #fff;
}

/* Form Inputs */
input, button {
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body.light-theme input {
    border: 1px solid #ddd;
    background: white;
    color: #333;
}

body.dark-theme input {
    border: 1px solid #555;
    background: #444;
    color: #f4f4f4;
}

button {
    cursor: pointer;
}

body.light-theme button {
    background-color: #4CAF50;
    color: white;
}

body.dark-theme button {
    background-color: #2196F3;
    color: #fff;
}

/* Table Styles */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

    .summary-table th, .summary-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: center;
        cursor: pointer; /* For sort */
    }

body.dark-theme .summary-table th, body.dark-theme .summary-table td {
    border-color: #555;
}

.summary-table th {
    background-color: #f2f2f2;
}

body.dark-theme .summary-table th {
    background-color: #3a3a3a;
}

/* Responsive Media Query */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }

    table {
        font-size: 14px;
    }
}

/* Graph Canvas */
canvas {
    margin: 20px auto;
    display: block;
}

/* Form Improvements */
.form-group {
    margin-bottom: 15px; /* Vertical space between inputs */
}

input[type="datetime-local"] {
    font-size: 16px; /* Bigger */
    padding: 10px;
    width: 200px; /* Wider */
    border-radius: 4px;
}

button, .add-btn, button[type="submit"], #refreshBtn {
    min-width: 150px; /* Wider buttons */
    padding: 10px 20px;
}

body.light-theme button:hover {
    background-color: #45a049;
}

body.dark-theme button:hover {
    background-color: #1976D2;
}

/* Logout Button (from guide) */
.logout-btn {
    background-color: #ff4444;
    color: white;/*
    min-width: 150px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;*/
}

body.dark-theme .logout-btn {
    background-color: #c9302c;
}

.logout-btn:hover {
    background-color: #cc3333;
}

body.dark-theme .logout-btn:hover {
    background-color: #a62828;
}

/* Chart */
#connectionsChart {
    width: 100% !important;
    height: 400px; /* Taller for visibility */
}

/* Responsive */
@media (max-width: 768px) {
    input[type="datetime-local"] {
        width: 100%; /* Full width on mobile */
    }
}

/* Header Buttons */
.theme-toggle, .logout-btn {
    padding: 8px 15px; /* Same size */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}
/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px; /* For round */
}

    .slider:before {
        position: absolute;
        content: "";
        height: 26px;
        width: 26px;
        left: 4px;
        bottom: 4px;
        background-color: white;
        transition: .4s;
        border-radius: 50%;
    }

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Dark Theme Adjustments */
body.dark-theme .slider {
    background-color: #555;
}

body.dark-theme input:checked + .slider {
    background-color: #4CAF50;
}

body.dark-theme input:focus + .slider {
    box-shadow: 0 0 1px #4CAF50;
}
