/* ============================================================
   Asset Tracking System — Stylesheet
   Modern, clean, responsive design
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --sidebar-width: 250px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --transition: .2s ease;
}

html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Layout ────────────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.nav-links {
    list-style: none;
    flex: 1;
    padding: .75rem 0;
    overflow-y: auto;
}
.nav-links li a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem 1.25rem;
    color: var(--sidebar-text);
    font-size: .92rem;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}
.nav-links li a:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
}
.nav-links li.active a {
    background: rgba(37,99,235,.18);
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-name { font-size: .85rem; color: #e2e8f0; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title { font-size: 1.25rem; font-weight: 600; }
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    display: none;
}

.content-area {
    padding: 1.5rem;
    flex: 1;
}

.main-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ── Cards & Stats ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }
.stat-icon.cyan   { background: var(--info-light);    color: var(--info); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .82rem; color: var(--text-muted); }

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}
.card-header h2, .card-header h3 { font-size: 1.05rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ── Tables ────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
thead th {
    background: #f8fafc;
    font-weight: 600;
    text-align: left;
    padding: .75rem 1rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    font-size: .9rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: .35rem .75rem; font-size: .82rem; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 500;
    font-size: .9rem;
}
.form-control {
    width: 100%;
    padding: .55rem .75rem;
    font-size: .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    transition: border-color var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
select.form-control { appearance: auto; }

.search-bar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.search-bar .form-control { flex: 1; min-width: 200px; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.15rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: #155e75; border: 1px solid #a5f3fc; }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: .3rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: .4rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .85rem;
    color: var(--text);
    text-decoration: none;
}
.pagination a:hover { background: var(--bg); }
.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Login Page ────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 1rem;
}
.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    text-align: center;
    margin-bottom: .35rem;
    font-size: 1.5rem;
}
.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    font-size: .9rem;
}
.login-card .btn { width: 100%; justify-content: center; padding: .7rem; }

/* ── Detail View ───────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.detail-item { padding: .6rem 0; }
.detail-label {
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .15rem;
}
.detail-value { font-size: 1rem; font-weight: 500; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state svg { margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: .95rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .app-wrapper.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .content-area { padding: 1rem; }
    .card-body { padding: .85rem; }
    thead th, tbody td { padding: .5rem .65rem; font-size: .82rem; }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
