/* ============================================================
   TCM Admin – Backend-Stylesheet
   ============================================================ */

:root {
    --tcm-blue:       #1D4E9B;
    --tcm-blue-dark:  #163b78;
    --tcm-red:        #E63946;
    --tcm-yellow:     #F5A623;
    --tcm-dark:       #0D1B2A;
    --tcm-gray:       #6B7280;
    --tcm-light:      #F5F6FA;
    --tcm-border:     #E2E8F0;
    --sidebar-w:      240px;
    --topbar-h:       56px;
    --font:           'Space Grotesk', system-ui, sans-serif;
    --radius:         0.5rem;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('/assets/fonts/SpaceGrotesk-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font); background: var(--tcm-light); color: var(--tcm-dark); margin: 0; }
a { text-decoration: none; }
img { max-width: 100%; }

/* ---------- Topbar ---------- */
.admin-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--tcm-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.admin-brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; font-weight: 700; font-size: 1rem; }
.admin-brand:hover { color: #fff; }

.sidebar-toggle { background: none; border: none; color: #fff; cursor: pointer; padding: 0.25rem; }

.admin-toplink {
    display: inline-flex; align-items: center; gap: 0.35rem;
    color: rgba(255,255,255,0.8); font-size: 0.85rem; font-weight: 600;
    padding: 0.35rem 0.75rem; border-radius: var(--radius);
    transition: background 0.2s, color 0.2s;
}
.admin-toplink:hover { background: rgba(255,255,255,0.12); color: #fff; }
.admin-toplink-danger:hover { background: var(--tcm-red); color: #fff; }

/* ---------- Layout ---------- */
.admin-layout {
    display: flex;
    padding-top: var(--topbar-h);
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.admin-sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--tcm-border);
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    padding: 1.25rem 0;
    display: flex;
    flex-direction: column;
    z-index: 900;
    transition: transform 0.25s ease;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--tcm-gray);
    padding: 0 1.25rem 0.5rem;
}

.sidebar-nav { display: flex; flex-direction: column; }

.sidebar-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--tcm-dark); font-size: 0.9rem; font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-link:hover { background: var(--tcm-light); color: var(--tcm-blue); }
.sidebar-link.active {
    background: rgba(29,78,155,0.08);
    color: var(--tcm-blue);
    font-weight: 700;
    border-left-color: var(--tcm-blue);
}
.sidebar-link svg { flex-shrink: 0; }

.sidebar-user {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--tcm-border);
    display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--tcm-blue); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.85rem; font-weight: 700; }
.sidebar-user-role { font-size: 0.75rem; color: var(--tcm-gray); text-transform: capitalize; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 850;
}

/* ---------- Hauptinhalt ---------- */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}

.admin-content { padding: 2rem; max-width: 1100px; }

/* ---------- Seitenkopf ---------- */
.admin-page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
    margin-bottom: 1.75rem;
}
.admin-page-title { font-size: 1.5rem; font-weight: 800; margin: 0; }
.admin-breadcrumb { font-size: 0.8rem; color: var(--tcm-gray); margin-top: 0.2rem; }
.admin-breadcrumb a { color: var(--tcm-blue); }

/* ---------- Dashboard-Karte ---------- */
.stat-card {
    background: #fff; border: 1px solid var(--tcm-border);
    border-radius: var(--radius); padding: 1.5rem;
    display: flex; align-items: flex-start; gap: 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
    text-decoration: none; color: inherit;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(29,78,155,0.12); transform: translateY(-2px); color: inherit; }
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon-blue   { background: rgba(29,78,155,0.12); color: var(--tcm-blue); }
.stat-icon-red    { background: rgba(230,57,70,0.12);  color: var(--tcm-red); }
.stat-icon-yellow { background: rgba(245,166,35,0.12); color: #c47f00; }
.stat-icon-green  { background: rgba(16,185,129,0.12); color: #059669; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.2rem; }
.stat-label { font-size: 0.85rem; color: var(--tcm-gray); }

/* ---------- Tabellen ---------- */
.admin-table {
    background: #fff; border: 1px solid var(--tcm-border);
    border-radius: var(--radius); overflow: hidden;
}
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th {
    background: var(--tcm-light); font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--tcm-gray);
    padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--tcm-border);
}
.admin-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--tcm-border); font-size: 0.9rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--tcm-light); }

