/* ===== Category Select & Filter UI ===== */
.form-group select,
.category-filter select {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.2s;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.form-group select:focus,
.category-filter select:focus {
    outline: none;
    border-color: var(--primary);
}

.category-filter {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-filter label {
    font-weight: 600;
    color: var(--text-muted);
}

.category-filter .btn-link {
    color: var(--primary);
    background: none;
    border: none;
    padding: 0;
    font-size: 1rem;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: color 0.2s;
}
.category-filter .btn-link:hover {
    color: var(--primary-dark);
}
/* ===== Categories UI ===== */
.categories-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.categories-table th,
.categories-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.categories-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.categories-table tr:hover {
    background: var(--bg);
}

.category-form {
    margin-bottom: 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
}

.category-form input[type="text"] {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.category-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.categories-table input[type="text"] {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s;
}

.categories-table input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.categories-table .btn,
.category-form .btn {
    margin-left: 0.5rem;
}

.categories-table .btn-danger {
    margin-left: 0.25rem;
}

.categories-table .btn[disabled],
.categories-table input[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

.categories-table form.inline-form {
    display: inline;
}

.categories-table td {
    vertical-align: middle;
}
/* ===== CSS Variables ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    
    --forgot: #ef4444;
    --hard: #f59e0b;
    --good: #10b981;
    --easy: #06b6d4;
    
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Navbar ===== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-links a.active {
    background: var(--primary);
    color: white;
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

/* ===== Container ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 2rem;
    text-align: center;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-number.highlight {
    color: var(--danger);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: #e0e7ff;
    color: #3730a3;
    border-left: 4px solid var(--primary);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* ===== Forms ===== */
.note-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-actions {
    text-align: center;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

/* Review Buttons */
.btn-forgot {
    background: var(--forgot);
    color: white;
}

.btn-hard {
    background: var(--hard);
    color: white;
}

.btn-good {
    background: var(--good);
    color: white;
}

.btn-easy {
    background: var(--easy);
    color: white;
}

.btn-forgot:hover { filter: brightness(0.9); }
.btn-hard:hover { filter: brightness(0.9); }
.btn-good:hover { filter: brightness(0.9); }
.btn-easy:hover { filter: brightness(0.9); }

/* ===== Info Box ===== */
.info-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #e0e7ff;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.info-box h3 {
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.info-box ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.info-box li {
    margin-bottom: 0.5rem;
}

/* ===== Cards ===== */
.cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.review-card {
    border-left: 4px solid var(--primary);
}

.card-content {
    padding: 1.5rem;
}

.note-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.note-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card-actions {
    padding: 1rem 1.5rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.action-label {
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.review-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ===== Upcoming Section ===== */
.upcoming-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.upcoming-section h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upcoming-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.upcoming-time {
    min-width: 120px;
    font-weight: 600;
    color: var(--primary);
}

.upcoming-text {
    color: var(--text-muted);
}

/* ===== Legend ===== */
.legend {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.legend h3 {
    margin-bottom: 1rem;
}

.legend-items {
    display: grid;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.legend-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    min-width: 80px;
    text-align: center;
}

.legend-badge.forgot { background: var(--forgot); }
.legend-badge.hard { background: var(--hard); }
.legend-badge.good { background: var(--good); }
.legend-badge.easy { background: var(--easy); }

/* ===== Review Section ===== */
.review-section h2 {
    margin-bottom: 1.5rem;
}

/* ===== Table ===== */
.notes-table-container {
    overflow-x: auto;
}

.notes-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.notes-table th,
.notes-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.notes-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notes-table tr:hover {
    background: var(--bg);
}

.note-content-cell {
    max-width: 300px;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.due {
    background: #fee2e2;
    color: var(--danger);
}

.status-badge.learning {
    background: #fef3c7;
    color: #b45309;
}

.status-badge.mastered {
    background: #d1fae5;
    color: #065f46;
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-buttons .inline-form {
    display: inline;
}

.edit-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.edit-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Note Info Box ===== */
.note-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.note-info h3 {
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.note-info ul {
    list-style: none;
    padding: 0;
}

.note-info li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.note-info li:last-child {
    border-bottom: none;
}

/* ===== Secondary Button ===== */
.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* ===== Hint Styles ===== */
.hint-container {
    margin: 1rem 0;
}

.btn-hint {
    background: #fef3c7;
    color: #b45309;
    border: 2px solid #f59e0b;
}

.btn-hint:hover {
    background: #fde68a;
}

.hint-text {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: var(--radius-sm);
    border-left: 4px solid #f59e0b;
    color: #92400e;
    white-space: pre-wrap;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .review-buttons {
        flex-direction: column;
    }
    
    .review-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .note-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ===== How It Works Page ===== */
.info-hero {
    text-align: center;
    margin: 2rem 0;
}

.info-hero .hero-image {
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
}

.info-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.info-section h2 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.info-section p {
    line-height: 1.7;
    color: var(--text);
}

.timeline-container {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.timeline-item {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
}

.timeline-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8d7da, #f5c2c7);
}

.timeline-icon.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
}

.timeline-content h4 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.timeline-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Flow Diagram */
.flow-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.flow-step {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
    max-width: 600px;
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.flow-step.highlight {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(40,167,69,0.05), rgba(40,167,69,0.1));
}

.step-number {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.step-content h4 {
    margin-bottom: 0.5rem;
}

.step-content p {
    font-size: 0.95rem;
    margin: 0;
}

.step-content code {
    background: var(--bg-card);
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

.flow-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.flow-arrow.loop {
    font-size: 2rem;
    color: var(--primary);
}

/* Rating Grid */
.rating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.rating-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 2px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.rating-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.rating-card.forgot { border-color: #dc3545; }
.rating-card.hard { border-color: #fd7e14; }
.rating-card.good { border-color: #28a745; }
.rating-card.easy { border-color: #17a2b8; }

.rating-emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.rating-label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.rating-effect {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Interval Timeline */
.interval-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.interval-step {
    background: var(--bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 100px;
}

.interval-step.highlight {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.interval-step.highlight .interval-label {
    color: rgba(255,255,255,0.9);
}

.interval-day {
    font-weight: 700;
    font-size: 1.1rem;
}

.interval-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.interval-connector {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Tips Section */
.info-section.tips ul {
    list-style: none;
    padding: 0;
}

.info-section.tips li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.6;
}

.info-section.tips li:last-child {
    border-bottom: none;
}

/* CTA Section */
.cta-section {
    text-align: center;
    margin: 3rem 0;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

