/*
 * OTD — Main Stylesheet
 * Mobile-first, responsive, geen inline CSS in templates
 * Thema-kleuren via themes.css variabelen
 */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* ── Typography ── */
h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.2rem, 3vw, 1.75rem); font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }

/* ── Layout ── */
.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .main-content { padding: 2rem 1.5rem; }
}

/* ── Navbar ── */
.navbar {
    background-color: var(--color-nav-bg);
    border-bottom: 1px solid var(--color-nav-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--color-card-shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    text-decoration: none;
}

.nav-brand:hover { text-decoration: none; }

.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}

.nav-menu {
    display: none;
    position: fixed;
    top: 3.5rem;
    left: 0; right: 0;
    background: var(--color-nav-bg);
    border-bottom: 1px solid var(--color-nav-border);
    padding: 1rem;
    flex-direction: column;
    gap: .5rem;
}

.nav-menu.open { display: flex; }

.nav-links { display: flex; flex-direction: column; gap: .25rem; }
.nav-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    border-radius: .5rem;
    color: var(--color-nav-text);
    font-weight: 500;
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .nav-menu {
        display: flex !important;
        position: static;
        flex-direction: row;
        align-items: center;
        padding: 0;
        border: none;
        background: none;
        gap: 1rem;
    }
    .nav-links { flex-direction: row; gap: .25rem; }
    .nav-actions {
        padding-top: 0;
        border-top: none;
        margin-left: auto;
    }
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: .5rem;
    font-weight: 500;
    font-size: .9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color .15s, transform .1s;
}

.btn:active { transform: scale(.97); }
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}
.btn-primary:hover { background: var(--color-primary-hover); color: var(--color-text-inverse); }

.btn-ghost {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-2); }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-full { width: 100%; }
.btn-icon { padding: .5rem .75rem; font-size: 1.1rem; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-label { font-weight: 500; font-size: .9rem; color: var(--color-text); }
.form-input {
    padding: .6rem .85rem;
    border: 1px solid var(--color-border);
    border-radius: .5rem;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1rem;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-input-error { border-color: var(--color-danger); }
.form-error { color: var(--color-danger); font-size: .8rem; }
.form-hint { color: var(--color-text-muted); font-size: .8rem; }
.form-group-inline { flex-direction: row; align-items: center; }
.form-checkbox { display: flex; align-items: center; gap: .4rem; cursor: pointer; font-size: .9rem; }

.password-wrapper { position: relative; }
.password-toggle {
    position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1rem; padding: .25rem;
}

/* ── Cards ── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: .75rem;
    padding: 1.25rem;
    box-shadow: var(--color-card-shadow);
}

/* ── Auth ── */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 4rem);
    padding: 1rem;
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--color-card-shadow);
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo { font-size: 3rem; display: block; margin-bottom: .5rem; }
.auth-title { font-size: 1.75rem; }
.auth-subtitle { color: var(--color-text-muted); margin-top: .25rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; }
.auth-hint { color: var(--color-text-muted); font-size: .85rem; }

/* ── Flash messages ── */
.flash-container {
    max-width: 1200px;
    margin: .75rem auto 0;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-radius: .5rem;
    font-size: .9rem;
}

.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

[data-theme="dark"] .flash-success { background: #14532d; color: #86efac; border-color: #166534; }
[data-theme="dark"] .flash-danger  { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .flash-info    { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .flash-warning { background: #78350f; color: #fcd34d; border-color: #92400e; }

.flash-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.25rem; line-height: 1; opacity: .6; padding: 0 .25rem;
    color: inherit;
}
.flash-close:hover { opacity: 1; }

/* ── OTD pagina ── */
.otd-container { max-width: 1100px; }

.otd-header { margin-bottom: 2rem; }

.otd-date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.otd-date { text-align: center; }
.otd-date-display { font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 800; }
.otd-date-sub { color: var(--color-text-muted); }

.milestones-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
}

.milestone-badge {
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: .3rem .75rem;
    border-radius: 2rem;
    font-size: .8rem;
    font-weight: 600;
}

/* ── Year section ── */
.year-section { margin-bottom: 2.5rem; }

.year-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--color-border);
}

.year-title { font-size: 1.5rem; display: flex; align-items: center; gap: .5rem; }
.year-count { color: var(--color-text-muted); font-size: .9rem; }

