/* =====================================================
   ESP32 CONTROL
   ===================================================== */

* {
    box-sizing: border-box;
}


body {
    margin: 0;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #eef4fb;

    color: #172b4d;
}


/* =====================================================
   LOGIN
   ===================================================== */

.login-page {

    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #0b4f8a;
}


.login-container {

    width: 100%;

    max-width: 480px;

    padding: 20px;
}


.login-box {

    background: white;

    border-radius: 20px;

    padding: 40px 35px;

    text-align: center;

    box-shadow:
        0 10px 35px
        rgba(0, 0, 0, 0.20);
}


.logo-circle {

    width: 80px;

    height: 80px;

    margin:
        0 auto 15px;

    border-radius: 50%;

    background: #f28c28;

    color: white;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 38px;
}


.login-box h1 {

    margin: 5px 0;

    color: #0b4f8a;

    font-size: 30px;
}


.login-subtitle {

    margin:
        8px 0 30px;

    font-size: 20px;

    color: #65758b;
}


.login-box label {

    display: block;

    text-align: left;

    margin:
        18px 0 7px;

    font-size: 18px;

    font-weight: bold;
}


.login-box input {

    width: 100%;

    padding: 16px;

    border:
        2px solid #ccd8e6;

    border-radius: 10px;

    font-size: 18px;

    outline: none;
}


.login-box input:focus {

    border-color: #0b70bd;
}


.main-button {

    width: 100%;

    margin-top: 28px;

    padding: 17px;

    border: none;

    border-radius: 10px;

    background: #f28c28;

    color: white;

    font-size: 19px;

    font-weight: bold;

    cursor: pointer;
}


.main-button:hover {

    background: #df7614;
}


/* =====================================================
   MESSAGE
   ===================================================== */

.message {

    margin-top: 18px;

    min-height: 24px;

    font-size: 16px;

    font-weight: bold;
}


.message.success {

    color: #198754;
}


.message.error {

    color: #c62828;
}


/* =====================================================
   DASHBOARD
   ===================================================== */

.dashboard {

    min-height: 100vh;

    background: #eef4fb;
}


/* =====================================================
   TOPBAR
   ===================================================== */

.topbar {

    background: #0b4f8a;

    color: white;

    padding: 15px 25px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;
}


.topbar-title {

    font-size: 25px;

    font-weight: bold;
}


.topbar-user {

    font-size: 17px;
}


.logout-button {

    border: none;

    border-radius: 8px;

    padding: 10px 16px;

    background: white;

    color: #0b4f8a;

    font-weight: bold;

    cursor: pointer;
}


/* =====================================================
   CONTENU
   ===================================================== */

.dashboard-content {

    max-width: 1100px;

    margin: auto;

    padding: 25px;
}


.welcome {

    font-size: 28px;

    color: #0b4f8a;

    margin-bottom: 25px;
}


.section-title {

    color: #0b4f8a;

    font-size: 26px;

    margin-top: 30px;

    margin-bottom: 20px;
}


/* =====================================================
   GRID
   ===================================================== */

.device-grid {

    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(250px, 1fr)
        );

    gap: 22px;
}


/* =====================================================
   CARTES
   ===================================================== */

.device-card {

    background: white;

    border-radius: 18px;

    padding: 20px;

    text-align: center;

    box-shadow:
        0 5px 18px
        rgba(0, 0, 0, 0.10);
}


.device-name {

    font-size: 23px;

    font-weight: bold;

    color: #0b4f8a;

    margin-bottom: 15px;
}


/* =====================================================
   ETAT
   ===================================================== */

.state {

    display: inline-block;

    padding:
        10px 20px;

    border-radius: 30px;

    font-size: 18px;

    font-weight: bold;

    margin-bottom: 18px;
}


.state.off {

    background: #e9eef4;

    color: #536273;
}


.state.on {

    background: #d9f5e5;

    color: #198754;
}


/* =====================================================
   BOUTON
   ===================================================== */

.control-button {

    width: 100%;

    padding: 15px;

    border: none;

    border-radius: 10px;

    background: #f28c28;

    color: white;

    font-size: 18px;

    font-weight: bold;

    cursor: pointer;
}


.control-button:hover {

    background: #df7614;
}


.control-button:disabled {

    opacity: 0.6;

    cursor: wait;
}


/* =====================================================
   ADMIN
   ===================================================== */

