/* ══════════════════════════════════════════════════════════
   SK ADMIN — PREMIUM DARK 2026 — Style SK Auto
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg: #050507;
    --surface: #111114;
    --surface-2: #1a1a1f;
    --surface-3: #222228;
    --accent: #DE5328;
    --accent-soft: rgba(222,83,40,.1);
    --accent-glow: rgba(222,83,40,.15);
    --blue: #3b82f6;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --white: #f5f5f7;
    --text: #e4e4e7;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    --border: rgba(255,255,255,.06);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 240px;
    --ease: cubic-bezier(.4,0,.2,1);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Inter', -apple-system, system-ui, sans-serif; font-size: 14px; line-height: 1.6; color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { color: #ff7a54; }
h1,h2,h3 { color: var(--white); font-weight: 700; margin: 0 0 .75rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }

/* ══ LAYOUT ══ */
.admin-layout { display: flex; min-height: 100vh; }

/* ══ SIDEBAR ══ */
.admin-sidebar {
    width: var(--sidebar-w); min-height: 100vh; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    background: var(--surface); display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand { padding: 1.25rem 1.25rem; }
.sidebar-brand h2 { color: var(--accent); font-size: 1.15rem; margin: 0; letter-spacing: .02em; }
.sidebar-nav { flex: 1; padding: .5rem 0; display: flex; flex-direction: column; }
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: .6rem; padding: .6rem 1.25rem;
    color: var(--text-muted); font-size: .85rem; font-weight: 500;
    text-decoration: none; transition: all .2s var(--ease);
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-item:hover { background: var(--surface-2); color: var(--white); }
.sidebar-nav .nav-item.active { background: var(--surface-2); color: var(--accent); border-left-color: var(--accent); }
.nav-icon { font-size: .5rem; opacity: .4; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.btn-logout {
    display: block; width: 100%; padding: .5rem; text-align: center;
    background: transparent; border: 1px solid rgba(239,68,68,.2);
    color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer;
    font-size: .85rem; transition: all .2s; text-decoration: none;
}
.btn-logout:hover { background: rgba(239,68,68,.1); border-color: var(--danger); color: #fca5a5; }

/* ══ MAIN ══ */
.admin-main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; }
.admin-content { padding: 1.5rem; max-width: 1400px; }

/* ══ CARDS ══ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
.card-body { padding: 1.25rem; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.form-card { border-left: 3px solid var(--accent); }

/* ══ DASHBOARD ══ */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.dashboard-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; text-align: center; transition: all .3s var(--ease);
}
.dashboard-card:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); transform: translateY(-2px); }
.card-value { font-size: 2.5rem; font-weight: 800; color: var(--accent); line-height: 1; }
.card-label { font-size: .85rem; color: var(--text-muted); margin-top: .5rem; }
.card-detail { font-size: .75rem; color: var(--text-dim); margin-top: .25rem; }
.dashboard-actions { margin-top: 1rem; }
.action-links { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .75rem; }

/* ══ TABLES ══ */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    background: var(--surface-2); padding: .65rem .75rem; text-align: left;
    font-weight: 600; font-size: .7rem; text-transform: uppercase;
    letter-spacing: .08em; color: var(--text-dim); white-space: nowrap;
}
.admin-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-muted); }
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table .row-sold { opacity: .5; }
.admin-table .actions { white-space: nowrap; display: flex; gap: .35rem; }
.thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 6px; }

.table-toolbar { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.toolbar-row .filter-group { min-width: 120px; }
.toolbar-row .filter-group label { display: block; font-size: .65rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .25rem; }
.toolbar-row .search-box { flex: 2; min-width: 200px; }
.search-box input { min-width: 200px; }
.result-count { font-size: .85rem; color: var(--text-dim); margin-left: auto; }

/* ══ PAGINATION ══ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; padding: .75rem; font-size: .9rem; color: var(--text-muted); }

/* ══ BADGES ══ */
.badge { display: inline-block; padding: .2rem .6rem; font-size: .72rem; font-weight: 600; border-radius: 60px; }
.badge-active { background: rgba(34,197,94,.1); color: var(--success); }
.badge-sold { background: rgba(239,68,68,.1); color: var(--danger); }

/* ══ BUTTONS ══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1rem; font-size: .85rem; font-weight: 600; border: none;
    border-radius: var(--radius-sm); cursor: pointer; transition: all .2s var(--ease); text-decoration: none;
}
.btn:hover { text-decoration: none; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #c4431f; box-shadow: 0 4px 16px var(--accent-glow); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); color: var(--white); border-color: var(--text-dim); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-reset { background: rgba(239,68,68,.08); color: #f87171; border-radius: var(--radius-sm); padding: .4rem 1rem; font-size: .78rem; cursor: pointer; }
.btn-reset:hover { background: rgba(239,68,68,.15); }

/* ══ FORMS ══ */
.form-group { margin-bottom: .75rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .8rem; color: var(--text-muted); }
.form-control {
    width: 100%; padding: .55rem .75rem; font-size: .85rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); transition: all .2s var(--ease);
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control-sm { padding: .35rem .5rem; font-size: .8rem; }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.form-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* ══ ALERTS ══ */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .85rem; margin-top: .75rem; }
.alert-success { background: rgba(34,197,94,.08); color: var(--success); border: 1px solid rgba(34,197,94,.15); }
.alert-danger { background: rgba(239,68,68,.08); color: var(--danger); border: 1px solid rgba(239,68,68,.15); }

