/* ============================================
   GARAGE HALDEN – Admin CSS
   ============================================ */

:root {
    --a-white: #ffffff;
    --a-bg: #f5f6f8;
    --a-card: #ffffff;
    --a-text: #1a1d21;
    --a-text-light: #5c6471;
    --a-text-muted: #8a93a1;
    --a-border: #e3e6ea;
    --a-border-strong: #c8cdd4;
    --a-dark: #18191c;
    --a-darker: #0f1012;
    --a-bordo: #7a1525;
    --a-bordo-dark: #5c0f1c;
    --a-success: #16a34a;
    --a-warning: #ea8a06;
    --a-danger: #dc2626;
    --a-info: #2563eb;

    --a-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --a-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    --a-shadow-lg: 0 10px 30px rgba(0,0,0,0.10);

    --a-radius: 8px;
    --a-radius-lg: 12px;
    --a-sidebar-w: 260px;
    --a-header-h: 64px;

    --a-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--a-bg);
    color: var(--a-text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--a-bordo); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.3; font-weight: 700; color: var(--a-text); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 12px; }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-bg {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--a-dark) 0%, var(--a-darker) 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-bg::before, .login-bg::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--a-bordo) 0%, transparent 65%);
    opacity: 0.18;
}
.login-bg::before { top: -200px; left: -200px; }
.login-bg::after { bottom: -200px; right: -200px; }

.login-card {
    background: var(--a-card);
    border-radius: var(--a-radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--a-shadow-lg);
    position: relative;
    z-index: 1;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
}
.login-brand-mark {
    width: 52px;
    height: 52px;
    background: var(--a-dark);
    color: var(--a-white);
    display: grid;
    place-items: center;
    border-radius: var(--a-radius);
    font-weight: 900;
    font-size: 1.15rem;
    position: relative;
    overflow: hidden;
}
.login-brand-mark::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 50%, var(--a-bordo) 50%, var(--a-bordo) 53%, transparent 53%);
}
.login-brand-text { line-height: 1.2; }
.login-brand-name { font-weight: 800; font-size: 1.05rem; }
.login-brand-sub { font-size: 0.75rem; color: var(--a-text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.login-subtitle {
    color: var(--a-text-light);
    margin-bottom: 28px;
    font-size: 0.92rem;
}

/* ============================================
   LAYOUT
   ============================================ */

.admin-layout {
    display: grid;
    grid-template-columns: var(--a-sidebar-w) 1fr;
    min-height: 100vh;
}

/* SIDEBAR */
.admin-sidebar {
    background: var(--a-darker);
    color: var(--a-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--a-sidebar-w);
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .login-brand-mark { width: 40px; height: 40px; font-size: 0.95rem; }
.sidebar-brand-text { color: var(--a-white); line-height: 1.2; }
.sidebar-brand-name { font-weight: 800; font-size: 0.95rem; }
.sidebar-brand-sub { font-size: 0.7rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

.sidebar-section {
    padding: 24px 16px 8px;
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 2px;
    border-radius: var(--a-radius);
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--a-transition);
    text-decoration: none;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--a-white);
    text-decoration: none;
}
.sidebar-link.active {
    background: var(--a-bordo);
    color: var(--a-white);
}
.sidebar-link svg { flex-shrink: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--a-bordo);
    color: var(--a-white);
    display: grid;
    place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-text {
    flex: 1;
    line-height: 1.2;
    overflow: hidden;
}
.sidebar-user-name { color: var(--a-white); font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 0.75rem; }

/* MAIN */
.admin-main {
    grid-column: 2;
    background: var(--a-bg);
    min-height: 100vh;
}

.admin-header {
    height: var(--a-header-h);
    background: var(--a-white);
    border-bottom: 1px solid var(--a-border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header-title { font-size: 1rem; font-weight: 600; }

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-content { padding: 28px 32px; }

/* ============================================
   PAGE HEADER
   ============================================ */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 4px; }
.page-head .subtitle { color: var(--a-text-light); margin: 0; }

.page-head-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */

.a-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--a-radius);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--a-transition);
    text-decoration: none;
    background: var(--a-white);
    color: var(--a-text);
    border-color: var(--a-border);
    font-family: inherit;
}
.a-btn:hover { background: var(--a-bg); text-decoration: none; }

