/* =========================
   BASIC
========================= */

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

:root {
    --bg: #f7f8ff;
    --card: #ffffff;
    --text: #18204a;
    --muted: #7180a5;
    --primary: #5546e8;
    --primary2: #7767ff;
    --border: #e3e6f5;
    --shadow: 0 10px 35px rgba(70, 65, 150, 0.10);
}

body.dark {
    --bg: #050b24;
    --card: #0d1638;
    --text: #f4f5ff;
    --muted: #aab3d4;
    --primary: #6654f5;
    --primary2: #8b6cff;
    --border: #1e2b55;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background:
        radial-gradient(
            circle at 90% 10%,
            rgba(115, 90, 255, 0.12),
            transparent 30%
        ),
        var(--bg);

    color: var(--text);

    min-height: 100vh;

    transition:
        background 0.3s,
        color 0.3s;
}


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

.login-page {
    min-height: 100vh;

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

    padding: 20px;

    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(99, 77, 255, 0.35),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #050827,
            #151052,
            #07112f
        );
}

.login-box {
    width: 390px;
    max-width: 100%;

    padding: 45px 35px;

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

    border-radius: 24px;

    box-shadow:
        0 30px 80px rgba(0,0,0,0.35);

    text-align: center;
}

.large-logo {
    font-size: 24px !important;
    font-weight: 700;
    color: #5145df;
    margin-bottom: 30px;
}

.login-box h1 {
    font-size: 30px;
    margin-bottom: 8px;
    color: #171d43;
}

.login-subtitle {
    color: #7580a2;
    margin-bottom: 28px;
}

.login-box input {
    width: 100%;

    padding: 14px 16px;

    margin-bottom: 14px;

    border: 1px solid #dfe3f2;

    border-radius: 12px;

    outline: none;

    font-size: 15px;
}

.login-box input:focus {
    border-color: #6555ed;
    box-shadow: 0 0 0 3px rgba(101,85,237,0.1);
}

.login-error {
    color: #e5484d;
    margin-top: 12px;
    font-size: 13px;
}

.demo-text {
    margin-top: 20px;
    color: #8a92aa;
    font-size: 12px;
}


/* =========================
   NAVBAR
========================= */

.app {
    min-height: 100vh;
}

.topbar {
    height: 72px;

    display: flex;
    align-items: center;

    padding: 0 5%;

    background: var(--card);

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

    position: sticky;
    top: 0;

    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: 700;

    color: var(--primary);

    margin-right: auto;
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    color: var(--muted);

    text-decoration: none;

    padding: 10px 16px;

    border-radius: 10px;

    cursor: pointer;

    font-size: 14px;

    transition: 0.2s;
}

nav a:hover {
    background: rgba(100,80,240,0.1);
    color: var(--primary);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-left: 20px;
}

.theme-btn,
.logout-btn {
    border: 1px solid var(--border);

    background: var(--card);

    color: var(--text);

    padding: 9px 13px;

    border-radius: 10px;

    cursor: pointer;
}

.theme-btn {
    width: 40px;
    height: 40px;
    padding: 0;
}

.logout-btn:hover,
.theme-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}


/* =========================
   COMMON
========================= */

.page {
    max-width: 1250px;

    margin: auto;

    padding: 50px 25px 30px;

    min-height: calc(100vh - 130px);
}

.page-heading {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 30px;
}

.page-heading h1 {
    font-size: 34px;

    margin-bottom: 8px;
}

.page-heading p {
    color: var(--muted);
}

.hidden {
    display: none !important;
}


/* =========================
   BUTTONS
========================= */

.primary-btn,
.secondary-btn,
.small-btn {
    border: none;

    cursor: pointer;

    border-radius: 12px;

    transition: 0.2s;

    font-weight: 600;
}

.primary-btn {
    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary2)
        );

    color: white;

    padding: 13px 22px;

    box-shadow:
        0 8px 20px rgba(85,70,232,0.25);
}

