:root {
    --primary: #7c3aed; /* Vibrant Violet */
    --primary-dark: #5b21b6;
    --primary-light: #ede9fe;
    --secondary: rgba(255, 255, 255, 0.6);
    --background: #f8fafc;
    --surface: rgba(255, 255, 255, 0.7); /* Translucent surface for glassmorphism */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.5);
    --border-dark: rgba(226, 232, 240, 0.8);
    --danger: #ef4444;
    --success: #10b981;
    --radius: 24px;
    --radius-sm: 12px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-blur: blur(20px);
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    /* Mesh gradient background */
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,0) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

/* Beautiful dynamic background */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.08), transparent 25%);
    z-index: -1;
    pointer-events: none;
}

#app {
    max-width: 600px; /* limits width on desktop */
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px; /* space for FAB */
}

/* Header & Glassmorphism */
.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(45, 10, 95, 0.65); /* Translucent deep purple */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
    padding: 1rem 0 0.5rem 0;
    box-shadow: 0 10px 40px rgba(43, 10, 89, 0.25);
    color: white;
    overflow: hidden; /* To clip the pseudo-element pattern to the rounded corners */
}

/* Background image pseudo-element to allow opacity */
.app-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('assets/header-pattern.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.4; /* Increased opacity for visibility */
    mix-blend-mode: screen; /* Makes the pattern pop on dark purple */
    z-index: -1;
    pointer-events: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem 0.75rem;
}

.header-top h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Filter Chips - Horizontal Scroll */
.filter-chips-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.filter-chips-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem 0.5rem;
    width: max-content;
}

.chip {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chip.active {
    background: #9333ea;
    color: white;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
}

/* Lesson List */
.lesson-list {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

/* Lesson Card */
.lesson-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.student-badge {
    background: #f3e8ff;
    color: #6b21a8;
    padding: 0.35rem 0.85rem;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 700;
}

.lesson-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-content .section {
    margin-bottom: 0.75rem;
}

.section-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 0.6rem;
    background: rgba(124, 58, 237, 0.08); /* Purple glass tone */
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.1);
}

.section-title .emoji {
    font-size: 1.25rem;
}

.section-text {
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: pre-wrap;
}

.card-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.share-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
}

.share-btn:active {
    color: var(--primary);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
    z-index: 90;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(124, 58, 237, 0); }
    100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.fab:active {
    transform: scale(0.9);
}

@media (max-width: 600px) {
    .fab {
        right: 1.5rem;
        bottom: 1.5rem;
    }
}

/* Bottom Sheet Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #fdfdfc; /* Off-white warm grey as requested */
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 32px 32px 0 0;
    padding: 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-overlay.hidden .modal-content {
    transform: translateY(100%);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1.5rem 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    border-radius: 32px 32px 0 0;
}

.modal-header::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 30%;
    background-image: url('assets/modal-header-pattern.jpg');
    background-size: cover;
    background-position: center right;
    mask-image: linear-gradient(to right, transparent, black 40%);
    -webkit-mask-image: linear-gradient(to right, transparent, black 40%);
    opacity: 0.9;
    z-index: 0;
    pointer-events: none;
}

.modal-header h2, .modal-header .icon-btn {
    position: relative;
    z-index: 1;
}

.modal-header .icon-btn {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
}

.modal-header .icon-btn:active {
    background: rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
}

.lesson-form, .help-body, .settings-body {
    padding: 0 1.5rem 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.form-group label.section-label, .tag-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    background: rgba(124, 58, 237, 0.08);
    padding: 0.5rem 1rem;
    border-radius: 16px;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(124, 58, 237, 0.1);
}

.form-group label.section-label .emoji, .tag-label .emoji {
    font-size: 1.3rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: box-shadow 0.2s, transform 0.2s;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08), 0 0 0 2px var(--primary-light);
    transform: translateY(-1px);
}

