/* =========================================
   Grundlayout / Typography
   ========================================= */
body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* Haupt-Container für Admin-Seiten */
.admin-main {
    max-width: 1200px;
    margin: 2.4rem auto 3rem;
    padding: 0 1rem;
}

/* =========================================
   Header
   ========================================= */
.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.admin-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* =========================================
   Buttons
   ========================================= */
.btn-primary,
.btn-secondary,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    font-size: 0.86rem;
    text-decoration: none;
    line-height: 1.2;
    font-weight: 500;
    white-space: nowrap;
}

.btn-primary {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-secondary {
    background: #ffffff;
    border-color: #d1d5db;
    color: #111827;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: #2563eb;
    padding-left: 0;
    padding-right: 0;
}

/* =========================================
   Alerts
   ========================================= */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

/* =========================================
   Formulare
   ========================================= */
.form-group {
    margin-bottom: 1rem;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="text"],
input[type="file"],
input[type="url"],
input[type="month"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 0.9rem;
    box-sizing: border-box;
    background: #ffffff;
}

textarea {
    min-height: 120px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.hint {
    font-size: 0.8rem;
    color: #6b7280;
}

/* =========================================
   Tabellen
   ========================================= */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.admin-table th,
.admin-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid #e5e7eb;
}

.admin-table th {
    background: #f9fafb;
    text-align: left;
    font-weight: 500;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4b5563;
}

.admin-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.admin-table tbody tr:hover {
    background: #eff6ff;
}

/* Muted Text / Meta im Table */
.admin-table-muted {
    font-size: 0.8rem;
    color: #9ca3af;
}

.admin-table-meta {
    font-size: 0.8rem;
    color: #4b5563;
}

/* Status-Anzeige im Table */
.admin-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.83rem;
    font-weight: 500;
}

.admin-status--active {
    color: #16a34a;
}

.admin-status--inactive {
    color: #9ca3af;
}

/* =========================================
   Bildvorschau im Admin
   ========================================= */
.image-preview-wrapper {
    margin-bottom: 0.5rem;
}

.image-preview {
    max-width: 260px;
    max-height: 180px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

/* =========================================
   Form actions
   ========================================= */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.75rem;
}

/* =========================================
   Modal (Bildauswahl)
   ========================================= */
.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-content {
    position: relative;
    max-width: 900px;
    margin: 6vh auto;
    background: #ffffff;
    padding: 1.25rem 1.5rem 1.5rem;
    border-radius: 14px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.4);
}

.modal-content h2 {
    margin-top: 0;
}

/* =========================================
   Badges (Status)
   ========================================= */
.vehicle-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    background: #6b7280;
}

.badge-reserved  { background: #f59e0b; }
.badge-available { background: #16a34a; }
.badge-building  { background: #2563eb; }
.badge-sold      { background: #b91c1c; }
.badge-none      { display: none; }

/* =========================================
   Dashboard / Cards
   ========================================= */
.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 1rem 1.1rem;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1);
}

.admin-card h2 {
    margin-top: 0;
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Statistik-Karten im Fahrzeug-Admin */
.admin-stat-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 0.8rem 1rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.admin-stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.admin-stat-value {
    font-size: 1.2rem;
    font-weight: 600;
}

.admin-stat-sub {
    font-size: 0.82rem;
    color: #4b5563;
}

/* Filter-Card im Fahrzeug-Admin */
.admin-filter-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 0.9rem 1.1rem;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    margin-bottom: 1.1rem;
}

/* =========================================
   Breadcrumb für Galerie
   ========================================= */
.gallery-breadcrumb {
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 0.75rem;
}

.gallery-breadcrumb a {
    color: #2563eb;
    text-decoration: none;
}

.gallery-breadcrumb a:hover {
    text-decoration: underline;
}

/* Debug-Infos */
.gallery-debug {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.gallery-debug code {
    font-size: 0.75rem;
}

/* =========================================
   Galerie-Layout (Sidebar + Hauptbereich)
   ========================================= */
.gallery-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: flex-start;
}

.gallery-sidebar,
.gallery-main {
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1);
    border: 1px solid #e5e7eb;
}

/* =========================================
   Dropzone Upload
   ========================================= */
.dropzone {
    border-radius: 10px;
    border: 1px dashed #d1d5db;
    background: #f9fafb;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.dropzone span {
    display: block;
}

.dropzone-cta {
    font-weight: 500;
    color: #2563eb;
}

.dropzone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}

/* =========================================
   Medien-Kacheln
   ========================================= */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.media-tile {
    position: relative;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 0.75rem 0.75rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.media-tile:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.media-tile.active {
    border-color: #2563eb;
}

/* Icon in Kachel */
.media-tile-icon {
    width: 40px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #bfdbfe, #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #1d4ed8;
}

.media-tile-icon--folder {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
}

.media-tile-icon--file {
    background: #0f172a;
    color: #e5e7eb;
}

.media-tile-label {
    font-size: 0.85rem;
    font-weight: 500;
    word-break: break-word;
}

.media-tile-sub {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Thumbnail-Fläche für Bilder */
.media-tile-thumb {
    width: 100%;
    height: 90px;
    border-radius: 8px;
    background: #e5e7eb;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-tile-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Drag & Drop (Ordner/Datei verschieben) */
.media-tile[draggable="true"] {
    cursor: grab;
}
.media-tile[draggable="true"]:active {
    cursor: grabbing;
}

/* =========================================
   Ordner-Menü oben rechts (Dropdown)
   ========================================= */
.media-tile-folder {
    position: relative;
}

.media-tile-menu-trigger {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
}

.media-tile-menu-trigger:hover {
    border-color: #d1d5db;
    background: #ffffff;
}

.media-tile-menu {
    position: absolute;
    top: 24px;
    right: 4px;
    min-width: 130px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
    padding: 0.25rem 0;
    z-index: 30;
    display: none;
}

.media-tile-menu.open {
    display: block;
}

.media-tile-menu button {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.media-tile-menu button:hover {
    background: #f3f4f6;
}

.media-tile-menu button.danger {
    color: #b91c1c;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 900px) {
    .gallery-layout {
        grid-template-columns: 1fr;
    }
}


.sort-item, .thumb-sort-item { cursor: grab; }
.is-dragging { opacity: .6; cursor: grabbing; }
.drag-handle { margin-right: 10px; }
.thumb-sort-list { display:grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.thumb-sort-item img { width:100%; height:120px; object-fit:cover; border-radius:10px; display:block; }
