/* ============================================================
   PENTRA IoT
   PROFESSIONAL INDUSTRIAL MONITORING UI
   ============================================================ */

:root {
    --bg-main: #050b14;
    --bg-sidebar: #07111f;
    --bg-card: #0b1727;
    --bg-card-2: #0e1d30;

    --border: rgba(100, 150, 200, 0.16);
    --border-bright: rgba(0, 217, 255, 0.28);

    --cyan: #00d9ff;
    --blue: #2563eb;
    --purple: #8b5cf6;

    --green: #22c55e;
    --yellow: #facc15;
    --orange: #fb923c;
    --red: #ef4444;

    --text: #f3f8ff;
    --text-soft: #a7b8cb;
    --text-muted: #62758b;

    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(37, 99, 235, 0.09),
            transparent 35%
        ),
        radial-gradient(
            circle at 85% 20%,
            rgba(139, 92, 246, 0.08),
            transparent 30%
        ),
        var(--bg-main);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    min-height: 100vh;

    line-height: 1.5;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: #050b14;
}

::-webkit-scrollbar-thumb {
    background: #1c3550;
    border-radius: 20px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2d5379;
}

/* ============================================================
   LINKS
   ============================================================ */

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;

    left: 0;
    top: 0;
    bottom: 0;

    width: 260px;

    background:
        linear-gradient(
            180deg,
            #081321 0%,
            #06101d 100%
        );

    border-right: 1px solid var(--border);

    z-index: 100;

    display: flex;
    flex-direction: column;

    padding: 22px 15px;
}

/* ============================================================
   BRAND
   ============================================================ */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 6px 10px 2px;
}

.brand-logo {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue),
            var(--purple)
        );

    color: white;

    font-size: 19px;
    font-weight: 900;

    box-shadow:
        0 0 30px rgba(0, 217, 255, 0.22);
}

.brand-name {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.brand-name span {
    color: var(--cyan);
}

.brand-subtitle {
    color: var(--text-muted);

    font-size: 8px;
    letter-spacing: 1.7px;

    margin-left: 52px;
    margin-top: -4px;
}

/* ============================================================
   SIDEBAR SECTION
   ============================================================ */

.sidebar-section {
    margin-top: 30px;
}

.sidebar-title {
    color: #4f657c;

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 1.5px;

    padding: 0 12px;
    margin-bottom: 9px;
}

/* ============================================================
   NAVIGATION
   ============================================================ */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-nav a {
    position: relative;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 12px 13px;

    border-radius: 12px;

    color: #8ea3b9;

    font-size: 12px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.sidebar-nav a:hover {
    color: white;

    background: rgba(37, 99, 235, 0.09);

    transform: translateX(2px);
}

.sidebar-nav a.active {
    color: white;

    background:
        linear-gradient(
            135deg,
            rgba(37, 99, 235, 0.85),
            rgba(124, 58, 237, 0.85)
        );

    box-shadow:
        0 10px 30px rgba(37, 99, 235, 0.18);
}

.sidebar-nav a.active::before {
    content: "";

    position: absolute;

    left: 0;
    top: 10px;
    bottom: 10px;

    width: 3px;

    border-radius: 5px;

    background: var(--cyan);
}

.nav-icon {
    width: 25px;
    height: 25px;

    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,0.05);

    font-size: 12px;
}

/* ============================================================
   SIDEBAR DEVICE CARD
   ============================================================ */

.sidebar-device {
    margin-top: auto;

    padding: 14px;

    border-radius: 15px;

    border: 1px solid var(--border);

    background:
        linear-gradient(
            135deg,
            rgba(0,217,255,0.07),
            rgba(139,92,246,0.07)
        );
}

.sidebar-device-title {
    color: var(--text-muted);

    font-size: 8px;
    letter-spacing: 1.2px;
}

.sidebar-device-name {
    margin-top: 6px;

    font-size: 12px;
    font-weight: 800;
}

.sidebar-device-status {
    margin-top: 8px;

    display: flex;
    align-items: center;

    gap: 6px;

    font-size: 9px;
    color: var(--green);
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 10px rgba(34,197,94,0.8);
}

/* ============================================================
   MAIN
   ============================================================ */

.main {
    margin-left: 260px;

    min-height: 100vh;

    padding: 25px 28px 50px;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;
}

.page-heading {
    font-size: 25px;
    font-weight: 900;

    letter-spacing: -0.6px;
}

.page-description {
    color: var(--text-muted);

    font-size: 11px;

    margin-top: 3px;
}

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

.system-status {
    display: flex;

    align-items: center;

    gap: 9px;

    padding: 9px 13px;

    border-radius: 12px;

    background: rgba(34,197,94,0.07);

    border: 1px solid rgba(34,197,94,0.18);

    color: var(--green);

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

    letter-spacing: 0.5px;
}

.system-status.offline {
    color: var(--red);

    background: rgba(239,68,68,0.07);

    border-color: rgba(239,68,68,0.18);
}

/* ============================================================
   GRID
   ============================================================ */

.grid {
    display: grid;

    gap: 15px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ============================================================
   CARD
   ============================================================ */

.card {
    position: relative;

    background:
        linear-gradient(
            145deg,
            rgba(14,29,48,0.96),
            rgba(8,19,32,0.96)
        );

    border: 1px solid var(--border);

    border-radius: 18px;

    padding: 19px;

    box-shadow: var(--shadow);

    overflow: hidden;
}

.card::before {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    top: 0;

    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(0,217,255,0.25),
            transparent
        );
}

.card:hover {
    border-color: rgba(0,217,255,0.22);

    transform: translateY(-1px);

    transition: 0.2s ease;
}

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

.hero-card {
    background:
        radial-gradient(
            circle at 85% 20%,
            rgba(0,217,255,0.15),
            transparent 28%
        ),
        radial-gradient(
            circle at 15% 90%,
            rgba(139,92,246,0.15),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #0d2239,
            #0b1529
        );

    border-color:
        rgba(0,217,255,0.16);
}

.hero-top {
    display: flex;

    justify-content: space-between;
    align-items: flex-start;

    gap: 20px;
}

.hero-label {
    color: var(--cyan);

    font-size: 9px;

    letter-spacing: 1.7px;

    font-weight: 800;
}

.hero-title {
    margin-top: 7px;

    font-size: 25px;

    font-weight: 900;
}

.hero-description {
    color: var(--text-muted);

    margin-top: 4px;

    font-size: 11px;
}

.hero-icon {
    width: 50px;
    height: 50px;

    border-radius: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            rgba(0,217,255,0.16),
            rgba(37,99,235,0.14)
        );

    border: 1px solid rgba(0,217,255,0.18);

    color: var(--cyan);

    font-size: 22px;
}

