:root {
    --primary: #007AFF;
    --primary-dark: #0056b3;
    --bg-color: #F2F2F7;
    --card-bg: #FFFFFF;
    --text-main: #000000;
    --text-secondary: #8E8E93;
    --border-color: #E5E5EA;
    --danger: #FF3B30;
    --success: #34C759;
    --orange: #FF9500;
    --purple: #5856D6;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius: 18px;
    --nav-height: 80px;
    --highlight-gradient: linear-gradient(135deg, #007AFF 0%, #00C6FF 100%);
    --input-bg: #F9F9F9;
}

[data-theme="dark"] {
    --primary: #0A84FF;
    --primary-dark: #409CFF;
    --bg-color: #000000;
    --card-bg: #1C1C1E;
    --text-main: #F5F5F7;
    --text-secondary: #AEAEB2;
    --border-color: #3A3A3C;
    --danger: #FF453A;
    --success: #30D158;
    --orange: #FF9F0A;
    --purple: #BF5AF2;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    --highlight-gradient: linear-gradient(135deg, #0A84FF 0%, #60ABFF 100%);
    --input-bg: #2C2C2E;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    padding-bottom: calc(var(--nav-height) + 20px);
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { font-family: 'Poppins', sans-serif; margin: 0; }
.hidden { display: none !important; }

/* LAYOUT */
.app-wrapper { padding: 20px; max-width: 600px; margin: 0 auto; }
.centered-screen { 
    height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; 
}

/* CARDS */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.auth-card { width: 100%; max-width: 350px; text-align: center; }
.highlight-card { 
    background: var(--highlight-gradient); 
    color: white; 
}
.highlight-card h3 { color: white; margin-bottom: 5px; }

/* HEADERS */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 10px 5px;
}
.main-header h2 { font-size: 26px; }
.main-header small { color: var(--text-secondary); font-size: 14px; }
.section-title { margin: 25px 0 10px 5px; }
.section-title h3 { font-size: 14px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px; }

/* LIST ITEMS */
.list-container { display: flex; flex-direction: column; gap: 10px; }

.list-item, .notif-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.notif-item { align-items: flex-start; flex-direction: row; }
.notif-item .content strong { display: block; margin-bottom: 4px; font-size: 15px; }
.notif-item .content p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }

.date-badge {
    background: var(--border-color);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    margin-right: 12px;
    min-width: 45px;
    text-align: center;
}

.item-info { display: flex; flex-direction: column; }
.item-title { font-weight: 600; font-size: 15px; }

.countdown {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 2px;
}

.countdown.vandaag { color: var(--danger); animation: pulse 2s infinite; }
.countdown.verlopen { color: var(--text-secondary); }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* SUBJECT GRID */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.subject-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.subject-card:active { transform: scale(0.96); }
.subject-icon {
    width: 50px; height: 50px;
    background: #EBF5FF;
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700;
    margin-bottom: 12px;
    transition: background 0.3s ease;
}
.abs-top-right { position: absolute; top: 5px; right: 5px; background: none; border: none; font-size: 18px; color: #ccc; }

/* PROJECT DETAILS */
.project-item {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
    transition: background 0.3s ease;
}
.project-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.deadline-tag { font-size: 12px; background: #FFE5E5; color: #D00; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.project-body { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.admin-actions { border-top: 1px solid var(--border-color); padding-top: 8px; margin-top: 8px; display: flex; gap: 15px; font-size: 13px; }
.admin-actions button { background: none; border: none; font-weight: 600; cursor: pointer; color: var(--primary); padding: 0; }
.admin-actions .text-red { color: var(--danger); }

/* FORMS & INPUTS */
input, select, textarea {
    width: 100%; padding: 14px; border: 1px solid var(--border-color); background: var(--input-bg); border-radius: 12px;
    font-size: 16px; font-family: 'Inter', sans-serif; margin-bottom: 12px; box-sizing: border-box; transition: all 0.2s;
    color: var(--text-main);
}
input:focus, textarea:focus { outline: none; background: var(--card-bg); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,122,255,0.1); }
label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: block; margin-left: 4px; }

/* BUTTONS */
.btn-primary {
    background: var(--primary); color: white; border: none; padding: 15px; border-radius: 12px;
    font-size: 16px; font-weight: 600; width: 100%; cursor: pointer; box-shadow: 0 4px 10px rgba(0,122,255,0.25);
    transition: background 0.2s ease;
}
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--border-color); color: var(--text-main); padding: 12px; border-radius: 10px; border:none; cursor: pointer; }
.btn-text { background: none; border: none; color: var(--primary); font-size: 15px; cursor: pointer; padding: 0; margin-bottom: 10px; }
.btn-mini { padding: 4px 10px; border-radius: 12px; font-size: 12px; border: none; cursor: pointer; }
.btn-green { background: #E6F9EA; color: var(--success); }

/* ADMIN STYLES */
.admin-section { margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px dashed var(--border-color); }
.admin-section h4 { margin-bottom: 10px; font-size: 14px; color: var(--text-main); }
.btn-action { width: 100%; border: none; color: white; padding: 12px; border-radius: 10px; font-weight: 600; margin-top: 5px; cursor: pointer; }
.green { background: var(--success); } .orange { background: var(--orange); } .purple { background: var(--purple); }
.spacer { height: 10px; }
.delete-btn { background: none; border: none; font-size: 16px; cursor: pointer; }

/* BOTTOM NAV */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color); display: flex; justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom); z-index: 100;
    transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .bottom-nav {
    background: rgba(28, 28, 30, 0.85);
}

