* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #C9A87C;
    --secondary-color: #B8906B;
    --accent-color: #D4AF87;
    --bg-cream: #FFF9F0;
    --bg-light: #FFFBF5;
    --text-dark: #3C3C3C;
    --text-medium: #646464;
    --text-light: #A0A0A0;
    --border-color: #E8DCC8;
    --success-color: #7CB342;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, #FFF9F0 0%, #F5EFE6 100%);
    color: var(--text-dark);
    min-height: 100vh;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
#loginScreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 50px 40px;
    max-width: 450px;
    width: 100%;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.logo h1 {
    font-size: 36px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.tagline {
    color: var(--text-medium);
    font-size: 14px;
    font-style: italic;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-medium);
    font-size: 16px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Georgia', serif;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.form-group small {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
}

.success-message {
    background: #E8F5E9;
    color: var(--success-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Georgia', serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(201, 168, 124, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-cream);
    border-color: var(--primary-color);
}

/* Navbar */
.navbar {
    background: white;
    padding: 20px 40px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
}

.nav-brand .logo-icon {
    font-size: 28px;
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

/* Main Content Layout */
.main-content {
    display: flex;
    min-height: calc(100vh - 80px);
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: white;
    padding: 30px 20px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.progress-overview {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-cream);
    border-radius: 12px;
}

.progress-overview h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.progress-bar {
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.5s ease;
}

.progress-overview p {
    font-size: 14px;
    color: var(--text-medium);
    text-align: center;
}

.chapter-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chapter-item {
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-item:hover {
    background: var(--bg-cream);
    border-left-color: var(--primary-color);
}

.chapter-item.active {
    background: var(--bg-cream);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.chapter-title {
    font-size: 14px;
    color: var(--text-dark);
}

.chapter-progress {
    font-size: 12px;
    color: var(--text-light);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

#questionContainer {
    max-width: 800px;
    margin: 0 auto;
}

.chapter-header {
    text-align: center;
    margin-bottom: 50px;
}

.chapter-header .decorative {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.chapter-header h2 {
    font-size: 36px;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.chapter-header .subtitle {
    font-size: 16px;
    color: var(--text-medium);
    font-style: italic;
}

.question-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.question-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.question-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.question-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.6;
}

.answer-box {
    background: var(--bg-cream);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    min-height: 150px;
    position: relative;
}

.answer-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.control-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.control-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.control-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.answer-textarea {
    width: 100%;
    min-height: 120px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: 'Georgia', serif;
    color: var(--text-dark);
    resize: vertical;
    line-height: 1.8;
}

.answer-textarea:focus {
    outline: none;
}

.answer-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.save-status {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
}

.save-status.saved {
    color: var(--success-color);
}

.word-count {
    font-size: 12px;
    color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 300px;
    }

    .content-area {
        padding: 20px;
    }

    .navbar {
        padding: 15px 20px;
    }

    .login-container {
        padding: 30px 20px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
