/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #154E9B;
    --primary-light: #4784F1;
    --primary-hover: #0f3f7f;
    --background: #fafbfc;
    --white: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.logo svg {
    color: var(--primary-light);
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav-btn:hover {
    background: var(--border-light);
    color: var(--primary-color);
}

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

.nav-btn svg {
    width: 18px;
    height: 18px;
}

/* Main content */
.main {
    padding: 40px 0;
    min-height: calc(100vh - 70px);
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.section-header p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Two Column Layout for Create Cards */
.create-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* Card form */
.card-form {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card-form h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: all 0.2s ease;
    background: var(--white);
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* Category and Tags Input */
.category-input-group {
    display: flex;
    gap: 12px;
}

.category-input-group select,
.category-input-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.category-input-group select:focus,
.category-input-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.tags-input-container {
    position: relative;
}

.tags-input-container input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tags-input-container input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.tags-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag-item {
    background: var(--primary-light);
    color: var(--white);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tag-remove {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.tag-remove:hover {
    opacity: 1;
}

/* Filter Controls */
.filter-controls,
.study-filter-controls {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.study-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    background: var(--white);
    transition: all 0.2s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--border-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Cards grid */
.cards-grid-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.grid-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-count {
    background: var(--primary-light);
    color: var(--white);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Empty state */
.empty-state,
.study-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state svg,
.study-empty svg {
    margin-bottom: 16px;
    color: var(--text-muted);
}

.empty-state h4,
.study-empty h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p,
.study-empty p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* Card item */
.card-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
}

.card-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.card-preview {
    margin-bottom: 16px;
}

.card-meta {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-category {
    display: inline-flex;
    align-items: center;
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.card-tag {
    background: var(--border-light);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.card-side {
    margin-bottom: 12px;
}

.card-side-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-side-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-action-btn {
    padding: 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-action-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.card-action-btn.danger:hover {
    background: var(--danger);
    color: var(--white);
}

/* Study mode */
.study-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Study Mode Controls */
.study-mode-controls {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.mode-selection {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-selection label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.mode-buttons {
    display: flex;
    gap: 12px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
}

.mode-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-color);
}

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

/* Review Rating */
.review-rating {
    text-align: center;
    margin: 32px 0;
    padding: 24px;
    background: var(--border-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.review-rating h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.rating-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.rating-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.rating-again {
    border-color: var(--danger);
}

.rating-again:hover {
    background: var(--danger);
    color: var(--white);
}

.rating-hard {
    border-color: var(--warning);
}

.rating-hard:hover {
    background: var(--warning);
    color: var(--white);
}

.rating-good {
    border-color: var(--primary-light);
}

.rating-good:hover {
    background: var(--primary-light);
    color: var(--white);
}

.rating-easy {
    border-color: var(--success);
}

.rating-easy:hover {
    background: var(--success);
    color: var(--white);
}

.rating-emoji {
    font-size: 24px;
    margin-bottom: 4px;
}

.rating-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.rating-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.study-card-container {
    text-align: center;
}

.study-progress {
    margin-bottom: 32px;
}

.study-progress span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-light);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* 3D Flashcard */
.flashcard-3d {
    perspective: 1000px;
    margin: 0 auto 32px;
    width: 100%;
    max-width: 600px;
    height: 400px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard-3d.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 32px;
}

.flashcard-back {
    transform: rotateY(180deg);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.card-text {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    word-wrap: break-word;
}

.flip-btn {
    background: var(--primary-light);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.flip-btn:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
}

/* Study controls */
.study-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Session Controls */
.session-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.session-info {
    display: flex;
    align-items: center;
    gap: 24px;
}

.session-timer,
.session-cards {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.session-timer svg,
.session-cards svg {
    color: var(--primary-color);
}

.session-actions {
    display: flex;
    gap: 12px;
}

.session-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.session-btn.pause:hover {
    background: #fbbf24;
    border-color: #f59e0b;
    color: white;
}

.session-btn.end:hover {
    background: #ef4444;
    border-color: #dc2626;
    color: white;
}

/* Import Section Styles */
.import-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.import-section h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-section h3::before {
    content: "🤖";
    font-size: 20px;
}

.import-section .form-group {
    margin-bottom: 16px;
}

.import-section textarea {
    min-height: 120px;
    resize: vertical;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

.import-section textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(71, 132, 241, 0.1);
}

.generation-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.generation-status.loading {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.generation-status.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.generation-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.section-divider {
    text-align: center;
    margin: 32px 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: 1;
}

.section-divider span {
    background: var(--white);
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.import-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.ai-credits-section {
    margin: 16px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.credits-label {
    font-weight: 600;
    color: #374151;
}

.credits-count {
    background: #154E9B;
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.btn-outline {
    background: transparent;
    border: 2px solid #4784F1;
    color: #4784F1;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: #4784F1;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(71, 132, 241, 0.3);
}

.demo-notice {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
}

/* Statistics Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

/* Daily Progress */
.daily-stats {
    text-align: center;
}

.daily-goal {
    margin-bottom: 16px;
}

.daily-count {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.daily-target {
    font-size: 16px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.progress-bar-container {
    background: var(--bg-secondary);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

/* Overall Stats */
.stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
}

/* Streak Stats */
.streak-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.streak-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.streak-icon {
    font-size: 24px;
}

.streak-details {
    display: flex;
    flex-direction: column;
}

.streak-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.streak-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Difficulty Chart */
.difficulty-chart {
    margin-top: 16px;
}

.difficulty-bar {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.difficulty-segment {
    height: 100%;
    transition: all 0.3s ease;
}

.difficulty-segment.again {
    background: #ef4444;
}

.difficulty-segment.hard {
    background: #f97316;
}

.difficulty-segment.good {
    background: #22c55e;
}

.difficulty-segment.easy {
    background: #3b82f6;
}

.difficulty-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.again {
    background: #ef4444;
}

.legend-color.hard {
    background: #f97316;
}

.legend-color.good {
    background: #22c55e;
}

.legend-color.easy {
    background: #3b82f6;
}

/* Category Stats */
.category-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-stat-item {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.category-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
}

.category-accuracy {
    font-weight: 600;
    color: var(--primary-color);
}

.category-stat-details {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.category-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.category-progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Monthly Stats */
.monthly-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.monthly-stat-item {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.monthly-stat-header {
    margin-bottom: 12px;
}

.monthly-name {
    font-weight: 600;
    color: var(--text-primary);
}

.monthly-stat-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.monthly-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.monthly-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.monthly-value {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 20px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 16px 0;
        gap: 16px;
    }
    
    .nav {
        width: 100%;
        justify-content: center;
    }
    
    .nav-btn {
        flex: 1;
        justify-content: center;
    }
    
    .main {
        padding: 24px 0;
    }
    
    .section-header h2 {
        font-size: 28px;
    }
    
    .section-header p {
        font-size: 16px;
    }
    
    .create-cards-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .card-form,
    .cards-grid-container,
    .filter-controls,
    .study-filter-controls,
    .study-mode-controls {
        padding: 20px;
    }
    
    .filter-controls {
        grid-template-columns: 1fr;
    }
    
    .study-filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mode-buttons {
        flex-direction: column;
    }
    
    .rating-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .rating-btn {
        padding: 12px 8px;
    }
    
    .rating-emoji {
        font-size: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .streak-info {
        grid-template-columns: 1fr;
    }
    
    .monthly-stat-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .monthly-detail {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
    
    .difficulty-legend {
        grid-template-columns: 1fr;
    }
    
    .session-controls {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .session-info {
        justify-content: center;
        gap: 20px;
    }
    
    .session-actions {
        justify-content: center;
    }
    
    .session-btn {
        flex: 1;
        justify-content: center;
    }
    
    .import-section {
        padding: 20px;
        margin-bottom: 24px;
    }
    
    .import-section textarea {
        min-height: 100px;
    }
    
    .import-section .form-group {
        margin-bottom: 12px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .flashcard-3d {
        height: 300px;
    }
    
    .flashcard-front,
    .flashcard-back {
        padding: 24px;
    }
    
    .card-text {
        font-size: 18px;
    }
    
    .study-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
    
    .flashcard-3d {
        height: 250px;
    }
    
    .card-text {
        font-size: 16px;
    }
    
    .modal-content {
        padding: 24px;
        margin: 16px;
    }
}

/* Animations */
.card-item {
    animation: fadeInUp 0.3s ease;
}

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

/* Focus styles for accessibility */
button:focus,
textarea:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Payment Modal Styles */
.payment-modal {
    max-width: 500px;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--background-secondary);
    color: var(--text-primary);
}

.payment-package {
    background: var(--background-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 2px solid var(--primary-light);
}

.package-info h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.package-info p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.card-element {
    background: white;
    padding: 1rem;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.card-element:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 78, 155, 0.1);
}

.card-errors {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    min-height: 1.2rem;
}

.payment-btn {
    width: 100%;
    position: relative;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

.spinner.hidden {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* AI Credits Display */
.ai-credits-display {
    background: var(--background-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.credits-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.credits-count {
    font-weight: 600;
    color: var(--text-primary);
}

.btn.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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