/* =============================
   TTC Figurenchecker – Stylesheet
   ============================= */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* --- Layout --- */
.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding: 2rem 1rem; }
.container { max-width: 960px; margin: 0 auto; }

/* --- Header --- */
.site-header {
    background-color: #1e3a8a;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 4px solid #cbd5e1;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    max-width: 960px;
    margin: 0 auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    width: 64px;
    height: 64px;
    background-color: white;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    padding: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo img { width: 100%; height: 100%; object-fit: contain; }

.header-logo-fallback {
    color: #1e3a8a;
    font-size: 1.5rem;
    font-weight: 900;
}

.header-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.header-subtitle { font-size: 0.75rem; color: #bfdbfe; opacity: 0.9; margin-top: 1px; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-nav a {
    color: #bfdbfe;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.header-nav a:hover { color: white; }
.header-nav a.active { color: white; font-weight: 700; border-bottom-color: white; }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
}

.mobile-nav {
    display: none;
    background-color: #1e40af;
}

.mobile-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-nav a:last-child { border-bottom: none; }

@media (max-width: 768px) {
    .header-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .header-title { font-size: 1rem; }
    .header-logo { width: 50px; height: 50px; }
}

/* --- Footer --- */
.site-footer {
    background-color: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.875rem;
    margin-top: auto;
}

/* --- Cards --- */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.card-header {
    background-color: #f8fafc;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary { background-color: #3b82f6; color: white; }
.btn-primary:hover:not(:disabled) { background-color: #2563eb; }
.btn-success { background-color: #16a34a; color: white; }
.btn-success:hover:not(:disabled) { background-color: #15803d; }
.btn-danger { background-color: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background-color: #b91c1c; }
.btn-secondary { background-color: #475569; color: white; }
.btn-secondary:hover:not(:disabled) { background-color: #334155; }
.btn-outline { background-color: white; color: #475569; border: 1px solid #cbd5e1; }
.btn-outline:hover:not(:disabled) { background-color: #f8fafc; border-color: #94a3b8; }
.btn-ghost { background-color: transparent; color: #475569; border: none; }
.btn-ghost:hover:not(:disabled) { background-color: #f1f5f9; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-label { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background-color: white;
    color: #1e293b;
}
.form-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

/* --- Tabs (Tanzstil-Filter) --- */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-btn {
    padding: 0.45rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.tab-btn:hover { background-color: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.tab-btn.active { background-color: #3b82f6; color: white; border-color: #3b82f6; box-shadow: 0 2px 4px rgba(59,130,246,0.3); }

/* --- Progress --- */
.progress-box {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #3b82f6;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.progress-label { font-size: 0.875rem; color: #475569; font-weight: 500; }
.progress-pct { font-size: 1.25rem; font-weight: 700; color: #16a34a; }
.progress-sub { font-size: 0.8rem; color: #94a3b8; }

.progress-track {
    background-color: #e2e8f0;
    border-radius: 9999px;
    height: 10px;
    overflow: hidden;
    margin-top: 0.4rem;
}

.progress-fill {
    background-color: #16a34a;
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
    min-width: 0;
}

/* --- Figure Items --- */
.section-heading {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-todo { background-color: #94a3b8; }
.dot-done { background-color: #16a34a; }
.heading-todo { color: #475569; }
.heading-done { color: #16a34a; }

.figure-list { display: flex; flex-direction: column; gap: 0.4rem; }

.figure-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: white;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s, background-color 0.15s;
    user-select: none;
}

.figure-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); border-color: #93c5fd; }
.figure-item.is-done { background-color: #f0fdf4; border-color: #bbf7d0; }
.figure-item.is-done:hover { border-color: #86efac; }

.figure-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    color: white;
    font-size: 13px;
}

.figure-item.is-done .figure-checkbox { background-color: #16a34a; border-color: #16a34a; }

.figure-name { font-size: 0.95rem; color: #1e293b; flex: 1; }
.figure-item.is-done .figure-name { color: #16a34a; }

/* --- Figures sections 2-column layout on desktop --- */
@media (min-width: 768px) {
    .figures-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: start;
    }
}

/* --- Action Bar --- */
.action-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

/* --- Notification Toast --- */
.notification {
    position: fixed;
    top: 85px;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: slideIn 0.2s ease;
    max-width: 320px;
}

.notification.success { background-color: #16a34a; }
.notification.error { background-color: #dc2626; }

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Admin Interface --- */
.admin-section { margin-bottom: 2rem; }
.admin-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
}

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    gap: 0.5rem;
    transition: background-color 0.15s;
}

.admin-row:hover { background-color: #f8fafc; }
.admin-row + .admin-row { margin-top: 0.4rem; }

.admin-actions {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex-shrink: 0;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
    color: #94a3b8;
    font-size: 1rem;
    line-height: 1;
}

.icon-btn:hover { background-color: #f1f5f9; }
.icon-btn:hover.edit { color: #3b82f6; }
.icon-btn:hover.delete { color: #dc2626; }
.icon-btn:hover.move { color: #475569; }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.inline-edit-form { display: flex; gap: 0.5rem; align-items: center; flex: 1; min-width: 0; }
.inline-edit-form .form-input { flex: 1; min-width: 0; }

.add-form {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.add-form-row { display: flex; gap: 0.75rem; align-items: flex-end; }

/* --- Login Box --- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-icon {
    width: 64px;
    height: 64px;
    background-color: #f1f5f9;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
    display: block;
}

.empty-state p { font-size: 1rem; }

/* --- Style selector for admin figure management --- */
.style-select-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.style-select-btn {
    padding: 0.35rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.825rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background-color: white;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.style-select-btn:hover { background-color: #f1f5f9; border-color: #94a3b8; }
.style-select-btn.active { background-color: #1e3a8a; color: white; border-color: #1e3a8a; }

/* --- Spacing helpers --- */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: #64748b; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* --- Spinner --- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* --- Drucken / PDF-Export ---
 * Klassen gelten immer (nicht nur @media print), damit html2canvas
 * sie sieht, wenn #print-section temporär sichtbar gemacht wird.
 * @media print übernimmt nur noch die Show/Hide-Logik.
 */
#print-section {
    display: none;
    width: 180mm;
    background: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11pt;
    color: #1e293b;
    padding: 15mm;
    box-sizing: border-box;
}

#print-section .ph {
    display: flex;
    align-items: center;
    gap: 12pt;
    border-bottom: 2pt solid #1e3a8a;
    padding-bottom: 8pt;
    margin-bottom: 16pt;
}
#print-section .ph img { width: 52pt; height: 52pt; object-fit: contain; flex-shrink: 0; }
#print-section .pt { font-size: 17pt; font-weight: bold; color: #1e3a8a; }
#print-section .ps { font-size: 13pt; color: #475569; margin-top: 3pt; }
#print-section .pm { font-size: 9pt;  color: #94a3b8;  margin-top: 3pt; }

#print-section .pst {
    font-size: 11pt;
    font-weight: bold;
    padding-bottom: 3pt;
    margin: 16pt 0 8pt;
    border-bottom: 1pt solid currentColor;
}
#print-section .pst.done { color: #16a34a; }
#print-section .pst.todo { color: #64748b; }

#print-section .pi {
    padding: 3pt 0;
    border-bottom: 0.5pt solid #f1f5f9;
    font-size: 11pt;
}
#print-section .pi.done { color: #16a34a; }
#print-section .pi.todo { color: #1e293b; }

#print-section .pf {
    margin-top: 24pt;
    font-size: 8pt;
    color: #cbd5e1;
    text-align: center;
    border-top: 0.5pt solid #f1f5f9;
    padding-top: 6pt;
}

@media print {
    /*
     * visibility:hidden statt display:none, damit #print-section
     * als Kind-Element visibility:visible überschreiben kann.
     */
    body * { visibility: hidden; }

    #print-section,
    #print-section * { visibility: visible; }

    #print-section {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 15mm;
    }

    @page { margin: 0; size: A4 portrait; }
}