/* ============================================================
   LABEL
   ============================================================ */

.metric-label {
    color: var(--text-muted);

    font-size: 9px;

    font-weight: 800;

    letter-spacing: 1.2px;

    text-transform: uppercase;
}

/* ============================================================
   VALUE
   ============================================================ */

.metric-value {
    margin-top: 7px;

    font-size: 29px;

    line-height: 1;

    font-weight: 900;

    letter-spacing: -0.7px;
}

.metric-unit {
    color: var(--text-muted);

    font-size: 10px;

    margin-left: 3px;
}

/* ============================================================
   COLORS
   ============================================================ */

.color-cyan {
    color: var(--cyan);
}

.color-blue {
    color: #60a5fa;
}

.color-purple {
    color: var(--purple);
}

.color-green {
    color: var(--green);
}

.color-yellow {
    color: var(--yellow);
}

.color-orange {
    color: var(--orange);
}

.color-red {
    color: var(--red);
}

/* ============================================================
   LOAD GAUGE
   ============================================================ */

.load-section {
    margin-top: 24px;
}

.load-header {
    display: flex;

    align-items: center;
    justify-content: space-between;
}

.load-number {
    font-size: 34px;

    font-weight: 900;

    letter-spacing: -1px;
}

.load-track {
    height: 10px;

    margin-top: 12px;

    border-radius: 99px;

    background: #17283b;

    overflow: hidden;
}

.load-fill {
    height: 100%;

    width: 0%;

    border-radius: 99px;

    background:
        linear-gradient(
            90deg,
            #06b6d4,
            #2563eb,
            #8b5cf6
        );

    box-shadow:
        0 0 20px rgba(37,99,235,0.35);

    transition: width 0.5s ease;
}

.load-scale {
    display: flex;

    justify-content: space-between;

    color: #4e647b;

    font-size: 8px;

    margin-top: 6px;
}

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

.badge {
    display: inline-flex;

    align-items: center;

    gap: 5px;

    padding: 5px 9px;

    border-radius: 99px;

    font-size: 8px;

    font-weight: 900;

    letter-spacing: 0.5px;
}