/* ---------- Formulare ---------- */
.admin-card {
    background: #fff; border: 1px solid var(--tcm-border);
    border-radius: var(--radius); padding: 1.75rem;
    margin-bottom: 1.5rem;
}
.admin-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--tcm-border); }

.form-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--tcm-dark); }
.form-control, .form-select {
    border: 1px solid var(--tcm-border); border-radius: var(--radius);
    padding: 0.6rem 0.85rem; font-family: var(--font); font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--tcm-blue);
    box-shadow: 0 0 0 3px rgba(29,78,155,0.12);
}
textarea.form-control { min-height: 120px; resize: vertical; }

/* ---------- Buttons ---------- */
.btn-admin {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1.1rem; border-radius: var(--radius);
    font-family: var(--font); font-size: 0.875rem; font-weight: 700;
    border: none; cursor: pointer; transition: background 0.2s, transform 0.15s;
    text-decoration: none;
}
.btn-admin:hover { transform: translateY(-1px); }
.btn-primary-admin   { background: var(--tcm-blue); color: #fff; }
.btn-primary-admin:hover   { background: var(--tcm-blue-dark); color: #fff; }
.btn-danger-admin    { background: var(--tcm-red); color: #fff; }
.btn-danger-admin:hover    { background: #c0303b; color: #fff; }
.btn-secondary-admin { background: var(--tcm-light); color: var(--tcm-dark); border: 1px solid var(--tcm-border); }
.btn-secondary-admin:hover { background: var(--tcm-border); color: var(--tcm-dark); }
.btn-success-admin   { background: #10b981; color: #fff; }
.btn-success-admin:hover   { background: #059669; color: #fff; }

/* ---------- Status-Badge ---------- */
.status-badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.6rem;
    border-radius: 2rem;
}
.status-published { background: #d1fae5; color: #065f46; }
.status-draft      { background: #fef3c7; color: #92400e; }
.status-active    { background: #dbeafe; color: #1e40af; }
.status-archived  { background: #f3f4f6; color: #6b7280; }

/* ---------- Alert ---------- */
.admin-alert {
    padding: 0.85rem 1.1rem; border-radius: var(--radius);
    font-size: 0.9rem; margin-bottom: 1.25rem;
    display: flex; align-items: flex-start; gap: 0.5rem;
}
.admin-alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.admin-alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--tcm-red); }

/* ---------- Thumbnail ---------- */
.admin-thumb { width: 60px; height: 45px; object-fit: cover; border-radius: 4px; background: var(--tcm-light); }

/* ---------- Aktions-Buttons ---------- */
.action-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.65rem;
    border-radius: 4px; transition: background 0.15s, color 0.15s;
    text-decoration: none; cursor: pointer; border: none; background: none;
}
.action-edit   { color: var(--tcm-blue); background: rgba(29,78,155,0.08); }
.action-edit:hover   { background: var(--tcm-blue); color: #fff; }
.action-delete { color: var(--tcm-red); background: rgba(230,57,70,0.08); }
.action-delete:hover { background: var(--tcm-red); color: #fff; }

/* ---------- Textarea Editor-Hint ---------- */
.editor-hint { font-size: 0.75rem; color: var(--tcm-gray); margin-top: 0.35rem; }

/* ---------- Bild-Vorschau ---------- */
.img-preview-wrap { margin-top: 0.75rem; }
.img-preview {
    max-width: 200px; max-height: 150px; object-fit: cover;
    border-radius: var(--radius); border: 2px solid var(--tcm-border);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .admin-main { margin-left: 0; }
    .admin-content { padding: 1.25rem; }
}
