/*
    SnowLift AI - "Arctic Human" Design System
    Warm, Human-Centric, & Interactive
*/

:root {
    /* Human-Centric Palette */
    --primary: #4f46e5;
    /* Indigo */
    --primary-soft: #818cf8;
    --accent: #f43f5e;
    /* Rose */
    --warm-bg: #fff1f2;
    /* Rose-tinted white for human warmth */

    --bg-gradient: linear-gradient(120deg, #fdfbf7 0%, #eef2ff 100%);
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.9);
    /* Increased opacity for better contrast */

    --text-main: #1e1b4b;
    --text-muted: #64748b;

    --shadow-soft: 0 10px 40px -10px rgba(79, 70, 229, 0.1);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    --radius-l: 24px;
    --radius-m: 16px;

    --transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy "human" ease */

    /* Typography Size & Weight System */
    --font-heading: 2.5rem;
    --font-xl: 1.5rem;
    --font-l: 1.25rem;
    --font-m: 1rem;
    --font-s: 0.875rem;
}

body.dark-mode {
    --bg-gradient: linear-gradient(120deg, #0f172a 0%, #1e1b4b 100%);
    --surface: #1e293b;
    --surface-glass: rgba(30, 41, 59, 0.9);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;

    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    /* Friendly, rounded font */
    background: var(--bg-gradient);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    transition: background 0.5s ease;
    font-size: 16px;
    /* Base size */
}

#snow-layer {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
}

.app-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10;
    padding: 1.5rem;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Sidebar (Floating Dock) --- */
.sidebar {
    width: 260px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-l);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: width 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.dark-mode .sidebar {
    border-color: rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed {
    width: 80px;
    padding: 2rem 0;
    align-items: center;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0;
    width: 50px;
    height: 50px;
    margin: 0 auto;
}

.sidebar.collapsed .nav-links {
    width: 100%;
    align-items: center;
}

.sidebar.collapsed .brand {
    justify-content: center;
    padding: 0;
    margin-bottom: 2rem;
}

.sidebar.collapsed .collapse-btn {
    right: 50%;
    transform: translateX(50%) rotate(180deg);
}

.collapse-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 28px;
    height: 28px;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 3rem;
    margin-top: 1rem;
    white-space: nowrap;
    padding-left: 0.8rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    flex-shrink: 0;
}

.brand-text {
    font-size: var(--font-l);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    margin-top: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-m);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-m);
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item i,
.nav-item svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.nav-item:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-l);
    padding: 3.5rem;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-soft);
    position: relative;
    min-width: 0;
}

.dark-mode .main-content {
    border-color: rgba(255, 255, 255, 0.05);
}

.view-section {
    display: none;
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view-section.active {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Human UI Elements --- */
h1 {
    font-weight: 800;
    font-size: var(--font-heading);
    margin-bottom: 0.5rem;
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
}

h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
}

p {
    font-size: var(--font-m);
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-m);
    padding: 1.75rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08);
}

/* --- Dashboard Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-item {
    background: linear-gradient(160deg, var(--surface), rgba(255, 255, 255, 0.5));
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dark-mode .stat-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.stat-val {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-lbl {
    font-size: var(--font-s);
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Buttons with tactile feel */
.btn {
    padding: 1rem 2.5rem;
    border-radius: 14px;
    border: none;
    font-weight: 600;
    font-family: inherit;
    font-size: 1.05rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

.dark-mode .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* --- Drop Box / Forms --- */
textarea,
input,
select {
    width: 100%;
    padding: 1.25rem;
    border-radius: 16px;
    border: 2px solid transparent;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.05rem;
    transition: 0.3s ease;
    margin-bottom: 1.25rem;
}

/* Premium "Drop Box" Style for Create Notes */
#create-notes {
    background: rgba(255, 255, 255, 0.5);
    border: 2px dashed var(--primary-soft);
    min-height: 200px;
    resize: vertical;
}

.dark-mode #create-notes {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode textarea {
    background: rgba(255, 255, 255, 0.05);
}

textarea:focus,
input:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    border-style: solid;
    outline: none;
}

/* --- JS-Driven Card Animations --- */
.flashcard-container {
    perspective: 1200px;
    max-width: 650px;
    margin: 3rem auto;
    cursor: pointer;
}

.flashcard {
    position: relative;
    height: 420px;
    width: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flashcard.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--surface);
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 3rem;
    text-align: center;
}

.card-face h3 {
    font-size: 1.6rem;
    font-weight: 500;
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #f0fdf4, #ffffff);
}

.dark-mode .card-back {
    background: #1e293b;
}

/* --- SVG Timer --- */
.timer-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 2rem auto;
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.time-digits {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.time-status {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 600;
}

.timer-circle-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.05);
    stroke-width: 12;
    stroke-linecap: round;
}

.timer-circle-fg {
    fill: none;
    stroke: var(--primary);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 880;
    /* 2 * PI * 140 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.dark-mode .timer-circle-bg {
    stroke: rgba(255, 255, 255, 0.1);
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
        padding: 0;
        gap: 0;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        z-index: 100;
        flex-direction: row;
        justify-content: space-around;
        padding: 1rem;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
    }

    .sidebar.collapsed {
        width: 100%;
    }

    .brand,
    .collapse-btn {
        display: none;
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        margin: 0;
    }

    .nav-text {
        display: none;
    }

    .nav-item {
        padding: 0.8rem;
        border-radius: 12px;
    }

    .main-content {
        border-radius: 0;
        padding: 1.5rem;
        margin-bottom: 90px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-val {
        font-size: 2.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }
}