/* --- BASIS --- */
body { 
    margin: 0; font-family: 'Inter', -apple-system, sans-serif; 
    background-color: var(--adm-bg); color: #333; line-height: 1.5;
}

.admin-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- NAVIGATION --- */
.admin-nav { background: var(--adm-primary); color: white; padding: 10px 0; margin-bottom: 30px; }
.nav-flex { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { font-weight: 800; text-decoration: none; color: white; font-size: 1.2rem; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.95rem; padding: 8px 12px; border-radius: 6px; }
.nav-links a:hover, .nav-links a.active { color: white; background: rgba(255,255,255,0.1); }
.btn-logout { background: #e74c3c; color: white; padding: 6px 12px; border-radius: 4px; text-decoration: none; font-size: 0.85rem; margin-left: 15px; }

/* --- CARDS & UI --- */
.card { background: white; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); padding: 25px; margin-bottom: 25px; border: 1px solid #edf2f7; }

/* WICHTIG: 'overflow: hidden' entfernt, damit Sticky Table Header funktioniert! */
.no-padding { padding: 0; } 

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; }
.page-header h1 { margin: 0; font-size: 1.75rem; color: #1a202c; }

/* --- TABELLEN --- */
.table { width: 100%; border-collapse: collapse; }

/* STICKY HEADER FIX */
.table thead th { 
    position: sticky; 
    top: 60px; /* Klebt unter der Toolbar */
    z-index: 900; /* Unter der Toolbar (1001), aber über dem Inhalt */
    background: #f8fafc; 
    padding: 12px 20px; 
    text-align: left; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    color: #64748b; 
    border-bottom: 2px solid #cbd5e0; 
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);
}

.table td { padding: 15px 20px; border-bottom: 1px solid #edf2f7; vertical-align: middle; }
.table tr:hover { background: #fdfdfd; }

/* --- BUTTONS --- */
.btn { border-radius: 6px; padding: 10px 20px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; display: inline-block; text-decoration: none; text-align: center; }
.btn-primary { background: var(--adm-btn); color: white; }
.btn-success { background: #27ae60; color: white; }
.btn-danger { background: #e74c3c; color: white; }
.btn-secondary { background: #cbd5e0; color: #4a5568; }
.btn-small { padding: 5px 10px; font-size: 0.85rem; }

/* --- BADGES --- */
.badge { padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: bold; }
.badge-active { background: #def7ec; color: #03543f; }
.badge-inactive { background: #fde8e8; color: #9b1c1c; }

/* --- FORMULARE --- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; }
.form-control { width: 100%; padding: 10px; border: 1px solid #e2e8f0; border-radius: 6px; box-sizing: border-box; font-size: 1rem; }
.form-control:focus { outline: none; border-color: var(--adm-btn); box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15); }

/* --- EDITOR ELEMENTE --- */
.drag-handle { cursor: grab; color: #cbd5e0; font-size: 1.2rem; user-select: none; transition: color 0.2s; }
.drag-handle:hover { color: var(--adm-btn); }
.drag-handle:active { cursor: grabbing; }

.row-comment { background-color: #f3f0ff !important; }
.row-comment td { border-bottom: 1px solid #d6bcfa; }
.row-comment .badge { background: #6f42c1; color: white; }

.input-inline { width: 100%; border: 1px solid transparent; background: transparent; padding: 5px; border-radius: 4px; transition: all 0.2s; }
.input-inline:hover { border-color: #e2e8f0; background: white; }
.input-inline:focus { border-color: var(--adm-btn); background: white; outline: none; }

/* --- AKKORDEON STYLES --- */
#email_accordion_trigger {
    background: #f8fafc;
    transition: background-color 0.2s ease;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
}
#email_accordion_trigger:hover { background: #edf2f7 !important; }

#email_accordion_content {
    display: none; /* Basis-Zustand */
    background: #ffffff;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top: 1px solid #edf2f7;
}

/* Falls wir Klassen nutzen wollen (optional für Zukunft) */
#email_accordion_content.open { display: block; }

#email_accordion_icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-family: monospace;
    font-weight: bold;
    color: var(--adm-text-muted);
}

@media (max-width: 860px) {
    body {
        font-size: 15px;
    }

    .admin-container {
        padding: 0 12px;
    }

    .admin-nav {
        padding: 10px 0;
        margin-bottom: 18px;
    }

    .nav-flex {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .nav-brand {
        display: flex;
        align-items: center;
        min-height: 36px;
    }

    .nav-links {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links a {
        flex: 0 0 auto;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .nav-user {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .btn-logout {
        margin-left: 0;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 18px;
    }

    .page-header > * {
        width: 100%;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 8px;
    }

    .no-padding {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 680px;
    }

    .table thead th {
        position: static;
        padding: 10px 12px;
    }

    .table td {
        padding: 12px;
    }

    .btn,
    .btn-action {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-small {
        min-height: 36px;
        padding: 7px 11px;
    }

    .form-control,
    .input-inline,
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .sticky-actions {
        position: static !important;
        padding: 8px 0 !important;
    }

    .toolbar-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
        padding: 0 12px !important;
    }

    .toolbar-flex > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .legend-bar {
        gap: 8px !important;
        padding: 10px 12px !important;
    }

    #email_accordion_content .grid-2,
    .grid-2 {
        display: block !important;
    }

    #email_accordion_content {
        padding: 16px !important;
    }

    #email_accordion_content [style*="border-left"] {
        border-left: 0 !important;
        padding-left: 0 !important;
        margin-top: 22px;
    }
}

@media (max-width: 520px) {
    .admin-container {
        padding: 0 8px;
    }

    .card {
        padding: 12px;
    }

    .nav-user {
        align-items: stretch;
        flex-direction: column;
    }

    .btn,
    button,
    .btn-action {
        width: 100%;
    }

    .page-header a.btn,
    .page-header button.btn {
        width: 100%;
    }
}