/* ============================================
   OZABA ERP - BASE STYLES
   ============================================ */

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

html { font-size: 16px; }

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar .brand {
    padding: 20px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sidebar .brand i { font-size: 1.4rem; }

.sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: #0d6efd;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar .section-title {
    padding: 20px 20px 8px;
    color: rgba(255,255,255,0.4);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.topbar {
    background: #fff;
    padding: 12px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    height: 60px;
}

.topbar h5 {
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.content-wrapper {
    padding: 24px;
    flex: 1;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 20px;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 20px; }

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    padding: 24px;
    border-radius: 12px;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.bg-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.bg-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.stat-card.bg-warning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-card.bg-danger { background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%); }
.stat-card.bg-info { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.stat-card i {
    font-size: 3rem;
    opacity: 0.2;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.stat-card .label {
    font-size: 0.85rem;
    opacity: 0.8;
    position: relative;
    z-index: 1;
    margin-top: 4px;
}

/* ============================================
   TABLES
   ============================================ */
.table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-modern th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 2px solid #e9ecef;
    color: #6c757d;
    text-align: left;
}

.table-modern td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table-modern tbody tr:hover {
    background: rgba(13, 110, 253, 0.02);
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES & BUTTONS
   ============================================ */
.badge-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group-text {
    background: #f8f9fa;
    border-color: #e2e8f0;
    color: #6c757d;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border: none;
    border-radius: 10px;
    padding: 16px 20px;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    gap: 4px;
}

.page-link {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 8px 14px;
}

.page-item.active .page-link {
    background: #667eea;
    border-color: #667eea;
}

/* ============================================
   AJAX LOADER
   ============================================ */
.ajax-loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    z-index: 9999;
    animation: slide 1s infinite;
}

@keyframes slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* ============================================
   GUEST PAGE (LOGIN/REGISTER)
   ============================================ */
.guest-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
}

.auth-card .text-center { text-align: center; }

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-wrapper {
        padding: 16px;
    }
}

/* ============================================
   DARK MODE
   ============================================ */
.dark-mode body { background: #0f0f23; color: #e2e8f0; }
.dark-mode .card { background: #1e1e3f; color: #e2e8f0; }
.dark-mode .card-header { border-color: rgba(255,255,255,0.1); }
.dark-mode .table-modern th { background: #252550; color: #e2e8f0; }
.dark-mode .table-modern td { border-color: #333; color: #e2e8f0; }
.dark-mode .topbar { background: #1a1a2e; color: #fff; }
.dark-mode .form-control, .dark-mode .form-select { background: #2a2a5a; border-color: #444; color: #fff; }
.dark-mode .input-group-text { background: #252550; border-color: #444; color: #e2e8f0; }
/* 985 dark/light fix */
[data-bs-theme="dark"] body{background:#0f172a!important;color:#e5e7eb!important}
[data-bs-theme="dark"] .main-content{background:#0f172a!important;color:#e5e7eb!important}
[data-bs-theme="dark"] .topbar,[data-bs-theme="dark"] .card,[data-bs-theme="dark"] .dropdown-menu,[data-bs-theme="dark"] .modal-content{background:#111827!important;color:#e5e7eb!important;border-color:#293241!important}
[data-bs-theme="dark"] .topbar h5,[data-bs-theme="dark"] .card-header,[data-bs-theme="dark"] .card-body,[data-bs-theme="dark"] .form-label{color:#e5e7eb!important}
[data-bs-theme="dark"] .bg-white{background:#111827!important;color:#e5e7eb!important}
[data-bs-theme="dark"] .form-control,[data-bs-theme="dark"] .form-select,[data-bs-theme="dark"] textarea{background:#0b1220!important;color:#e5e7eb!important;border-color:#334155!important}
[data-bs-theme="dark"] .btn-light{background:#1f2937!important;border-color:#374151!important;color:#fff!important}
[data-bs-theme="dark"] .table,[data-bs-theme="dark"] .table-modern{--bs-table-bg:#111827;--bs-table-color:#e5e7eb;color:#e5e7eb!important}
[data-bs-theme="dark"] .text-muted{color:#9ca3af!important}
[data-bs-theme="dark"] .guest-page{background:linear-gradient(135deg,#111827,#312e81)!important}
.theme-toggle{border:1px solid var(--bs-border-color);background:var(--bs-body-bg);color:var(--bs-body-color);border-radius:10px;min-width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center}