.badge-normal {
    color: var(--green);

    background: rgba(34,197,94,0.09);

    border: 1px solid rgba(34,197,94,0.16);
}

.badge-warning {
    color: var(--yellow);

    background: rgba(250,204,21,0.09);

    border: 1px solid rgba(250,204,21,0.16);
}

.badge-high {
    color: var(--orange);

    background: rgba(251,146,60,0.09);

    border: 1px solid rgba(251,146,60,0.16);
}

.badge-alarm {
    color: var(--red);

    background: rgba(239,68,68,0.09);

    border: 1px solid rgba(239,68,68,0.16);
}

/* ============================================================
   PHASE CARD
   ============================================================ */

.phase-card {
    background:
        linear-gradient(
            145deg,
            #0d1d31,
            #091523
        );
}

.phase-header {
    display: flex;

    justify-content: space-between;

    align-items: center;
}

.phase-name {
    font-size: 12px;

    font-weight: 900;
}

.phase-subtitle {
    color: var(--text-muted);

    font-size: 8px;

    margin-top: 2px;
}

.phase-voltage {
    margin-top: 20px;

    font-size: 29px;

    font-weight: 900;
}

.phase-voltage span {
    color: var(--text-muted);

    font-size: 10px;

    font-weight: 500;
}

.phase-line {
    height: 1px;

    background: var(--border);

    margin: 15px 0;
}

.phase-row {
    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 7px 0;

    color: var(--text-soft);

    font-size: 10px;
}

.phase-row strong {
    color: white;

    font-size: 11px;
}

/* ============================================================
   METRIC SMALL CARD
   ============================================================ */

.metric-card {
    min-height: 115px;
}

.metric-icon {
    width: 31px;
    height: 31px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: rgba(255,255,255,0.04);

    margin-bottom: 13px;

    font-size: 13px;
}

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

.section-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin: 28px 0 12px;
}

.section-title {
    font-size: 14px;

    font-weight: 900;
}

.section-subtitle {
    color: var(--text-muted);

    font-size: 9px;
}

/* ============================================================
   HEALTH GRID
   ============================================================ */

.health-card {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;
}

.health-left {
    display: flex;

    align-items: center;

    gap: 10px;
}

.health-icon {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: rgba(0,217,255,0.07);

    color: var(--cyan);
}

.health-name {
    font-size: 10px;

    font-weight: 700;
}

.health-value {
    color: var(--text-muted);

    font-size: 8px;

    margin-top: 2px;
}

/* ============================================================
   INFO ROW
   ============================================================ */

.info-row {
    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 10px 0;

    border-bottom: 1px solid var(--border);

    font-size: 10px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    color: white;

    font-weight: 700;
}

/* ============================================================
   ALERT CARD
   ============================================================ */

.alert-card {
    border-radius: 15px;

    padding: 15px;

    border: 1px solid var(--border);

    background: #0b1829;
}

.alert-card.active {
    border-color: rgba(239,68,68,0.3);

    background:
        linear-gradient(
            135deg,
            rgba(127,29,29,0.20),
            rgba(15,20,30,0.9)
        );
}

.alert-header {
    display: flex;

    justify-content: space-between;

    align-items: center;
}

.alert-title {
    font-size: 11px;

    font-weight: 800;
}

.alert-description {
    color: var(--text-muted);

    font-size: 9px;

    margin-top: 5px;
}

/* ============================================================
   TABLE
   ============================================================ */

.table-container {
    width: 100%;

    overflow-x: auto;

    border-radius: 15px;

    border: 1px solid var(--border);
}

.data-table {
    width: 100%;

    border-collapse: collapse;

    min-width: 850px;
}

.data-table th {
    background: #0a1626;

    color: #60768d;

    padding: 12px;

    text-align: left;

    font-size: 8px;

    letter-spacing: 0.8px;

    text-transform: uppercase;

    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px;

    color: #b4c4d5;

    font-size: 10px;

    border-bottom: 1px solid rgba(100,150,200,0.08);
}

.data-table tr:hover td {
    background: rgba(0,217,255,0.025);
}

/* ============================================================
   BUTTON
   ============================================================ */

.btn {
    border: none;

    border-radius: 10px;

    padding: 10px 15px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--blue),
            var(--purple)
        );

    font-size: 10px;

    font-weight: 800;

    cursor: pointer;

    transition: 0.2s ease;

    box-shadow:
        0 8px 20px rgba(37,99,235,0.18);
}