.a-btn-primary {
    background: var(--a-dark);
    color: var(--a-white);
    border-color: var(--a-dark);
}
.a-btn-primary:hover { background: var(--a-darker); border-color: var(--a-darker); color: var(--a-white); }

.a-btn-accent {
    background: var(--a-bordo);
    color: var(--a-white);
    border-color: var(--a-bordo);
}
.a-btn-accent:hover { background: var(--a-bordo-dark); border-color: var(--a-bordo-dark); color: var(--a-white); }

.a-btn-danger {
    background: var(--a-white);
    color: var(--a-danger);
    border-color: var(--a-border);
}
.a-btn-danger:hover { background: var(--a-danger); color: var(--a-white); border-color: var(--a-danger); }

.a-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.a-btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.a-btn-lg { padding: 12px 22px; font-size: 0.95rem; }

/* ============================================
   CARDS
   ============================================ */

.a-card {
    background: var(--a-card);
    border: 1px solid var(--a-border);
    border-radius: var(--a-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--a-shadow-sm);
}

.a-card h3 { margin-top: 0; }

.a-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--a-border);
}
.a-card-head h3 { margin: 0; }

/* ============================================
   STATS
   ============================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--a-card);
    border: 1px solid var(--a-border);
    border-radius: var(--a-radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--a-radius);
    background: rgba(122, 21, 37, 0.1);
    color: var(--a-bordo);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.stat-card-info { flex: 1; }
.stat-card-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; color: var(--a-text); }
.stat-card-label { font-size: 0.82rem; color: var(--a-text-light); margin-top: 2px; }

/* ============================================
   FORMS
   ============================================ */

.a-form-group {
    margin-bottom: 18px;
}
.a-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--a-text);
    margin-bottom: 6px;
}
.a-form-group label .help {
    font-weight: 400;
    color: var(--a-text-muted);
    font-size: 0.78rem;
    margin-left: 6px;
}

.a-input, .a-select, .a-textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--a-border);
    border-radius: var(--a-radius);
    font-size: 0.92rem;
    background: var(--a-white);
    color: var(--a-text);
    font-family: inherit;
    transition: border-color var(--a-transition), box-shadow var(--a-transition);
}
.a-input:focus, .a-select:focus, .a-textarea:focus {
    outline: none;
    border-color: var(--a-bordo);
    box-shadow: 0 0 0 3px rgba(122, 21, 37, 0.1);
}

.a-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.a-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.a-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--a-border);
    margin-top: 24px;
}

/* ============================================
   TABLE
   ============================================ */

.a-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--a-card);
}
.a-table th, .a-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--a-border);
    font-size: 0.9rem;
}
.a-table th {
    font-weight: 600;
    color: var(--a-text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--a-bg);
}
.a-table tbody tr:hover { background: var(--a-bg); }
.a-table tbody tr:last-child td { border-bottom: 0; }

.a-table-wrap {
    background: var(--a-card);
    border: 1px solid var(--a-border);
    border-radius: var(--a-radius-lg);
    overflow: hidden;
    box-shadow: var(--a-shadow-sm);
}

/* ============================================
   BADGES
   ============================================ */

.a-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--a-bg);
    color: var(--a-text);
}
.a-badge-success { background: rgba(22, 163, 74, 0.1); color: var(--a-success); }
.a-badge-warning { background: rgba(234, 138, 6, 0.12); color: var(--a-warning); }
.a-badge-danger { background: rgba(220, 38, 38, 0.1); color: var(--a-danger); }
.a-badge-info { background: rgba(37, 99, 235, 0.1); color: var(--a-info); }
.a-badge-bordo { background: rgba(122, 21, 37, 0.1); color: var(--a-bordo); }

/* ============================================
   ALERTS
   ============================================ */

