/* ============================================
   INDENT RAISING SYSTEM - GLOBAL STYLES
   ============================================ */

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 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; }

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-card p.subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 14px;
}

.auth-card .logo {
    font-size: 36px;
    margin-bottom: 16px;
    display: block;
}

/* ============================================
   FORM STYLES
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #059669; }

.btn-full { width: 100%; }

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    font-size: 16px;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--text);
    color: white;
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header .user-info {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a.active {
    border-right: 3px solid var(--primary-light);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.top-bar h1 {
    font-size: 24px;
    font-weight: 700;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
    padding: 8px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.red { background: #fee2e2; }
.stat-icon.orange { background: #ffedd5; }

.stat-info h4 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 4px;
}

.stat-info .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

/* ============================================
   ALERT BANNER
   ============================================ */
.alert-banner {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-weight: 500;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 10px;
}

.alert-banner.show { display: flex; }

.alert-banner.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-banner.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-banner.danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-banner .close-alert {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: inherit;
    opacity: 0.7;
}

/* ============================================
   INSIGHTS PANEL
   ============================================ */
.insights-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    padding: 24px;
    color: white;
    margin-bottom: 24px;
}

.insights-panel h3 {
    font-size: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insights-panel .insight-item {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.insights-panel .insight-item:last-child {
    border-bottom: none;
}

/* ============================================
   CHARTS
   ============================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.chart-container canvas {
    max-height: 300px;
}

/* ============================================
   TABLE
   ============================================ */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg);
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-retail { background: #dbeafe; color: #1e40af; }
.badge-warehouse { background: #fef3c7; color: #92400e; }
.badge-rent { background: #fee2e2; color: #991b1b; }
.badge-stock { background: #d1fae5; color: #065f46; }
.badge-maintenance { background: #e0e7ff; color: #3730a3; }
.badge-misc { background: #f3f4f6; color: #374151; }

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-dispatched { background: #dbeafe; color: #1e40af; }
.badge-received { background: #ede9fe; color: #6d28d9; }

/* Admin comment tooltip */
.admin-comment {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
    margin-top: 4px;
}

/* Action buttons in table */
.action-btns {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.btn-approve {
    background: var(--success);
    color: white;
}
.btn-approve:hover { background: #059669; }

.btn-reject {
    background: var(--danger);
    color: white;
}
.btn-reject:hover { background: #dc2626; }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
}

.filter-bar input,
.filter-bar select {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
}

.quick-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.quick-filter-btn:hover,
.quick-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    font-size: 20px;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}

.toast.success { background: #10b981; color: white; }
.toast.error { background: #ef4444; color: white; }
.toast.info { background: #3b82f6; color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-light);
    gap: 12px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h4 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ============================================
   NOTIFICATION CENTER
   ============================================ */
.notif-wrapper {
    position: relative;
}

.notif-bell {
    position: relative;
    background: none;
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.notif-bell:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    border: 2px solid var(--surface);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 400px;
    max-height: 500px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
    animation: notifSlideIn 0.2s ease;
}

.notif-panel.show {
    display: flex;
}

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.notif-panel-header h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.notif-list {
    overflow-y: auto;
    max-height: 420px;
    flex: 1;
}

.notif-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 14px;
}

.notif-item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: #f8fafc;
}

.notif-item.notif-unread {
    background: #f0f4ff;
}

.notif-item.notif-unread:hover {
    background: #e8eeff;
}

.notif-item-content {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    min-width: 0;
}

.notif-type-indicator {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.notif-type-indicator.notif-approved { background: var(--success); }
.notif-type-indicator.notif-rejected { background: var(--danger); }
.notif-type-indicator.notif-dispatched { background: var(--info); }
.notif-type-indicator.notif-received { background: #8b5cf6; }

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-message {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 6px;
    word-wrap: break-word;
}

.notif-unread .notif-message {
    font-weight: 600;
}

.notif-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.notif-time {
    color: var(--text-light);
    font-size: 12px;
}

.notif-delete {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 0 12px;
    display: flex;
    align-items: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.notif-delete:hover {
    color: var(--danger);
    background: #fee2e2;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }

    .sidebar.open + .sidebar-overlay,
    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .hamburger {
        display: block;
    }

    .notif-panel {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1000;
    }

    .notif-list {
        max-height: calc(100vh - 70px);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input,
    .filter-bar select {
        min-height: 44px;
    }

    .auth-card {
        padding: 28px 24px;
    }

    .top-bar h1 {
        font-size: 20px;
    }

    .modal {
        padding: 24px;
        margin: 12px;
    }

    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 14px;
    }

    .card {
        padding: 16px;
    }

    table {
        font-size: 13px;
    }

    thead th,
    tbody td {
        padding: 10px 12px;
    }

    .action-btns {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info .value {
        font-size: 20px;
    }

    .quick-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================
   STATUS SUMMARY GRID
   ============================================ */
.status-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.status-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.status-summary-item .status-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.status-summary-item .status-count {
    font-size: 28px;
    font-weight: 700;
}

.status-summary-item.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-summary-item.approved {
    background: #d1fae5;
    color: #065f46;
}

.status-summary-item.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-summary-item.dispatched {
    background: #dbeafe;
    color: #1e40af;
}

.status-summary-item.received {
    background: #ede9fe;
    color: #6d28d9;
}