.btn:hover {
    transform: translateY(-1px);

    box-shadow:
        0 12px 25px rgba(37,99,235,0.25);
}

.btn-secondary {
    background: #14253a;

    border: 1px solid var(--border);

    box-shadow: none;
}

.btn-danger {
    background:
        linear-gradient(
            135deg,
            #dc2626,
            #991b1b
        );
}

/* ============================================================
   FORM
   ============================================================ */

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;

    color: #8499ad;

    font-size: 9px;

    font-weight: 700;

    margin-bottom: 6px;
}

.form-input {
    width: 100%;

    padding: 11px 12px;

    border-radius: 10px;

    border: 1px solid #20364d;

    background: #071322;

    color: white;

    outline: none;

    font-size: 11px;

    transition: 0.2s;
}

.form-input:focus {
    border-color: rgba(0,217,255,0.45);

    box-shadow:
        0 0 0 3px rgba(0,217,255,0.06);
}

/* ============================================================
   CHART
   ============================================================ */

.chart-container {
    position: relative;

    width: 100%;

    min-height: 250px;
}

.chart {
    width: 100%;

    height: 250px;

    display: block;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
    margin-top: 35px;

    padding: 18px 0;

    text-align: center;

    color: #3e5369;

    font-size: 9px;

    border-top: 1px solid rgba(100,150,200,0.07);
}

/* ============================================================
   MOBILE NAV
   ============================================================ */

.mobile-nav {
    display: none;

    position: fixed;

    left: 10px;
    right: 10px;
    bottom: 10px;

    z-index: 200;

    padding: 7px;

    border-radius: 18px;

    background:
        rgba(7,17,31,0.94);

    border: 1px solid rgba(100,150,200,0.18);

    backdrop-filter: blur(20px);

    box-shadow:
        0 15px 40px rgba(0,0,0,0.4);

    justify-content: space-around;
}

.mobile-nav a {
    min-width: 54px;

    padding: 7px 8px;

    border-radius: 11px;

    text-align: center;

    color: #70859b;

    font-size: 8px;

    font-weight: 700;
}

.mobile-nav a.active {
    color: white;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #7c3aed
        );
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    padding: 50px 20px;

    text-align: center;

    color: var(--text-muted);
}

.empty-icon {
    width: 50px;
    height: 50px;

    margin: auto;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 15px;

    background: rgba(0,217,255,0.05);

    color: var(--cyan);

    font-size: 20px;
}

.empty-title {
    color: white;

    font-size: 13px;

    font-weight: 800;

    margin-top: 12px;
}

.empty-text {
    font-size: 9px;

    margin-top: 4px;
}

/* ============================================================
   LOADING
   ============================================================ */

.loading {
    position: relative;

    overflow: hidden;
}

.loading::after {
    content: "";

    position: absolute;

    inset: 0;

    transform: translateX(-100%);

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255,255,255,0.035),
            transparent
        );

    animation: loading 1.5s infinite;
}

@keyframes loading {
    100% {
        transform: translateX(100%);
    }
}

/* ============================================================
   RESPONSIVE TABLET
   ============================================================ */

@media (max-width: 1200px) {

    .sidebar {
        width: 230px;
    }

    .main {
        margin-left: 230px;

        padding: 20px;
    }

    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */

@media (max-width: 760px) {

    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;

        padding:
            15px
            15px
            85px;
    }

    .topbar {
        align-items: flex-start;
    }

    .page-heading {
        font-size: 20px;
    }

    .page-description {
        max-width: 230px;
    }

    .system-status {
        padding: 7px 9px;

        font-size: 8px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .hero-top {
        gap: 10px;
    }

    .hero-title {
        font-size: 21px;
    }

    .hero-icon {
        width: 43px;
        height: 43px;

        font-size: 18px;
    }

    .metric-value {
        font-size: 25px;
    }

    .phase-voltage {
        font-size: 26px;
    }

    .mobile-nav {
        display: flex;
    }

    .card {
        border-radius: 15px;

        padding: 15px;
    }

}

/* ============================================================
   VERY SMALL SCREEN
   ============================================================ */

@media (max-width: 420px) {

    .main {
        padding-left: 11px;
        padding-right: 11px;
    }

    .topbar {
        gap: 8px;
    }

    .page-heading {
        font-size: 18px;
    }

    .system-status {
        font-size: 7px;
    }

    .hero-title {
        font-size: 19px;
    }

    .load-number {
        font-size: 30px;
    }

}