/* ══ TOAST ══ */
.toast-notification {
    position: fixed; top: 1rem; right: 1rem; left: 1rem; z-index: 99999;
    max-width: 500px; margin: 0 auto; padding: .85rem 1.25rem; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    font-size: .88rem; font-weight: 500; box-shadow: 0 8px 32px rgba(0,0,0,.5);
    animation: toastSlide .4s var(--ease);
}
.toast-error { background: var(--surface-2); color: #f87171; border-left: 4px solid var(--danger); }
.toast-success { background: var(--surface-2); color: #4ade80; border-left: 4px solid var(--success); }
.toast-notification button { background: none; border: none; color: inherit; cursor: pointer; font-size: 1.1rem; opacity: .5; padding: 0; }
.toast-notification button:hover { opacity: 1; }
@keyframes toastSlide { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ══ SYNC PROGRESS ══ */
.sync-progress { margin: 1.5rem 0; }
.sync-status { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; font-weight: 500; color: var(--text); }
.sync-spinner { width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar-container { width: 100%; height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; margin-bottom: .75rem; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ff7a54); border-radius: 8px; transition: width .5s ease; }
.progress-stats { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-dim); }
.sync-result { margin-top: 1.5rem; }
.sync-summary { font-size: .9rem; color: var(--text-muted); }
.sync-summary strong { color: var(--white); }

/* ══ CONTACT LIST ══ */
.contact-list { display: flex; flex-direction: column; gap: .5rem; }
.contact-item-admin {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1rem; border-radius: var(--radius-sm);
    background: var(--surface-2); transition: background .2s;
}
.contact-item-admin:hover { background: var(--surface-3); }
.contact-item-info { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; }
.contact-type-badge {
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--accent); white-space: nowrap; min-width: 80px;
}
.contact-value { color: var(--text); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.contact-item-actions { display: flex; gap: .35rem; flex-shrink: 0; }

@media (max-width: 768px) {
    .contact-item-admin { flex-direction: column; align-items: stretch; gap: .5rem; }
    .contact-item-info { flex-direction: column; gap: .25rem; }
    .contact-item-actions { justify-content: flex-end; }
    .contact-type-badge { min-width: auto; }
}

/* ══ PRESENTATION ══ */
.presentation-content { color: var(--text-muted); font-size: .9rem; white-space: pre-wrap; max-height: 200px; overflow-y: auto; line-height: 1.7; }

/* ══ LOADING ══ */
.loading { color: var(--text-dim); padding: 2rem 0; text-align: center; }

/* ══ LOGIN ══ */
.login-container { width: 100%; max-width: 420px; padding: 1rem; margin: 0 auto; display: flex; align-items: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem 2rem; box-shadow: 0 8px 40px rgba(0,0,0,.4); width: 100%; }
.login-card h1 { text-align: center; font-size: 1.4rem; margin-bottom: .25rem; color: var(--accent); }
.login-subtitle { text-align: center; color: var(--text-dim); margin-bottom: 1.5rem; font-size: .9rem; }
.btn-login { width: 100%; margin-top: .5rem; padding: .65rem; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; cursor: pointer; }
.btn-login:hover { background: #c4431f; }

/* ══ ERROR UI ══ */
#blazor-error-ui { background: var(--danger); color: white; padding: .5rem 1rem; position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999; display: none; text-align: center; }
#blazor-error-ui .reload { color: white; text-decoration: underline; } #blazor-error-ui .dismiss { cursor: pointer; margin-left: 1rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: .8rem; }

/* ══ BURGER ADMIN ══ */
.admin-burger { display: none; }

@media (max-width: 768px) {
    .admin-burger {
        display: block; position: fixed; top: 1rem; right: 1rem; z-index: 9999;
        background: var(--surface); border: 1px solid var(--border);
        border-radius: 10px; padding: .6rem; cursor: pointer;
    }
    .admin-burger span {
        display: block; width: 22px; height: 2px; background: #fff;
        margin: 5px 0; transition: all .3s var(--ease); border-radius: 2px;
    }
    .admin-burger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); background: var(--accent); }
    .admin-burger.open span:nth-child(2) { opacity: 0; }
    .admin-burger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); background: var(--accent); }

    .admin-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
        transform: translateX(-100%); transition: transform .3s var(--ease);
        z-index: 9998;
    }
    .admin-sidebar.open { transform: translateX(0); box-shadow: 4px 0 40px rgba(0,0,0,.6); }

    .admin-main { margin-left: 0; }
    .admin-content { padding: 1rem; padding-top: 3.5rem; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; }
    .toolbar-row { flex-direction: column; }
    .toolbar-row .filter-group, .toolbar-row .search-box { min-width: 100%; }
    .search-box input { min-width: auto; width: 100%; }
    .result-count { margin-left: 0; }

    /* Table responsive mobile */
    .admin-table { font-size: .78rem; }
    .admin-table th, .admin-table td { padding: .45rem .5rem; }
    .admin-table .actions { flex-direction: column; gap: .25rem; }
    .thumb { width: 45px; height: 30px; }

    /* Hide less important columns on mobile */
    .admin-table th:nth-child(1),
    .admin-table td:nth-child(1),
    .admin-table th:nth-child(6),
    .admin-table td:nth-child(6),
    .admin-table th:nth-child(8),
    .admin-table td:nth-child(8),
    .admin-table th:nth-child(10),
    .admin-table td:nth-child(10) {
        display: none;
    }

    .pagination { gap: .5rem; font-size: .8rem; }
    .btn-sm { padding: .25rem .5rem; font-size: .72rem; }

    /* Cards responsive */
    .card-body { padding: 1rem; }
    .card-header-row { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .form-actions { flex-wrap: wrap; }
    .form-group input, .form-group select, .form-group textarea { font-size: .85rem; }
}
