@font-face {
    font-family: 'Source Sans 3';
    src: url('../fonts/SourceSans3-Regular.woff2') format('woff2'),
         url('../fonts/SourceSans3-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Source Sans 3';
    src: url('../fonts/SourceSans3-It.woff2') format('woff2'),
         url('../fonts/SourceSans3-It.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Source Sans 3';
    src: url('../fonts/SourceSans3-Semibold.woff2') format('woff2'),
         url('../fonts/SourceSans3-Semibold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Source Sans 3';
    src: url('../fonts/SourceSans3-Bold.woff2') format('woff2'),
         url('../fonts/SourceSans3-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Hausfarben der Schule */
    --color-primary: #9CCE2B;    /* Grün */
    --color-secondary: #3b3b3b;  /* Grau */
    
    /* Akzentfarben */
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    
    /* Neutrale Farben */
    --bg-body: #f4f4f4;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #636e72;
    --border-color: #dfe6e9;
    
    /* Design-Details */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --transition: all 0.2s ease-in-out;
}

body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

/* Header & Navigation */
.main-header {
    background-color: var(--color-secondary);
    color: white;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    border-bottom: 4px solid var(--color-primary);
}

.main-header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.main-header h1 a {
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link.active {
    color: var(--color-primary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card-title {
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.25rem;
}

/* Buttons */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    background-color: #8bb926;
    box-shadow: 0 4px 8px rgba(156, 206, 43, 0.3);
}

.btn-secondary {
    background-color: #636e72;
    color: white;
}

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

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Tables */
.table-container {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    /* overflow-x: auto (not "hidden") so a table wider than the viewport
       scrolls horizontally on narrow screens instead of clipping columns;
       overflow-y stays hidden so the header's background still respects
       the container's rounded corners. */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

table.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th {
    background-color: #f8f9fa;
    color: var(--color-secondary);
    text-align: left;
    padding: 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f1f1;
    font-size: 0.95rem;
}

.modern-table tr:hover td {
    background-color: #fafafa;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

/* Two-column field-pair layout (e.g. Datum/Terminart, Passwort/E-Mail) used
   across the admin and booking forms — collapses to one column on narrow
   screens instead of squeezing two ~150px-wide fields side by side. */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--color-secondary);
    font-size: 0.9rem;
}

.form-control-modern {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid #ced4da;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(156, 206, 43, 0.15);
}

/* Alerts */
.alert-container {
    margin-bottom: 1.5rem;
}

.alert-modern {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #ebfbee;
    color: #2b8a3e;
    border: 1px solid #b2f2bb;
}

.alert-danger {
    background-color: #fff5f5;
    color: #c92a2a;
    border: 1px solid #ffc9c9;
}

.alert-warning {
    background-color: #fff9db;
    color: #e67700;
    border: 1px solid #ffe066;
}

.alert-info {
    background-color: #e7f5ff;
    color: #1971c2;
    border: 1px solid #a5d8ff;
}

/* Badges */
.badge-modern {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #d3f9d8; color: #2b8a3e; }
.badge-info { background: #e3fafc; color: #0c8599; }

/* Login Page */
.login-card {
    max-width: 450px;
    margin: 4rem auto;
    padding: 3rem;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--color-secondary);
}

.login-card .btn-modern {
    width: 100%;
    margin-top: 1rem;
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-bar {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.filter-form {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Public Index Styles */
.public-hero {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    text-align: center;
}

.public-hero h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.search-box-modern {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-top: -3rem;
    position: relative;
    z-index: 10;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-color);
}

.termin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    row-gap: 0.75rem;
    column-gap: 1.5rem;
    margin-top: 3rem;
}

.termin-card {
    display: flex;
    flex-direction: column;
}

.termin-card .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.termin-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.termin-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.termin-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
    .nav-link {
        margin: 0 0.75rem;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    /* Slightly larger tap targets on touch-sized screens, closer to the
       ~44px minimum, without changing the desktop button size. */
    .btn-modern {
        padding: 0.75rem 1.2rem;
    }
    .card {
        padding: 1.25rem;
    }
}

/* Explicit paragraph spacing for admin-authored rich-text content (Impressum),
   matching the same value the Quill editor is given (see the ".ql-editor p"
   override in admin_site_settings_form.html's extra_head block) -- Quill's
   own CSS zeroes paragraph margins inside the editor, so without a matching
   override here, pressing Enter looked like a tight line break while editing
   but produced a full blank-line gap on the actual /impressum page. */
.card-body-modern p {
    margin: 0 0 1em 0;
}
.card-body-modern p:last-child {
    margin-bottom: 0;
}

/* The Quill editor (.ql-editor in quill.snow.css) sets word-wrap: break-word,
   so a long unbroken token (URL, e-mail address) wraps fine while editing.
   Nothing on the actual /impressum and /datenschutz pages carried the same
   rule, so that same token overflowed the container there instead of
   wrapping -- looked like "the editor doesn't wrap" but was really a CSS gap
   on the public-facing side. */
.card-body-modern {
    overflow-wrap: anywhere;
}