/* Tag Helper */
.tag-helper {
    margin-top: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.tag-label {
    display: inline-flex;
    /* Styles are merged with section-label above */
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-btn {
    background: white;
    border: none;
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tag-btn:active {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: scale(0.95);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.1s, opacity 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-main);
}

.btn-primary:active, .btn-secondary:active {
    transform: scale(0.98);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(45, 55, 72, 0.9);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    font-size: 0.9rem;
    z-index: 200;
    transition: all 0.3s;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

/* View Toggle */
.view-toggle { display: flex; background: rgba(0, 0, 0, 0.2); border-radius: 20px; padding: 2px; }
.toggle-btn { background: none; border: none; color: rgba(255, 255, 255, 0.6); padding: 0.4rem 0.8rem; border-radius: 18px; cursor: pointer; transition: all 0.2s; font-size: 0.9rem; }
.toggle-btn.active { background: rgba(255, 255, 255, 0.95); color: #4c1d95; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
/* Form Row */
.form-row { display: flex; gap: 0.75rem; }
.form-row .half { flex: 1; }
/* Calendar View */
.calendar-view { padding: 1.25rem; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.calendar-header h2 { font-size: 1.1rem; color: var(--primary-dark); }
.calendar-grid { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.weekday { text-align: center; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); padding-bottom: 0.5rem; }
.days-container { display: contents; }
.calendar-day { min-height: 80px; padding: 4px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.calendar-day.empty { background: transparent; border-top: 1px dashed var(--border); }
.calendar-day.today .day-num { background: var(--primary); color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.day-num { font-size: 0.8rem; font-weight: 500; align-self: flex-start; margin-bottom: 2px; width: 20px; text-align: center; }
.cal-item { font-size: 0.65rem; background: var(--primary-light); color: var(--primary-dark); padding: 2px 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* Generic hidden class for views */
main.hidden { display: none !important; }


/* Auth & Settings CSS */
.btn-danger { background: var(--danger); color: white; padding: 0.8rem; border-radius: var(--radius-sm); border: none; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: transform 0.1s; }
.btn-danger:active { transform: scale(0.98); }
.login-overlay { 
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    background: #fdfbf7; 
    z-index: 1000; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    overflow: hidden;
}
.violin-bg-watermark {
    position: absolute;
    right: -20px;
    bottom: -10%;
    font-size: 80vh;
    font-family: Georgia, serif;
    color: #e6dfce;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
    font-style: italic;
    line-height: 1;
}
.login-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 6rem 2rem 3rem;
    z-index: 1;
    text-align: center;
}
.login-logo-container { margin-bottom: auto; }
.f-hole-logo {
    font-size: 5rem;
    font-family: Georgia, serif;
    color: #3b185e;
    font-style: italic;
    line-height: 1;
    margin-bottom: 0.5rem;
}
.login-logo-container h1 {
    font-size: 2.2rem;
    color: #3b185e;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}
.login-logo-container .subtitle {
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}
.login-action-container { margin-bottom: auto; display: flex; flex-direction: column; align-items: center; }
.naver-login-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    gap: 0.8rem;
    margin-bottom: 2rem;
}
.naver-icon {
    background: #03C75A;
    color: white;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    border-radius: 12px;
}
.naver-text {
    font-size: 0.95rem;
    color: #333;
    font-weight: 600;
}
.login-guide {
    font-size: 0.85rem;
    color: #777;
    line-height: 1.6;
}
.login-footer { margin-top: auto; }
.login-footer p { font-size: 0.75rem; color: #999; }

.f-hole-inline { font-family: Georgia, serif; font-style: italic; margin-right: -2px; padding-right: 2px; }


.login-overlay.hidden { display: none !important; }
.hidden { display: none !important; }

/* Help Modal CSS */
.help-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--border-dark);
}

.help-card img {
    width: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.help-text h3 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.help-text p {
    font-size: 0.95rem;
    color: var(--text-main);
}
