@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');


/* ============================================================
   RESET / BASE
   ============================================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #0a0f16;
    color: #e9eef5;
    font-family: Inter, Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
    border: 0;
}

.hidden {
    display: none !important;
}


/* ============================================================
   LOGIN
   ============================================================ */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(
            circle at 50% 0,
            #172536,
            #080c12 55%
        );
}

.login-box {
    width: min(390px, 90vw);
    padding: 38px;
    background: #101823;
    border: 1px solid #263545;
    border-radius: 24px;
    box-shadow: 0 30px 80px #0008;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    color: #0a0f16;
    font-weight: 800;
    margin-bottom: 25px;
}

.login h1 {
    margin: 0 0 6px;
}

.login p {
    color: #8492a3;
    margin: 0 0 26px;
}

.login input {
    width: 100%;
    padding: 14px;
    margin: 6px 0;
    background: #0a1119;
    border: 1px solid #2b3948;
    border-radius: 12px;
    color: #fff;
}

.login button {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    border-radius: 12px;
    font-weight: 800;
}


/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

main {
    max-width: 1440px;
    margin: auto;
    padding: 28px 32px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}


/* ============================================================
   TIPOGRAFIA
   ============================================================ */

.eyebrow {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: #8795a6;
    font-weight: 700;
}

h1,
h2 {
    margin: 4px 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 21px;
}


/* ============================================================
   HEADER
   ============================================================ */

.header-right {
    display: flex;
    gap: 14px;
    align-items: center;
    color: #8996a5;
}

.ghost,
.secondary {
    background: #151f2b;
    color: #dce5ee;
    border: 1px solid #2b3948;
    border-radius: 10px;
    padding: 9px 13px;
}


/* ============================================================
   OVERVIEW
   ============================================================ */

.overview {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}

.hero,
.global,
.stat,
.card,
.scheduler {
    background: #101823;
    border: 1px solid #202e3c;
    border-radius: 20px;
}


/* ============================================================
   HERO
   ============================================================ */

.hero {
    padding: 30px;
    min-height: 205px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background:
        linear-gradient(
            135deg,
            #101b26,
            #0e151e
        );
}

.hero p {
    color: #8997a8;
}

.hero-orb {
    font-size: 65px;
    color: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    filter:
        drop-shadow(
            0 0 25px linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% )55
        );
}


/* ============================================================
   COMANDO GERAL
   ============================================================ */

.global {
    padding: 24px;
}

.global strong {
    display: block;
    margin: 7px 0 18px;
}

.global-buttons {
    display: flex;
    gap: 8px;
}

.global-buttons button,
.card button {
    padding: 10px 13px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    color: #10150b;
    font-weight: 700;
}

.global-buttons button:nth-child(2) {
    background: #202c38;
    color: #dce5ee;
}

.global input {
    width: 100%;
    margin: 18px 0 5px;
    accent-color: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
}

.global .secondary {
    width: 100%;
    margin-top: 15px;
}


/* ============================================================
   RANGE
   ============================================================ */

.range-row {
    display: flex;
    justify-content: space-between;
    color: #8290a0;
    font-size: 12px;
}

.range-row b {
    color: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
}


/* ============================================================
   ESTATÍSTICAS
   ============================================================ */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 16px 0;
}

.stat {
    padding: 18px;
}

.stat b {
    display: block;
    font-size: 24px;
    margin-top: 7px;
}


/* ============================================================
   CABEÇALHO DAS SEÇÕES
   ============================================================ */

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin: 35px 0 14px;
}


/* ============================================================
   CARDS DOS POSTES
   ============================================================ */

.cards {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(300px, 1fr)
        );
    gap: 16px;
}

.card {
    padding: 20px;
    position: relative;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.device-name {
    font-weight: 700;
    font-size: 17px;
}


/* ============================================================
   STATUS
   ============================================================ */

.badge {
    font-size: 10px;
    padding: 5px 8px;
    border-radius: 20px;
    background: #26313c;
    color: #9aa8b7;
}

.badge.on {
    background: #23351f;
    color: #bfe978;
}

.badge.offline {
    background: #38252a;
    color: #ff9aa8;
}


/* ============================================================
   LÂMPADA
   ============================================================ */

.lamp {
    height: 130px;
    margin: 18px 0;
    background:
        radial-gradient(
            circle,
            linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% )22 0,
            #0d151d 60%
        );
    display: grid;
    place-items: center;
    border-radius: 15px;
}

.lamp i {
    display: block;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #26323e;
    box-shadow:
        0 0 0 8px #1b2631;
}

.lamp.on i {
    background: #e9ff9c;
    box-shadow:
        0 0 35px 12px linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% )66,
        0 0 0 8px linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% )22;
}


/* ============================================================
   MÉTRICAS
   ============================================================ */

.metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.metric {
    background: #0b121a;
    padding: 11px;
    border-radius: 11px;
}

.metric small {
    color: #778697;
    display: block;
}

.metric b {
    font-size: 16px;
}


/* ============================================================
   CONTROLE PWM
   ============================================================ */

.pwm {
    margin-top: 14px;
}

.pwm input {
    width: 100%;
    accent-color: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
}


/* ============================================================
   CONTROLES MANUAIS
   ============================================================ */

