/* Header és közös container */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f1f5f9);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header-btn:hover {
    border-color: var(--accent, #3b82f6);
}

.theme-toggle button {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f1f5f9);
    cursor: pointer;
    font-size: 0.9rem;
}

.streak-icon {
    color: #fbbf24;
}

/* Dashboard section */
#dashboardSection {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Dashboard és Material Picker */
.admin-menu {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .admin-menu { grid-template-columns: repeat(2, 1fr); }
}

.admin-btn {
    padding: 1rem;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    color: var(--text-primary, #f1f5f9);
    cursor: pointer;
    font-size: 0.95rem;
    text-align: center;
    transition: all 0.2s;
}

.admin-btn:hover {
    border-color: var(--accent, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
}

/* Material Picker */
.material-picker {
    /* width a szülőtől jön */
}

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

.picker-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    color: var(--text-secondary, #94a3b8);
}

.search-box input {
    padding: 0.5rem 1rem;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f1f5f9);
    font-size: 0.9rem;
    width: 200px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent, #3b82f6);
}

.search-box input::placeholder {
    color: var(--text-secondary, #94a3b8);
}

.material-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 700px) {
    .material-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 450px) {
    .material-cards { grid-template-columns: 1fr; }
}

.material-card {
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.material-card:hover {
    border-color: var(--accent, #3b82f6);
    transform: translateY(-2px);
}

.material-card.hidden {
    display: none;
}

.material-card-flag {
    font-size: 2rem;
    line-height: 1;
}

.material-card-title {
    font-weight: 600;
    margin: 0.75rem 0 0.25rem;
    font-size: 0.95rem;
}

.material-card-info {
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
}

/* Material Bar - kiválasztott tananyag sáv */
.material-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card, #1e293b);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.material-title {
    font-weight: 500;
    font-size: 1rem;
}

.btn-change-material {
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-change-material:hover {
    border-color: var(--accent, #3b82f6);
    color: var(--accent, #3b82f6);
}

/* No results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary, #94a3b8);
}

/* Main App container */
#mainApp {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Admin views */
.admin-view {
    margin-top: 1.5rem;
    width: 100%;
}

.admin-view h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 1rem 0;
    color: var(--text-secondary, #94a3b8);
}

.admin-view .subtitle {
    color: var(--text-secondary, #94a3b8);
    margin: -0.5rem 0 1.5rem 0;
    font-size: 0.9rem;
}

/* Access Matrix */
.access-matrix {
    background: var(--bg-card, #1e293b);
    border-radius: 8px;
    overflow: auto;
}

.access-matrix table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

.access-matrix tr {
    background: transparent;
}

.access-matrix th,
.access-matrix td {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color, #334155);
    background: transparent;
}

.access-matrix th {
    background: rgba(0,0,0,0.2);
    font-weight: 500;
    font-size: 0.9rem;
}

.access-matrix th.material-col {
    text-align: left;
    min-width: 200px;
}

.access-matrix td.material-col {
    background: transparent !important;
}

.access-matrix .material-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
}

.access-matrix .lang-flag {
    font-size: 1.2rem;
}

.access-matrix .word-count {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
}

.access-matrix input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #22c55e;
}

/* Import section */
.import-section {
    background: var(--bg-card, #1e293b);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.import-section h3 {
    font-size: 1rem;
    margin: 0 0 1rem 0;
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.file-btn {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    background: #ea580c;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
}

.file-btn input {
    display: none;
}

.divider {
    text-align: center;
    color: var(--text-secondary, #94a3b8);
    margin: 1rem 0;
}

#importJson {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--bg-primary, #0f172a);
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f1f5f9);
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 1rem;
}

#importJson:focus {
    outline: none;
    border-color: var(--accent, #3b82f6);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--accent, #3b82f6);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
}

/* Import preview */
.import-preview {
    background: var(--bg-card, #1e293b);
    border-radius: 8px;
    padding: 1.5rem;
}

.import-preview h3 {
    font-size: 1rem;
    margin: 0 0 1rem 0;
}

.import-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.import-info-item {
    text-align: center;
    padding: 0.5rem;
    background: var(--bg-primary, #0f172a);
    border-radius: 4px;
}

.import-info-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
}

.import-info-item .value {
    font-size: 1.25rem;
    font-weight: 600;
}

.import-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.import-stat {
    text-align: center;
    padding: 1rem;
    background: var(--bg-primary, #0f172a);
    border-radius: 6px;
    border: 1px solid var(--border-color, #334155);
}

.import-stat .number {
    font-size: 1.5rem;
    font-weight: 700;
}

.import-stat .label {
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
}

.import-stat.new .number { color: #22c55e; }
.import-stat.redundant .number { color: #eab308; }
.import-stat.duplicate .number { color: #ef4444; }

.import-words-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.import-word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #334155);
}

.import-word-item .word {
    font-weight: 500;
}

.import-word-item .meaning {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
}

.import-word-item .status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.import-word-item .status.new {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.import-word-item .status.redundant {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.import-word-item .status.duplicate {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.import-options {
    margin-bottom: 1rem;
}

.import-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-success {
    width: 100%;
    padding: 1rem;
    background: #22c55e;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

.btn-success:hover {
    background: #16a34a;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary, #94a3b8);
}

/* Global stats */
.global-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card, #1e293b);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent, #3b82f6);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8);
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 600px) {
    .import-info-grid,
    .import-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .global-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===============================
   GLOBAL STATS
   =============================== */

/* Period Selector */
.period-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--bg-card, #1e293b);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.period-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: var(--bg-primary, #0f172a);
    color: var(--text-primary, #f1f5f9);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.period-btn:hover {
    background: var(--accent, #3b82f6);
    transform: translateY(-1px);
}

.period-btn.active {
    background: var(--accent, #3b82f6);
    font-weight: 600;
}

/* Stats Grid */
.gs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Cards */
.gs-card {
    background: var(--bg-card, #1e293b);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color, #334155);
}

.gs-card-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 16px;
    font-weight: 600;
}

/* Big Stat */
.gs-stat-big {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
}

.gs-stat-big.success { color: #22c55e; }
.gs-stat-big.warning { color: #eab308; }
.gs-stat-big.danger { color: #ef4444; }

.gs-stat-label {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Progress */
.gs-progress {
    height: 8px;
    background: var(--bg-primary, #0f172a);
    border-radius: 4px;
    margin-top: 12px;
    overflow: hidden;
}

.gs-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent, #3b82f6), #22c55e);
    transition: width 0.5s ease;
}

/* Stats List */
.gs-stat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

.gs-stat-row-label {
    color: var(--text-secondary, #94a3b8);
}

.gs-stat-row-value {
    font-weight: 600;
}

/* Mini Stats */
.gs-mini-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.gs-mini-stat {
    background: var(--bg-primary, #0f172a);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.gs-mini-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.gs-mini-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
    margin-top: 4px;
}

/* Material List */
.gs-material-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg-primary, #0f172a);
    border-radius: 10px;
    margin-bottom: 10px;
}

.gs-material-item:last-child {
    margin-bottom: 0;
}

.gs-material-badge {
    background: var(--accent, #3b82f6);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Word Items */
.gs-word-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--bg-primary, #0f172a);
    border-radius: 10px;
    margin-bottom: 8px;
    border-left: 3px solid transparent;
}

.gs-word-item.error {
    border-left-color: #ef4444;
}

.gs-word-item.practiced {
    border-left-color: var(--accent, #3b82f6);
}

.gs-word-item.mastered {
    border-left-color: #22c55e;
}

.gs-word-text {
    font-weight: 600;
}

.gs-word-meaning {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
}

.gs-word-stats {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg-card, #1e293b);
}

.gs-word-stats.error {
    color: #ef4444;
}

/* Charts */
.gs-daily-chart {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    height: 150px;
    padding: 10px 0;
}

.gs-daily-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gs-daily-bar-fill {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, var(--accent, #3b82f6), #6366f1);
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.gs-daily-bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
}

.gs-daily-bar-value {
    font-size: 0.7rem;
    color: var(--text-secondary, #94a3b8);
}

/* Hour Chart */
.gs-hour-chart {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 60px;
}

.gs-hour-bar {
    flex: 1;
    background: var(--bg-primary, #0f172a);
    border-radius: 2px;
    min-height: 4px;
}

.gs-hour-bar.active {
    background: var(--accent, #3b82f6);
}

.gs-hour-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.65rem;
    color: var(--text-secondary, #94a3b8);
}

/* Empty State */
.gs-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #94a3b8);
}

.gs-empty-state .emoji {
    font-size: 4rem;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .gs-grid {
        grid-template-columns: 1fr;
    }
    
    .gs-mini-stats {
        grid-template-columns: 1fr;
    }
    
    .gs-word-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .period-selector {
        justify-content: center;
    }
}
