/* ─── L-Trans Phone Tracking System ───
   Тёмная тема в стиле грузоперевозок
   Цвета: угольно-чёрный, дорожный серый, акцент оранжевый/жёлтый (фары, габариты)
   Шрифты: системные, рубленые, грубоватый Industrial стиль
*/

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

:root {
    --bg-primary: #080808;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --bg-input: #141414;
    --border: #2a2a2a;
    --border-accent: #333333;

    --text-primary: #f0f0f0;
    --text-secondary: #999999;
    --text-muted: #666666;

    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-dim: #f59e0b22;
    --orange: #f97316;
    --green: #22c55e;
    --green-dim: #22c55e22;
    --red: #ef4444;
    --red-dim: #ef444422;
    --blue: #3b82f6;
    --blue-dim: #3b82f622;
    --yellow: #eab308;
    --purple: #a855f7;

    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-accent); }

/* ─── HEADER ───────────────────────────────────────────────── */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #000;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.header-title span { color: var(--accent); }

.header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.role-selector {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.role-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.role-btn.active {
    background: var(--accent);
    color: #000;
}

.role-btn:first-child { border-right: 1px solid var(--border); }

.role-btn:hover:not(.active) { color: var(--text-primary); }

/* ─── STATS BAR ─────────────────────────────────────────────── */

.stats-bar {
    display: flex;
    gap: 0;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.stat-card {
    flex: 1;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-right: none;
    text-align: center;
    transition: var(--transition);
}

.stat-card:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.stat-card:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-right: 1px solid var(--border); }

.stat-card:hover { background: var(--bg-card-hover); }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.stat-card.issued .stat-value { color: var(--blue); }
.stat-card.stock .stat-value { color: var(--green); }
.stat-card.repair .stat-value { color: var(--orange); }
.stat-card.active .stat-value { color: var(--yellow); }

/* ─── NAV TABS ──────────────────────────────────────────────── */

.nav {
    display: flex;
    gap: 0;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.nav-tab {
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tab:hover { color: var(--text-primary); }

.nav-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.nav-tab .badge {
    font-size: 10px;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ─── MAIN CONTENT ──────────────────────────────────────────── */

.main {
    padding: 24px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── TOOLBAR ───────────────────────────────────────────────── */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.toolbar h2 {
    font-size: 18px;
    font-weight: 600;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    min-width: 220px;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ─── BUTTONS ───────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
}

.btn:hover { background: var(--bg-card-hover); }

.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-success {
    background: var(--green);
    color: #000;
    border-color: var(--green);
    font-weight: 600;
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    font-weight: 600;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }

/* ─── TABLE ─────────────────────────────────────────────────── */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-secondary);
}

th {
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.text-muted { color: var(--text-muted); }

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(255,255,255,0.02); }

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.in_stock { background: var(--green-dim); color: var(--green); }
.status-badge.issued { background: var(--blue-dim); color: var(--blue); }
.status-badge.repair { background: var(--red-dim); color: var(--red); }
.status-badge.pending { background: var(--yellow); color: #000; }
.status-badge.in_progress { background: var(--blue-dim); color: var(--blue); }
.status-badge.done { background: var(--green-dim); color: var(--green); }

/* Action buttons in table */
.action-group {
    display: flex;
    gap: 4px;
}

/* ─── MODAL ─────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ─── FORM ──────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group { flex: 1; }

/* ─── EMPTY STATE ───────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
}

/* ─── TOAST ─────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); color: #fff; }
.toast.info { background: var(--blue); color: #fff; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ─── RESPONSIVE ────────────────────────────────────────────── */

@media (max-width: 768px) {
    .header { padding: 0 16px; }
    .stats-bar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .stat-card { border-radius: var(--radius) !important; border: 1px solid var(--border); }
    .nav { padding: 0 16px; overflow-x: auto; }
    .main { padding: 16px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-input { min-width: auto; }
    .form-row { flex-direction: column; gap: 0; }
}