.primary-btn:hover {
    transform: translateY(-2px);
}

.secondary-btn {
    background: var(--card);

    color: var(--primary);

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

    padding: 12px 18px;
}

.secondary-btn:hover {
    border-color: var(--primary);
}

.small-btn {
    padding: 7px 12px;

    background: transparent;

    color: var(--primary);

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


/* =========================
   HOME
========================= */

.hero {
    display: grid;

    grid-template-columns: 1.3fr 0.7fr;

    gap: 50px;

    align-items: center;

    min-height: 470px;
}

.small-label {
    color: var(--primary);

    font-weight: 700;

    letter-spacing: 2px;

    font-size: 12px;
}

.hero h1 {
    font-size: clamp(38px, 5vw, 62px);

    line-height: 1.05;

    margin: 18px 0;
}

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

    line-height: 1.7;

    max-width: 650px;

    margin-bottom: 28px;
}

.hero-card {
    background:
        linear-gradient(
            145deg,
            var(--card),
            rgba(100,80,240,0.10)
        );

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

    border-radius: 28px;

    padding: 45px 30px;

    text-align: center;

    box-shadow: var(--shadow);
}

.hero-emoji {
    width: 130px;
    height: 130px;

    margin: auto auto 25px;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 70px;

    background:
        conic-gradient(
            #ffc83d,
            #ff6d8a,
            #755cff,
            #ffc83d
        );

    box-shadow:
        0 0 35px rgba(100,80,240,0.3);
}

.hero-card p {
    color: var(--muted);

    margin: 10px 0 25px;
}

.emotion-mini {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 10px;
}

.emotion-mini span {
    background: rgba(100,80,240,0.08);

    padding: 10px;

    border-radius: 10px;

    font-size: 13px;
}

.features {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 20px;

    margin-top: 30px;
}

.feature-card {
    background: var(--card);

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

    padding: 25px;

    border-radius: 18px;

    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 28px;

    margin-bottom: 15px;
}

.feature-card h3 {
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--muted);

    line-height: 1.6;

    font-size: 14px;
}


/* =========================
   DETECTION
========================= */

.detection-layout {
    display: grid;

    grid-template-columns: 1.55fr 0.65fr;

    gap: 25px;
}

.camera-card,
.current-card,
.dashboard-card {
    background: var(--card);

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

    border-radius: 20px;

    box-shadow: var(--shadow);
}

.camera-card {
    padding: 20px;
}

.camera-title {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 15px;

    font-weight: 700;
}

.live-indicator {
    color: #16a36a;

    font-size: 12px;
}

.video-container {
    width: 100%;

    max-width: 760px;

    margin: auto;

    position: relative;

    background: #000;

    border-radius: 16px;

    overflow: hidden;
}

#video {
    display: block;

    width: 100%;

    height: auto;

    min-height: 350px;

    object-fit: cover;
}

#overlay {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;
}

.camera-status {
    text-align: center;

    color: var(--muted);

    font-size: 13px;

    padding: 12px;
}

.camera-buttons {
    display: flex;

    justify-content: center;

    gap: 12px;

    flex-wrap: wrap;
}

.current-card {
    padding: 30px;

    text-align: center;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;
}

.current-card h3 {
    margin-bottom: 25px;
}

.current-card h2 {
    margin-top: 20px;

    letter-spacing: 1px;
}

.current-card p {
    color: var(--muted);

    margin-top: 8px;
}

.status-badge {
    padding: 9px 14px;

    border-radius: 20px;

    background: rgba(100,80,240,0.1);

    color: var(--primary);

    font-size: 12px;

    font-weight: 600;
}


/* =========================
   DONUT
========================= */

.big-donut {
    --percentage: 0;

    width: 190px;
    height: 190px;

    border-radius: 50%;

    background:
        conic-gradient(
            var(--primary) calc(var(--percentage) * 1%),
            rgba(100,100,140,0.15) 0
        );

    display: flex;

    align-items: center;

    justify-content: center;

    position: relative;
}