.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #999; flex: 1; cursor: pointer; transition: 0.2s; }
.nav-item .icon { font-size: 24px; margin-bottom: 4px; transition: transform 0.2s; }
.nav-item span { font-size: 10px; font-weight: 500; }
.nav-item.active { color: var(--primary); }
.nav-item.active .icon { transform: translateY(-3px); }

/* HELPERS & ANIMATION */
.fade-in { animation: fadeIn 0.4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* THEME TOGGLE BUTTON */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.theme-toggle:hover {
    background: rgba(0,0,0,0.08);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255,255,255,0.12);
}

/* CIJFER GRAFIEK STYLING */
#chart-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    border: 1px solid var(--border-color);
}

.chart-large {
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--input-bg);
    border-radius: 10px;
    margin-bottom: 8px;
    border-left: 4px solid var(--primary);
}

.grade-info {
    flex: 1;
}

.grade-subject {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
}

.grade-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-right: 10px;
}

.grade-weight {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 10px;
}

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

.grade-edit-btn, .grade-delete-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
}

.grade-edit-btn { color: var(--primary); }
.grade-delete-btn { color: var(--danger); }

.grade-edit-btn:hover, .grade-delete-btn:hover {
    background: rgba(0,0,0,0.05);
}

[data-theme="dark"] .grade-edit-btn:hover,
[data-theme="dark"] .grade-delete-btn:hover {
    background: rgba(255,255,255,0.1);
}

.empty-chart {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-row .btn-primary,
.btn-row .btn-secondary {
    flex: 1;
}

.mt-2 { margin-top: 15px; }

.calc-result-box {
    margin-top: 15px;
    padding: 15px;
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

/* EMPTY STATES */
.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-style: italic;
}

/* FLASHCARDS STYLING */
.btn-learn {
    background: var(--success);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease;
}

.btn-learn:hover {
    background: #2db54d;
}

.flashcards-stats {
    display: flex;
    justify-content: space-around;
    background: var(--input-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

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

.flashcard-container {
    perspective: 1000px;
    margin-bottom: 20px;
    height: 250px;
}

.flashcard {
    width: 80%;
    height: 80%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

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

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    text-align: center;
}

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

.flashcard-front h3, .flashcard-back h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--text-main);
}

.hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 20px;
    font-style: italic;
}

.flashcard-feedback {
    margin-top: 20px;
    width: 100%;
}

.flashcard-feedback p {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.feedback-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn-feedback {
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.btn-feedback:active {
    transform: scale(0.95);
}

.btn-feedback.bad {
    background: #FFE5E5;
    color: #FF3B30;
}

.btn-feedback.okay {
    background: #FFF4E5;
    color: #FF9500;
}

.btn-feedback.good {
    background: #E5F9EB;
    color: #34C759;
}

.btn-feedback.excellent {
    background: #E5F0FF;
    color: #007AFF;
}

.flashcards-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.flashcards-controls button {
    flex: 1;
    padding: 12px;
}

.flashcards-progress {
    margin-bottom: 20px;
}

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

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

.progress-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.flashcards-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.flashcards-actions button {
    flex: 1;
    padding: 12px;
}

.all-cards-list {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-top: 20px;
}

.all-cards-list h4 {
    margin-bottom: 15px;
    color: var(--text-main);
}

.flashcard-item {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.flashcard-item-question {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-main);
}

.flashcard-item-answer {
    font-size: 14px;
    color: var(--text-secondary);
}

/* TEXT CENTER */
.text-center {
    text-align: center;
}

/* HELPER TEXT */
.helper-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.4;
}

/* CARD HEADER */
.card-header {
    margin-bottom: 15px;
}

.card-header h2 {
    font-size: 20px;
    color: var(--text-main);
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* NIEUWE FUNCTIONALITEITEN - AGENDA KOPPELING */
.btn-link {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-link:hover {
    background: var(--primary-dark);
}

[data-theme="dark"] .btn-link:hover {
    background: #409CFF;
}

/* Verbeterde list-item layout voor agenda items */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.list-item .item-info {
    flex: 1;
    min-width: 0;
}

.list-item .item-info small {
    display: block;
    margin-top: 4px;
    color: var(--primary);
    font-size: 12px;
}

/* Admin agenda sectie verbeteringen */
.admin-section .btn-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.admin-section select {
    margin-bottom: 12px;
    cursor: pointer;
}

/* Project item highlight voor gekoppelde agenda items */
.project-item.highlighted {
    background: rgba(0, 122, 255, 0.1);
    border-left: 4px solid var(--primary);
    animation: pulse-highlight 2s ease-in-out;
}

@keyframes pulse-highlight {
    0% { background-color: rgba(0, 122, 255, 0.1); }
    50% { background-color: rgba(0, 122, 255, 0.2); }
    100% { background-color: rgba(0, 122, 255, 0.1); }
}

/* Responsive aanpassingen */
@media (max-width: 480px) {
    .list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .list-item > div:last-child {
        align-self: flex-end;
    }
    
    .admin-section .btn-row {
        flex-direction: column;
    }
}