.a-alert {
    padding: 14px 18px;
    border-radius: var(--a-radius);
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.9rem;
}
.a-alert-success { background: rgba(22, 163, 74, 0.08); color: #15803d; border-left: 3px solid var(--a-success); }
.a-alert-danger { background: rgba(220, 38, 38, 0.08); color: #991b1b; border-left: 3px solid var(--a-danger); }
.a-alert-warning { background: rgba(234, 138, 6, 0.08); color: #92400e; border-left: 3px solid var(--a-warning); }
.a-alert-info { background: rgba(37, 99, 235, 0.08); color: #1e40af; border-left: 3px solid var(--a-info); }

/* ============================================
   GRID
   ============================================ */

.a-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.a-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.a-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

/* ============================================
   REPEATER (für Listen wie Slides, Services, etc.)
   ============================================ */

.repeater-item {
    border: 1px solid var(--a-border);
    border-radius: var(--a-radius);
    padding: 20px;
    margin-bottom: 14px;
    background: var(--a-bg);
    position: relative;
}

.repeater-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--a-border);
}
.repeater-item-title {
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--a-text);
}
.repeater-item-actions {
    display: flex;
    gap: 6px;
}

.repeater-add {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px dashed var(--a-border-strong);
    border-radius: var(--a-radius);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--a-text-light);
    background: transparent;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: all var(--a-transition);
    font-family: inherit;
}
.repeater-add:hover {
    border-color: var(--a-bordo);
    color: var(--a-bordo);
    background: rgba(122,21,37,0.04);
}

/* ============================================
   MEDIA
   ============================================ */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.media-item {
    border: 1px solid var(--a-border);
    border-radius: var(--a-radius);
    overflow: hidden;
    background: var(--a-card);
    transition: all var(--a-transition);
    cursor: pointer;
    position: relative;
}
.media-item:hover {
    border-color: var(--a-bordo);
    box-shadow: var(--a-shadow);
    transform: translateY(-2px);
}
.media-item.selected {
    border-color: var(--a-bordo);
    box-shadow: 0 0 0 2px var(--a-bordo);
}

.media-thumb {
    aspect-ratio: 1;
    background: var(--a-bg);
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
}
.media-thumb img, .media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-thumb-icon {
    color: var(--a-text-muted);
}

.media-info {
    padding: 10px 12px;
    border-top: 1px solid var(--a-border);
}
.media-name {
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--a-text);
}
.media-meta {
    font-size: 0.7rem;
    color: var(--a-text-muted);
    margin-top: 2px;
}

.media-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.media-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.media-item:hover .media-delete { display: flex; }
.media-delete:hover { background: var(--a-danger); }

/* ============================================
   UPLOAD AREA
   ============================================ */

.upload-area {
    border: 2px dashed var(--a-border-strong);
    border-radius: var(--a-radius-lg);
    padding: 40px;
    text-align: center;
    background: var(--a-bg);
    transition: all var(--a-transition);
    cursor: pointer;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--a-bordo);
    background: rgba(122,21,37,0.04);
}
.upload-area-icon {
    color: var(--a-text-muted);
    margin-bottom: 12px;
}
.upload-area-text { font-weight: 600; color: var(--a-text); margin-bottom: 4px; }
.upload-area-sub { font-size: 0.82rem; color: var(--a-text-muted); }

/* ============================================
   IMAGE PICKER FIELD
   ============================================ */

.image-picker {
    display: flex;
    gap: 12px;
    align-items: center;
}
.image-picker-preview {
    width: 100px;
    height: 75px;
    border-radius: var(--a-radius);
    background: var(--a-bg);
    border: 1px solid var(--a-border);
    overflow: hidden;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    color: var(--a-text-muted);
}
.image-picker-preview img, .image-picker-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-picker-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.image-picker-input {
    font-size: 0.82rem;
    padding: 7px 10px;
    font-family: monospace;
    background: var(--a-bg);
}
.image-picker-actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   MODAL
   ============================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
    background: var(--a-white);
    border-radius: var(--a-radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--a-shadow-lg);
}

.modal-head {
    padding: 18px 24px;
    border-bottom: 1px solid var(--a-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-head h3 { margin: 0; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--a-border); display: flex; justify-content: flex-end; gap: 10px; background: var(--a-bg); }

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--a-text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all var(--a-transition);
}
.modal-close:hover { background: var(--a-bg); color: var(--a-danger); }

/* ============================================
   FLASH / TOASTS
   ============================================ */

.flash-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 22px;
    background: var(--a-dark);
    color: var(--a-white);
    border-radius: var(--a-radius);
    box-shadow: var(--a-shadow-lg);
    z-index: 1000;
    font-size: 0.9rem;
    animation: toast-in 0.3s ease;
}
.flash-toast.success { background: var(--a-success); }
.flash-toast.error { background: var(--a-danger); }

@keyframes toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .a-grid-3, .a-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .a-form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform var(--a-transition);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { grid-column: 1; }
    .admin-content { padding: 18px; }
    .admin-header { padding: 0 18px; }
    .a-grid-2, .a-grid-3, .a-grid-4 { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
}