.year-badge {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .2rem .5rem;
    border-radius: 2rem;
}
.year-badge-1  { background: #fef9c3; color: #854d0e; }
.year-badge-5  { background: #dbeafe; color: #1e40af; }
.year-badge-10 { background: #f3e8ff; color: #6b21a8; }

/* ── Photo grid ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

.photo-card {
    background: var(--color-surface);
    border-radius: .75rem;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--color-card-shadow);
    transition: box-shadow .2s, transform .2s;
}

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

.photo-card-link { display: block; }
.photo-card-image { position: relative; overflow: hidden; background: var(--color-surface-2); }
.photo-img { width: 100%; height: 100%; object-fit: cover; }

.photo-card-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.6));
    padding: .5rem;
    opacity: 0;
    transition: opacity .2s;
}
.photo-card:hover .photo-card-overlay { opacity: 1; }
.photo-filename { color: #fff; font-size: .75rem; word-break: break-all; }

.photo-card-meta {
    padding: .6rem .75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    font-size: .75rem;
    color: var(--color-text-muted);
}

.photo-meta-item { display: flex; align-items: center; gap: .2rem; }

.favorite-btn {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; padding: .1rem; margin-left: auto;
    line-height: 1; transition: transform .15s;
}
.favorite-btn:hover { transform: scale(1.2); }

/* ── OTD empty state ── */
.otd-empty {
    text-align: center;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.otd-empty-icon { font-size: 4rem; }

/* ── Error page ── */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    text-align: center;
    gap: 1rem;
}
.error-code { font-size: 6rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
.error-message { font-size: 1.1rem; color: var(--color-text-muted); }

/* ── Admin ── */
.admin-container { max-width: 1000px; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { margin-top: .25rem; }
.page-subtitle { color: var(--color-text-muted); margin-top: .5rem; }
.admin-section { margin-top: 2rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: .75rem;
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--color-card-shadow);
}
.stat-icon { font-size: 2rem; margin-bottom: .5rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { color: var(--color-text-muted); font-size: .85rem; }

/* ── Data table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.data-table th {
    text-align: left;
    padding: .6rem .75rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.data-table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--color-border);
}
.data-table tr:hover td { background: var(--color-surface-2); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 2rem;
    font-size: .75rem;
    font-weight: 600;
}
.badge-completed { background: #dcfce7; color: #166534; }
.badge-running   { background: #dbeafe; color: #1e40af; }
.badge-failed    { background: #fee2e2; color: #991b1b; }
.badge-pending   { background: var(--color-surface-2); color: var(--color-text-muted); }

[data-theme="dark"] .badge-completed { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-running   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-failed    { background: #7f1d1d; color: #fca5a5; }

/* ── Theme toggle ── */
.theme-toggle {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    padding: .3rem .6rem;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
}
.theme-icon-light, .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }
[data-theme="dark"]  .theme-icon-dark  { display: inline; }

/* ── Lang switcher ── */
.lang-switcher { display: flex; gap: .25rem; }
.lang-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: .35rem;
    padding: .2rem .4rem;
    font-size: .75rem;
    cursor: pointer;
    color: var(--color-text-muted);
    font-weight: 600;
}
.lang-btn.active, .lang-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ── Logout form ── */
.logout-form { display: inline; }

/* ── Import warning ── */
.import-warning {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fef08a;
    border-radius: .5rem;
    padding: .75rem;
    font-size: .85rem;
    margin-bottom: 1rem;
}
[data-theme="dark"] .import-warning { background: #78350f; color: #fcd34d; border-color: #92400e; }

/* ── Utilities ── */
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { color: var(--color-text-muted); font-style: italic; }

/* ── Footer ── */
.footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: .8rem;
}

/* ── Photo detail ── */
.photo-detail { max-width: 1100px; }
.photo-detail-back { margin-bottom: 1rem; }
.photo-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 768px) {
    .photo-detail-grid { grid-template-columns: 1fr 320px; }
}
.photo-detail-img { width: 100%; border-radius: .75rem; object-fit: contain; max-height: 80vh; }
.photo-detail-filename { font-size: 1.1rem; word-break: break-all; margin-bottom: 1rem; }
.meta-section { margin-bottom: 1.25rem; }
.meta-section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); margin-bottom: .4rem; }
.meta-exif { display: flex; flex-wrap: wrap; gap: .5rem; }
.meta-exif span { background: var(--color-surface-2); padding: .2rem .5rem; border-radius: .35rem; font-size: .85rem; font-family: monospace; }
.meta-muted { color: var(--color-text-muted); font-size: .9rem; }
.meta-link { font-size: .85rem; }

/* ── Keyword tags ── */
.keyword-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.keyword-tag {
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: .2rem .6rem;
    border-radius: 2rem;
    font-size: .8rem;
    font-weight: 500;
}

/* ── Calendar ── */
.year-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.5rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.cal-month { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: .75rem; padding: 1rem; }
.cal-month-name { font-size: .9rem; font-weight: 600; margin-bottom: .6rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em; }
.cal-days { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-day {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: .75rem;
    color: var(--color-text-muted);
    text-decoration: none;
    border: 1px solid var(--color-border);
    transition: background .15s;
}
.cal-day.has-photos { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.cal-day:hover { background: var(--color-primary-light); text-decoration: none; }
.cal-day-num { line-height: 1; }
.cal-legend { margin-top: 1rem; font-size: .8rem; color: var(--color-text-muted); display: flex; align-items: center; gap: .5rem; }

/* ── Empty days ── */
.empty-days-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.empty-month-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: .75rem; padding: 1rem; }
.empty-day-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: .5rem; }
.day-chip { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: .8rem; text-decoration: none; }
.day-chip-empty { background: var(--color-surface-2); color: var(--color-text-muted); border: 1px dashed var(--color-border); }
.day-chip-empty:hover { background: var(--color-primary-light); color: var(--color-primary); text-decoration: none; }

/* ── Random ── */
.random-photo { text-align: center; }
.random-date-badge { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
.random-photo-img { max-width: 600px; margin: 0 auto 1rem; border-radius: .75rem; }
.random-filename { color: var(--color-text-muted); font-size: .9rem; }
