/* ============================================================
   STYLE.CSS - Sistem Gadai Kendaraan
   Mobile First - Bootstrap 5 Custom
   ============================================================ */

/* ===== VARIABLES ===== */
:root {
    --sidebar-width: 250px;
    --topbar-height: 56px;
    --bottom-nav-height: 60px;
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #0d6efd;
    --bg-light: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --border-radius: 10px;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar.show {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h5 {
    color: #fff;
    font-weight: 700;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(13, 110, 253, 0.15);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1039;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 0;
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    transition: margin-left 0.3s ease;
}

/* ===== TOPBAR ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
    padding: 10px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--sidebar-bg);
    cursor: pointer;
}

/* ===== BOTTOM NAV (Mobile) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1030;
    padding: 4px 0;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 60px;
}

.bottom-nav-item i {
    font-size: 20px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item:hover {
    color: var(--primary);
    text-decoration: none;
}

/* ===== CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
    border: none;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

/* ===== TABLE ===== */
.table-container {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--card-shadow);
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
    font-size: 14px;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* ===== FORMS ===== */
.form-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.form-label {
    font-weight: 500;
    font-size: 14px;
    color: #374151;
    margin-bottom: 4px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    font-size: 14px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ===== BADGES ===== */
.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

/* ===== SIGNATURE PAD ===== */
.signature-wrapper {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 4px;
    background: #fff;
    touch-action: none;
}

.signature-wrapper canvas {
    width: 100%;
    height: 150px;
    display: block;
    border-radius: 8px;
    touch-action: none;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .logo h3 {
    font-weight: 700;
    color: #1e293b;
}

.login-card .logo p {
    color: #64748b;
    font-size: 14px;
}

/* ===== NOTIFICATION BADGES ===== */
.notif-h7 { background: #fef3c7; color: #92400e; }
.notif-h3 { background: #fed7aa; color: #9a3412; }
.notif-h1 { background: #fecaca; color: #991b1b; }
.notif-h { background: #fee2e2; color: #991b1b; font-weight: 700; }

/* ===== RESPONSIVE ===== */

/* Tablet ke atas */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: var(--sidebar-width);
        padding-bottom: 20px;
    }

    .bottom-nav {
        display: none;
    }

    .btn-toggle-sidebar {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Mobile only */
@media (max-width: 767.98px) {
    .stat-card .stat-value {
        font-size: 18px;
    }

    .table {
        font-size: 12px;
    }

    .table td, .table th {
        padding: 8px 6px;
    }

    .form-card {
        padding: 16px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .sidebar-header h5 {
        font-size: 16px;
    }
}

/* Small mobile */
@media (max-width: 375px) {
    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 16px;
    }

    .bottom-nav-item {
        min-width: 50px;
        font-size: 9px;
    }

    .bottom-nav-item i {
        font-size: 18px;
    }
}

/* ===== PRINT ===== */
@media print {
    .sidebar, .topbar, .bottom-nav, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding-bottom: 0 !important;
    }
}

/* ===== UTILITY ===== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