.controls {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.controls button {
    flex: 1;
}


/* ============================================================
   MODO MANUAL / AUTOMÁTICO
   ============================================================ */

.mode {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

.mode button {
    width: 100%;
    background: #182431;
    color: #aab7c5;
}

.mode button.active {
    background: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    color: #111;
}


/* ============================================================
   AGENDAMENTO
   ============================================================ */

.scheduler {
    padding: 22px;
    margin-top: 25px;
}

.schedule-form {
    display: grid;
    grid-template-columns:
        1.2fr
        150px
        130px
        160px
        auto;
    gap: 8px;
}

.schedule-form input,
.schedule-form select {
    background: #0b121a;
    border: 1px solid #2a3745;
    color: #dce5ee;
    border-radius: 10px;
    padding: 10px;
}

.schedule-form button {
    background: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    border-radius: 10px;
    font-weight: 700;
}


/* ============================================================
   LISTA DE PROGRAMAÇÕES
   ============================================================ */

.schedule-header,
.schedule-row {
    display: grid !important;

    /*
       Todas as colunas possuem exatamente a mesma estrutura.
       O conteúdo fica alinhado verticalmente com o respectivo
       cabeçalho:
       Horário | Poste | Dias | PWM | Ação
    */
    grid-template-columns:
        120px
        minmax(180px, 1.4fr)
        minmax(140px, 1fr)
        70px
        90px;

    align-items: center;
    gap: 12px;

    width: 100%;
    min-width: 620px;
}

.schedule-header {
    padding: 14px 18px;

    border-bottom: 1px solid #202c38;

    color: #778697;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: .12em;
    text-transform: uppercase;
}

.schedule-row {
    padding: 14px 18px;

    border-bottom: 1px solid #202c38;

    color: #9ba8b6;

    font-size: 12px;
    line-height: 1.2;
}

.schedule-row > div {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.schedule-time {
    color: #8d9bab;
}

.schedule-device {
    color: #dce5ee;
    font-weight: 600;
}

.schedule-days {
    color: #9ba8b6;
}

.schedule-pwm {
    color: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    font-weight: 700;
    text-align: left;
}

.schedule-action {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.delete {
    background: #202b36;

    color: #ff9ca7;

    border: 1px solid #3a3035;

    padding: 7px 10px;

    border-radius: 8px;

    font-size: 11px;
    font-weight: 600;
}

.delete:hover {
    background: #38252a;
    border-color: #62404a;
}

.schedule-row:hover {
    background: #101a24;
}

.empty-schedule {
    margin: 0;

    padding: 25px;

    text-align: center;

    color: #778697;

    font-size: 12px;
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

@media (max-width: 850px) {

    .scheduler {
        overflow-x: auto;
    }

    .schedule-header,
    .schedule-row {
        min-width: 620px;
    }



    main {
        padding: 20px;
    }

    .overview {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .schedule-form {
        grid-template-columns: 1fr 1fr;
    }

    .schedule-form button {
        grid-column: 1 / -1;
    }
}
/* ============================================================
   HISTÓRICO / REGISTRO DE EVENTOS
   ============================================================ */

.logs-section {
    margin-top: 25px;
    padding: 22px;
    background: #101823;
    border: 1px solid #202e3c;
    border-radius: 20px;
    overflow: hidden;
}

.logs {
    width: 100%;
    background: #0b121a;
    border-radius: 14px;
    overflow-x: auto;
}

.log-header {
    display: grid !important;
    grid-template-columns:
        minmax(150px, 1.4fr)
        minmax(150px, 1.2fr)
        minmax(100px, 1fr)
        minmax(100px, 1fr)
        70px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 680px;
    padding: 14px 18px;
    background: #0b121a;
    border-bottom: 1px solid #202c38;
    color: #778697;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.log-row {
    display: grid !important;
    grid-template-columns:
        minmax(150px, 1.4fr)
        minmax(150px, 1.2fr)
        minmax(100px, 1fr)
        minmax(100px, 1fr)
        70px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 680px;
    padding: 14px 18px;
    border-bottom: 1px solid #202c38;
    color: #9ba8b6;
    font-size: 12px;
    line-height: 1.2;
}

.log-row > div {
    display: block !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-date {
    color: #8d9bab;
}

.log-device {
    color: #dce5ee;
    font-weight: 600;
}

.log-source,
.log-command {
    display: block !important;
    color: #9ba8b6;
    font-size: 12px;
    font-weight: 400;
}

.log-pwm {
    color: linear-gradient(135deg, #00E0FF 0%, #5B7CFF 50%, #7A5CFF 100% );
    font-weight: 700;
    text-align: right;
}

.log-badge {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: normal;
}

.log-badge.manual,
.log-badge.auto,
.log-badge.on,
.log-badge.off {
    background: transparent;
    color: inherit;
}

.log-row:hover {
    background: #101a24;
}

.empty-log {
    margin: 0;
    padding: 25px;
    text-align: center;
    color: #778697;
    font-size: 12px;
}

.clear-logs {
    background: #202b36;
    color: #ff9ca7;
    border: 1px solid #3a3035;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 700;
    transition: background .2s, border-color .2s, color .2s;
}

.clear-logs:hover {
    background: #38252a;
    border-color: #62404a;
    color: #ffb0b8;
}

.clear-logs:active {
    transform: translateY(1px);
}

.logs::-webkit-scrollbar {
    height: 7px;
}

.logs::-webkit-scrollbar-track {
    background: #0b121a;
}

.logs::-webkit-scrollbar-thumb {
    background: #263442;
    border-radius: 10px;
}

@media (max-width: 850px) {
    .logs {
        overflow-x: auto;
    }

    .log-header,
    .log-row {
        min-width: 680px;
    }
}