.admin-button {

    display: inline-block;

    padding:
        13px 20px;

    border-radius: 9px;

    background: #0b70bd;

    color: white;

    text-decoration: none;

    font-weight: bold;
}


.admin-label {

    display: block;

    text-align: left;

    font-weight: bold;

    font-size: 17px;

    margin-bottom: 7px;
}


.admin-input {

    width: 100%;

    padding: 14px;

    border:
        2px solid #ccd8e6;

    border-radius: 10px;

    font-size: 18px;
}


.gpio-text {

    text-align: left;

    color: #65758b;

    font-size: 16px;
}


.checkbox-label {

    display: flex;

    align-items: center;

    gap: 10px;

    margin-top: 15px;

    font-size: 17px;

    cursor: pointer;
}


.checkbox-label input {

    width: 22px;

    height: 22px;
}


/* =====================================================
   DEVICE INFO
   ===================================================== */

.device-info-card {

    background: white;

    border-radius: 18px;

    padding: 22px;

    margin-bottom: 25px;

    box-shadow:
        0 5px 18px
        rgba(0, 0, 0, 0.10);
}


.device-info-title {

    font-size: 25px;

    font-weight: bold;

    color: #0b4f8a;

    margin-bottom: 12px;
}


.device-info-line {

    font-size: 19px;

    margin-top: 8px;
}


/* =====================================================
   CAMERA
   ===================================================== */

.camera-section {

    margin-top: 35px;

    background: white;

    border-radius: 18px;

    padding: 22px;

    box-shadow:
        0 5px 18px
        rgba(0, 0, 0, 0.10);
}


.hidden {

    display: none !important;
}


.camera-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 18px;
}


.camera-title {

    font-size: 25px;

    font-weight: bold;

    color: #0b4f8a;
}


.camera-status {

    margin-top: 8px;

    font-weight: bold;

    color: #65758b;
}


.camera-view {

    width: 100%;

    min-height: 250px;

    background: #111;

    border-radius: 14px;

    overflow: hidden;

    display: flex;

    align-items: center;

    justify-content: center;
}


.camera-stream {

    display: block;

    width: 100%;

    max-height: 600px;

    object-fit: contain;
}


.camera-offline {

    min-height: 250px;

    width: 100%;

    color: white;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 22px;
}


/* =====================================================
   CAMERA CONTROLES
   ===================================================== */

.camera-controls {

    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(180px, 1fr)
        );

    gap: 12px;

    margin-top: 18px;
}


.camera-button {

    padding: 14px;

    border: none;

    border-radius: 10px;

    background: #0b70bd;

    color: white;

    font-size: 16px;

    font-weight: bold;

    cursor: pointer;
}


.camera-button:hover {

    background: #084f86;
}


/* =====================================================
   CAMERA SETTINGS
   ===================================================== */

.camera-settings {

    margin-top: 25px;

    padding-top: 20px;

    border-top:
        2px solid #e1e8f0;
}


.camera-settings h3 {

    color: #0b4f8a;

    font-size: 22px;
}


.camera-settings label {

    display: grid;

    grid-template-columns:
        130px 1fr 45px;

    align-items: center;

    gap: 15px;

    margin:
        18px 0;

    font-size: 17px;

    font-weight: bold;
}


.camera-settings input[type="range"] {

    width: 100%;
}


.camera-settings select {

    padding: 12px;

    border:
        2px solid #ccd8e6;

    border-radius: 8px;

    font-size: 17px;
}


/* =====================================================
   ADMIN CAMERA
   ===================================================== */

.admin-camera-card {

    margin-top: 35px;

    background: white;

    border-radius: 18px;

    padding: 22px;

    box-shadow:
        0 5px 18px
        rgba(0, 0, 0, 0.10);
}


.admin-camera-info {

    padding: 18px;

    border-radius: 12px;

    background: #eef4fb;

    font-size: 18px;

    line-height: 1.7;
}


.camera-admin-buttons {

    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(180px, 1fr)
        );

    gap: 12px;

    margin-top: 20px;
}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 600px) {

    .login-box {

        padding:
            30px 22px;
    }


    .topbar {

        flex-wrap: wrap;

        padding: 14px;
    }


    .topbar-title {

        font-size: 21px;
    }


    .dashboard-content {

        padding: 15px;
    }


    .welcome {

        font-size: 24px;
    }


    .camera-settings label {

        grid-template-columns:
            1fr;

        gap: 7px;
    }


    .camera-stream {

        max-height: 400px;
    }

}