/* CSS Variables for Premium Dark Mode Theme */
:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    
    --rating-hard: #ef4444;
    --rating-good: #10b981;
    --rating-easy: #3b82f6;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

body.light-mode {
    --bg-color: #f8fafc;
    --surface-color: rgba(255, 255, 255, 0.8);
    --surface-border: rgba(0, 0, 0, 0.1);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Abstract Background Shapes for Aesthetics */
.bg-shape {
    position: absolute;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate ease-in-out;
}
.shape-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: radial-gradient(circle, rgba(59,130,246,0.3) 0%, rgba(0,0,0,0) 70%); }
.shape-2 { bottom: -10%; right: -10%; width: 40vw; height: 40vw; background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, rgba(0,0,0,0) 70%); animation-delay: -5s; }
.shape-3 { top: 40%; left: 40%; width: 30vw; height: 30vw; background: radial-gradient(circle, rgba(139,92,246,0.2) 0%, rgba(0,0,0,0) 70%); animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

/* Layout */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 30px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.nav-actions {
    display: flex;
    gap: 10px;
}
.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    text-decoration: none;
}
.nav-btn:hover { color: var(--text-primary); background: var(--surface-border); }
.nav-btn.active { color: var(--text-primary); font-weight: 600; }
.nav-btn.outline { border: 1px solid var(--surface-border); }

/* Views */
.view {
    display: none;
    flex: 1;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}
.view.active { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-section { margin-bottom: 25px; }
.header-section h1 { font-size: 2rem; font-weight: 700; margin-bottom: 5px; letter-spacing: -0.5px; }
.header-section p { color: var(--text-secondary); font-size: 1rem; }

/* Glassmorphism Panels */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-glass);
}

/* Deck Grid */
.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}
.deck-card {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-glass);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.deck-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.2);
}
.deck-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 10px; }
.deck-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.stat-due { color: var(--rating-hard); font-weight: 600; }

/* Forms */
.form-panel { max-width: 500px; margin: 0 auto; width: 100%; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500;}
.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.2s;
    resize: vertical;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-family);
}
.btn-primary:hover { background: var(--accent-hover); }

/* Study View */
.study-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}
.btn-icon {
    background: none; border: none; color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 8px; border-radius: 50%; transition: background 0.2s;
}
.btn-icon:hover { background: var(--surface-border); }
.study-deck-title { font-weight: 600; font-size: 1.1rem; }
.study-stats { font-size: 0.9rem; color: var(--text-secondary); background: var(--surface-border); padding: 4px 12px; border-radius: 20px; }

/* Flashcard 3D Flip */
.scene {
    flex: 1;
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}
.card {
    width: 100%;
    max-width: 600px;
    height: 400px;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}
.card.is-flipped { transform: rotateX(180deg); }

.card__face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}
.card__face--back {
    transform: rotateX(180deg);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
}

.card-content { font-size: 1.5rem; line-height: 1.6; font-weight: 500; width: 100%; white-space: pre-wrap; }
.hint-text { position: absolute; bottom: 20px; font-size: 0.85rem; color: var(--text-secondary); opacity: 0.7; }

/* Study Actions */
.study-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}
.study-actions.hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.btn-rating {
    flex: 1;
    max-width: 120px;
    padding: 12px;
    border: 1px solid var(--surface-border);
    background: var(--surface-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
    backdrop-filter: blur(10px);
}
.btn-rating:hover { transform: translateY(-2px); background: rgba(255,255,255,0.05); }
.btn-rating:active { transform: translateY(0); }
.rating-label { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.rating-time { font-size: 0.8rem; color: var(--text-secondary); }

.btn-rating.hard .rating-label { color: var(--rating-hard); }
.btn-rating.good .rating-label { color: var(--rating-good); }
.btn-rating.easy .rating-label { color: var(--rating-easy); }

.hidden { display: none !important; }

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--rating-good);
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: opacity 0.3s, transform 0.3s;
}

/* Utilities */
.mt-4 { margin-top: 1rem; }
.text-center { text-align: center; }