.big-donut::before {
    content: "";

    position: absolute;

    inset: 12px;

    background: var(--card);

    border-radius: 50%;
}

.donut-inner {
    position: relative;

    z-index: 2;

    width: 100%;
    height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;
}

.big-emoji {
    font-size: 65px;
}


/* =========================
   MOODBOARD
========================= */

.mood-grid {
    display: grid;

    grid-template-columns: 0.65fr 1.35fr;

    gap: 22px;

    margin-bottom: 22px;
}

.dashboard-card {
    padding: 25px;
}

.current-mood-card {
    text-align: center;

    display: flex;

    flex-direction: column;

    align-items: center;
}

.current-mood-card h3 {
    margin-bottom: 25px;
}

.current-mood-card h2 {
    margin-top: 20px;
}

.current-mood-card p {
    color: var(--muted);

    margin-top: 8px;
}

.card-title-row {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 25px;
}

.card-title-row span {
    font-size: 12px;

    color: #16a36a;

    background: rgba(22,163,106,0.1);

    padding: 5px 9px;

    border-radius: 10px;
}


/* CIRCULAR EMOTION GRID */

.circular-grid {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 25px 15px;

    align-items: center;

    justify-items: center;
}

.emotion-circle-item {
    text-align: center;
}

.emotion-donut {
    --percentage: 0;
    --circle-color: #6555ed;

    width: 100px;
    height: 100px;

    border-radius: 50%;

    background:
        conic-gradient(
            var(--circle-color)
            calc(var(--percentage) * 1%),
            rgba(120,130,170,0.15) 0
        );

    display: flex;

    align-items: center;

    justify-content: center;

    position: relative;

    margin-bottom: 10px;
}

.emotion-donut::before {
    content: "";

    position: absolute;

    inset: 8px;

    background: var(--card);

    border-radius: 50%;
}

.emotion-donut-content {
    position: relative;

    z-index: 2;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;
}

.emotion-donut-content span:first-child {
    font-size: 22px;
}

.emotion-percent {
    font-size: 12px;

    font-weight: 700;
}

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

    font-weight: 600;
}


/* =========================
   HISTORY
========================= */

.history-card {
    margin-bottom: 30px;
}

.history-item {
    display: grid;

    grid-template-columns: 1fr 100px 100px;

    align-items: center;

    gap: 10px;

    padding: 13px 15px;

    border-radius: 10px;

    background: rgba(100,80,240,0.04);

    margin-bottom: 8px;
}

.history-emotion {
    font-weight: 600;
}

.history-confidence {
    text-align: center;

    color: var(--primary);

    font-weight: 600;
}

.history-time {
    text-align: right;

    color: var(--muted);

    font-size: 12px;
}

.empty-history {
    text-align: center;

    color: var(--muted);

    padding: 35px;
}


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

footer {
    border-top: 1px solid var(--border);

    padding: 20px;

    text-align: center;

    color: var(--muted);

    font-size: 12px;
}


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

@media (max-width: 900px) {

    .topbar {
        padding: 0 20px;
    }

    nav {
        display: none;
    }

    .hero,
    .detection-layout,
    .mood-grid {
        grid-template-columns: 1fr;
    }

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

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

}

@media (max-width: 550px) {

    .page {
        padding: 30px 15px;
    }

    .page-heading {
        align-items: flex-start;

        gap: 15px;

        flex-direction: column;
    }

    .hero h1 {
        font-size: 38px;
    }

    #video {
        min-height: 250px;
    }

    .history-item {
        grid-template-columns:
            1fr 70px 70px;

        font-size: 12px;
    }

}
/* ==========================================
   HIGHEST EMOTION
========================================== */

.current-mood-card h3 {
    font-size: 18px;
    font-weight: 700;
}

.current-mood-card h2 {
    font-size: 24px;
    letter-spacing: 1px;
}

.current-mood-card strong {
    color: var(--primary);
    font-size: 16px;
}