/* =====================================================
   ADMIN – Ergänzungen zu Tabler
   Nur Styles die Tabler NICHT abdeckt.
   ===================================================== */

/* ---------- Body ---------- */
body.admin {
    font-size: 0.8125rem;
    background: #f1f5f9;
}

.hidden {
    display: none !important;
}

a:hover {
    text-decoration: none;
}

/* ---------- Header ---------- */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #1e293b;
    color: #fff;
    border-bottom: 1px solid #334155;
}

.admin-header a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Layout: Sidebar + Content ---------- */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 49px);
}

/* ---------- Sidebar ---------- */
.admin-sidebar {
    position: sticky;
    top: 40px;
    height: calc(100vh - 49px);
    width: 210px;
    min-width: 210px;
    background: #1e293b;
    border-right: 1px solid #334155;
    overflow-y: auto;
    z-index: 90;
    padding: 0.75rem 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sidebar-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: #3b82f6;
}

/* ---------- Content ---------- */
.admin-content {
    flex: 1;
    min-width: 0;
    padding: 1.25rem;
    max-width: 960px;
}

/* ---------- Sektionen: ein/ausblenden ---------- */
.admin-section {
    display: none;
}

.admin-section.visible {
    display: block;
}

/* ---------- Sektion Statusanzeige ---------- */
.section-active {
    border-left: 4px solid var(--tblr-success) !important;
}

.section-inactive {
    border-left: 4px solid var(--tblr-danger) !important;
}

/* ---------- Admin-spezifische Formularzeilen ---------- */
.card {
    border-radius: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.form-row>label {
    font-weight: 500;
    margin: 0;
    font-size: 0.8125rem;
}

.form-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-field input,
.form-field select {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
}

.form-field input[type="checkbox"] {
    width: auto;
}

.form-block {
    margin-bottom: 1rem;
}

.form-block>label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
}

.form-row textarea {
    border: 1px solid #e5e7eb;
    border-radius: 8px !important;
    padding: 8px;
    width: 100%;
    min-height: 100px;
}

