/* ===== Global ===== */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    font-size: 1.1rem;
}

.page-content p,
.page-content span,
.page-content div,
.page-content label {
    font-size: 1.1rem;
}

.page-content h1 {
    font-size: 2.2rem;
}

.page-content h2 {
    font-size: 1.8rem;
}

.page-content h4 {
    font-size: 1.4rem;
}

/* ===== Header / Navbar ===== */
.app-header {
    background: linear-gradient(90deg, #1a5632 0%, #2d8a56 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 1rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.app-header h2 {
    color: white !important;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.app-header img {
    filter: brightness(0) invert(1);
    transition: transform 0.3s;
}

.app-header img:hover {
    transform: scale(1.05);
}

/* ===== Page Content ===== */
.page-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin: 0 auto;
    max-width: 1100px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    min-height: 60vh;
}

/* ===== Page Titles ===== */
.page-content h1 {
    color: #1a5632;
    font-weight: 700;
    font-size: 1.8rem;
    border-bottom: 3px solid #2d8a56;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.page-content h2 {
    color: #1a5632;
    font-weight: 600;
}

/* ===== Cards ===== */
.card {
    border: none !important;
    border-radius: 1rem !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    color: #1a5632;
    font-weight: 700;
}

.card-group {
    gap: 1rem;
}

/* ===== Login Card ===== */
.login-card {
    max-width: 480px;
    margin: 3rem auto;
    border-radius: 1.25rem !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.login-card .card-img-top {
    border-radius: 1.25rem 1.25rem 0 0;
    max-height: 220px;
    object-fit: cover;
}

.login-card .card-body {
    padding: 2rem;
    text-align: center;
}

/* ===== Login Subtitle ===== */
.login-subtitle {
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #1a5632, #2d8a56);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Buttons ===== */
.btn {
    border-radius: 0.75rem !important;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #1a5632, #2d8a56) !important;
    border: none !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #145028, #24704a) !important;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #34c759) !important;
    border: none !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f0ad4e, #f5c343) !important;
    border: none !important;
    color: #333 !important;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e8535f) !important;
    border: none !important;
}

.btn-light {
    background: white !important;
    border: 2px solid #1a5632 !important;
    color: #1a5632 !important;
}

.btn-light:hover {
    background: #1a5632 !important;
    color: white !important;
}

/* Native HTML buttons (confirm dialogs) */
#stop_button,
#start_button,
#reservation_button,
#change_reservation_button,
#delete_reservation_button,
#power_button,
#superuser_button {
    background: linear-gradient(135deg, #1a5632, #2d8a56);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.7rem 2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
}

#stop_button:hover,
#start_button:hover,
#reservation_button:hover,
#change_reservation_button:hover,
#delete_reservation_button:hover,
#power_button:hover,
#superuser_button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #145028, #24704a);
}

#stop_button {
    background: linear-gradient(135deg, #dc3545, #e8535f);
}

#stop_button:hover {
    background: linear-gradient(135deg, #c82333, #d34050);
}

/* ===== Alerts ===== */
.alert {
    border-radius: 0.75rem !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alert-heading {
    font-weight: 700;
}

.alert p,
.alert .alert-heading {
    font-size: 1.1rem;
}

/* ===== DataTables ===== */
.dash-table-container {
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
    background-color: #1a5632 !important;
    color: white !important;
    font-weight: 600;
    padding: 0.75rem 1rem !important;
    border: none !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
    padding: 0.65rem 1rem !important;
    border-bottom: 1px solid #eee !important;
    border-right: none !important;
    border-left: none !important;
    font-size: 1.05rem !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
    background-color: #f0faf4 !important;
}

/* ===== Dropdowns ===== */
.Select-control,
.dash-dropdown .Select-control {
    border-radius: 0.5rem !important;
    border: 2px solid #dee2e6 !important;
    transition: border-color 0.2s;
}

.Select-control:hover,
.dash-dropdown .Select-control:hover {
    border-color: #2d8a56 !important;
}

.Select-value-label,
.Select-placeholder,
.Select-input input {
    font-size: 1.1rem !important;
}

/* ===== Slider ===== */
.rc-slider-track {
    background-color: #2d8a56 !important;
}

.rc-slider-handle {
    border-color: #1a5632 !important;
}

.rc-slider-handle:hover,
.rc-slider-handle:active {
    border-color: #2d8a56 !important;
    box-shadow: 0 0 0 4px rgba(45, 138, 86, 0.2) !important;
}

/* ===== Links ===== */
a:not(.btn) {
    color: #2d8a56;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 1.1rem;
}


a:not(.btn):hover {
    color: #1a5632;
    text-decoration: underline;
}

/* ===== Home Page Action Buttons ===== */
.home-actions .btn {
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 1rem;
    font-size: 0.95rem;
}

/* ===== User Info Bar ===== */
.user-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8f9fa, #eef2f5);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.user-info-bar .user-name {
    font-weight: 600;
    color: #1a5632;
    font-size: 1.1rem;
}

/* ===== Date Picker ===== */
.DateInput_input {
    border-radius: 0.5rem !important;
    border: 2px solid #dee2e6 !important;
    padding: 0.5rem !important;
    font-size: 0.95rem !important;
}

.DateInput_input__focused {
    border-color: #2d8a56 !important;
}

.CalendarDay__selected {
    background: #1a5632 !important;
    border: 1px solid #1a5632 !important;
}

/* ===== Labels ===== */
label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

/* ===== Footer spacing ===== */
.go-back-link {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.5rem 1.5rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
}

.go-back-link:hover {
    background: #e9ecef;
    text-decoration: none;
}

/* ===== Superuser Alert ===== */
#superuser_alert {
    border-left: 4px solid #ffc107 !important;
    background: #fff8e1 !important;
}

/* ===== Registration Card ===== */
.registration-card {
    max-width: 540px;
    margin: 3rem auto;
}

.registration-card .card-body {
    padding: 2rem;
}

/* ===== Charging Mode Message ===== */
#charg-mod-div {
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    color: #333 !important;
    background: linear-gradient(135deg, #f0faf4, #e8f5e9);
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    border-left: 4px solid #2d8a56;
    margin-bottom: 1rem;
}

.charging-mode-badge {
    background: #1a5632;
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 0.4rem;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.setpoint-allowed {
    color: #1a7a3a;
    font-weight: 700;
}

.setpoint-denied {
    color: #c0392b;
    font-weight: 700;
}

/* ===== Responsive - Tablet ===== */
@media (max-width: 992px) {
    .page-content {
        max-width: 100%;
        padding: 1.5rem;
    }
}

/* ===== Responsive - Mobile ===== */
@media (max-width: 768px) {
    body {
        font-size: 1rem;
    }

    .app-header {
        padding: 0.6rem 1rem;
        border-radius: 0;
        margin-bottom: 1rem;
    }

    .app-header h2 {
        font-size: 1.2rem;
    }

    .app-header img {
        height: 30px !important;
    }

    .page-content {
        padding: 1rem;
        margin: 0 0.5rem;
        border-radius: 0.75rem;
        min-height: auto;
    }

    .page-content h1 {
        font-size: 1.4rem;
    }

    .page-content h2 {
        font-size: 1.2rem;
    }

    /* Cards stack vertically */
    .card-group {
        flex-direction: column !important;
    }

    .card {
        margin-bottom: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Login / Registration cards full width */
    .login-card,
    .registration-card {
        max-width: 100%;
        margin: 1rem 0;
    }

    .login-card .card-body,
    .registration-card .card-body {
        padding: 1.25rem;
    }

    /* Buttons full-width and touch-friendly */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        width: 100%;
    }

    #stop_button,
    #start_button,
    #reservation_button,
    #change_reservation_button,
    #delete_reservation_button,
    #power_button,
    #superuser_button {
        width: 100%;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
    }

    /* User info bar vertical on very small screens */
    .user-info-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        padding: 0.75rem 1rem;
    }

    .user-info-bar .btn {
        width: auto;
    }

    /* Tables scroll horizontally */
    .dash-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td,
    .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.6rem !important;
        white-space: nowrap;
    }

    /* Dropdowns full width */
    .Select-control,
    .dash-dropdown .Select-control {
        min-height: 44px !important;
    }

    /* Slider bigger touch target */
    .rc-slider-handle {
        width: 24px !important;
        height: 24px !important;
        margin-top: -10px !important;
    }

    .rc-slider {
        padding: 8px 0 !important;
    }

    /* Date picker */
    .DateInput {
        width: 100% !important;
    }

    .DateInput_input {
        font-size: 1rem !important;
        padding: 0.6rem !important;
    }

    .SingleDatePicker,
    .SingleDatePickerInput {
        width: 100% !important;
    }

    /* Charging info */
    #charg-mod-div {
        font-size: 1.3rem !important;
        font-weight: 700 !important;
        color: #1a5632 !important;
    }

    #energy_info {
        font-size: 1.7rem !important;
        font-weight: 700 !important;
    }

    #power_info {
        font-size: 1.7rem !important;
    }

    /* Graph responsive */
    .js-plotly-plot {
        width: 100% !important;
    }

    /* Go back link */
    .go-back-link {
        width: 100%;
        text-align: center;
    }

    /* Reduce spacing */
    hr {
        margin: 1rem 0;
    }
}

/* ===== Very small phones ===== */
@media (max-width: 400px) {
    .page-content {
        padding: 0.75rem;
        margin: 0 0.25rem;
    }

    .app-header h2 {
        font-size: 1rem;
    }

    .page-content h1 {
        font-size: 1.2rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.7rem 0.75rem;
    }
}

.charging-stat {
    font-size: 1.7rem !important;
    font-weight: 700 !important;
    display: block;
}