.form-block textarea {
    width: 100%;
    min-height: 100px;
    border: 1px solid #e5e7eb;
    border-radius: 8px !important;
    padding: 8px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.btn {
    border-radius: 8px;
    padding: 8px;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* ---------- Image Preview ---------- */
.image-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.image-preview img {
    object-fit: contain;
    max-width: 50%;
    border-radius: 6px;
    border: 1px solid var(--tblr-border-color, #e5e7eb);
    background: #fff;
}

/* ---------- Admin Preview (iframe) ---------- */
.admin-preview iframe {
    width: 100%;
    height: 700px;
    border: 1px solid var(--tblr-border-color, #e5e7eb);
    border-radius: 6px;
}

/* ---------- Repeater ---------- */
.repeater-item.card {
    margin-top: 1rem;
    margin-bottom: 1rem;
    background-color: #f8fafc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}

.sort-controls {
    display: flex;
    gap: 4px;
    margin-bottom: 0.5rem;
    padding: 1rem 1rem 0rem 1rem;
}

.sort-controls button {
    border: 1px solid var(--tblr-border-color, #ccc);
    background: #fff;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
}

.sort-controls button:hover {
    background: #f1f5f9;
}

/* ---------- Autosave Feedback ---------- */
.autosave-saving {
    outline: 2px solid #fbbf24;
}

.autosave-saved {
    outline: 2px solid #22c55e;
}

.autosave-error {
    outline: 2px solid #ef4444;
}

input[data-autosave].autosave-saving,
select[data-autosave].autosave-saving,
textarea[data-autosave].autosave-saving {
    border-color: #fbbf24 !important;
    background-color: #fffbeb !important;
}

input[data-autosave].autosave-saved,
select[data-autosave].autosave-saved,
textarea[data-autosave].autosave-saved {
    border-color: #10b981 !important;
    background-color: #ecfdf5 !important;
    transition: all 0.3s ease;
}

input[data-autosave].autosave-error,
select[data-autosave].autosave-error,
textarea[data-autosave].autosave-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* TinyMCE Autosave Feedback */
.tox-tinymce.autosave-saving {
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3) !important;
}

.tox-tinymce.autosave-saved {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

.tox-tinymce.autosave-error {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

.mce-content-body {
    font-size: 0.8125rem !important;
}

/* ---------- Bild-Upload Card (Shopify-Style) ---------- */
.media-card {
    border: 1px solid var(--tblr-border-color, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #fff;
}

.media-card-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #fafafa;
    min-height: 120px;
}

.media-card-preview img {
    max-height: 140px;
    max-width: 100%;
    object-fit: contain;
}

.media-card-preview.favicon img {
    max-height: 48px;
    image-rendering: pixelated;
}

.media-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--tblr-border-color, #e5e7eb);
}

.media-card-actions a,
.media-card-actions button,
.media-card-actions label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

.media-card-actions a:hover,
.media-card-actions button:hover,
.media-card-actions label:hover {
    background: #f3f4f6;
}

.media-card-actions> :first-child {
    border-right: 1px solid var(--tblr-border-color, #e5e7eb);
}

.media-card-actions .text-danger {
    color: var(--tblr-danger) !important;
}

.media-card-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Alt-Text / Bildrechte Panel in der media-card */
.media-card-meta {
    border-top: 1px solid #e5e7eb;
    margin-top: 0;
}

.media-card-meta summary {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background .15s;
}

.media-card-meta summary::-webkit-details-marker {
    display: none;
}

.media-card-meta summary:hover {
    background: #f9fafb;
    color: #374151;
}

.media-card-meta[open] summary {
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.media-card-meta-fields {
    padding: 0.75rem;
    background: #fafafa;
}

.media-card-meta-fields .form-label-sm {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.2rem;
}

.media-card-meta-fields .form-hint {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.15rem;
    display: block;
}



/* Upload-Placeholder (wenn kein Bild vorhanden) */
.media-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed var(--tblr-border-color, #d1d5db);
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    margin-bottom: 1rem;
    text-align: center;
}

.media-upload-placeholder:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.media-upload-placeholder i {
    font-size: 1.5rem;
    color: #9ca3af;
}

.media-upload-placeholder span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.media-upload-placeholder small {
    font-size: 0.75rem;
    color: #9ca3af;
}

.media-upload-placeholder input[type="file"] {
    display: none;
}

/* ---------- Farb-Swatches (Shopify-Style) ---------- */
.color-swatch-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--tblr-border-color, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.color-swatch-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--tblr-border-color, #e5e7eb);
}

.color-swatch-item:last-child {
    border-bottom: none;
}

.color-swatch-preview {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
}

.color-swatch-preview input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0;
}

.color-swatch-info {
    flex: 1;
    min-width: 0;
}

.color-swatch-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #111827;
}

.color-swatch-hex {
    font-size: 0.75rem;
    color: #6b7280;
    font-family: monospace;
}


.footer {
    margin-top: 0px;
    background-color: #1e293b;
    color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        position: sticky;
        top: 40px;
        width: 100%;
        min-width: unset;
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid #334155;
    }

    .sidebar-nav {
        flex-direction: row;
        padding: 0.5rem;
    }

    .sidebar-link {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .sidebar-link.active {
        border-bottom-color: #3b82f6;
        border-left-color: transparent;
    }

    .admin-content {
        padding: 0.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Superadmin-Link in Sidebar */
.sidebar-link-superadmin {
    color: #dc2626 !important;
    font-weight: 600;
}

.sidebar-link-superadmin:hover {
    background: #fef2f2;
    color: #b91c1c !important;
}

.sidebar-link-agency {
    color: #0369a1 !important;
    font-weight: 600;
}

.sidebar-link-agency:hover {
    background: #f0f9ff;
    color: #075985 !important;
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar Progress Widget
   ═══════════════════════════════════════════════════════════════ */

.sidebar-progress {
    padding: 1rem 0.875rem 0.75rem;
    border-bottom: 1px solid #334155;
    margin-bottom: 0.25rem;
}

.sidebar-progress__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.progress-ring {
    flex-shrink: 0;
}

.progress-ring__arc {
    transition: stroke-dasharray 0.6s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-progress__meta {
    flex: 1;
    min-width: 0;
}

.sidebar-progress__emoji {
    font-size: 1.1rem;
    line-height: 1;
    margin-bottom: 0.1rem;
}

.sidebar-progress__title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
}

.sidebar-progress__sub {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.15rem;
    line-height: 1.3;
}

/* ── Offene Punkte ── */
.sidebar-progress__todo {
    margin-bottom: 0.5rem;
}

.progress-todo-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.3rem;
    padding-left: 0.1rem;
}

.progress-todo-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    border-radius: 5px;
    color: #f59e0b;
    font-size: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s;
    line-height: 1.2;
}

.progress-todo-item:hover {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.progress-todo-item i {
    font-size: 0.8rem;
    flex-shrink: 0;
    opacity: 0.8;
}

/* ── Fertig-Meldung ── */
.sidebar-progress__complete {
    font-size: 0.8rem;
    color: #22c55e;
    font-weight: 600;
    padding: 0.25rem 0.1rem 0.5rem;
}

/* ── Alle Punkte (Details/Summary) ── */
.sidebar-progress__all {
    margin-top: 0.5rem;
}

.sidebar-progress__all>summary {
    font-size: 0.7rem;
    color: #64748b;
    cursor: pointer;
    list-style: none;
    padding: 0.2rem 0.1rem;
    user-select: none;
    transition: color 0.12s;
}

.sidebar-progress__all>summary::-webkit-details-marker {
    display: none;
}

.sidebar-progress__all>summary::before {
    content: '▸ ';
}

.sidebar-progress__all[open]>summary::before {
    content: '▾ ';
}

.sidebar-progress__all>summary:hover {
    color: #94a3b8;
}

.progress-checklist {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.progress-check-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    padding: 0.15rem 0.1rem;
    line-height: 1.3;
}

.progress-check-item i {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.progress-check-item.is-done {
    color: #4ade80;
    opacity: 0.7;
}

.progress-check-item.is-todo {
    color: #64748b;
}

.progress-ring--pulse {
    animation: progress-pulse 0.6s ease;
}

@keyframes progress-pulse {
    0% {
        filter: drop-shadow(0 0 0px rgba(59, 130, 246, 0));
    }

    40% {
        filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.8));
    }

    100% {
        filter: drop-shadow(0 0 0px rgba(59, 130, 246, 0));
    }
}