/* ============================================================
   Enterprise Warranty & Plotter Management System
   Main Stylesheet
   ============================================================ */

:root {
    --primary: #2196F3;
    --primary-dark: #1a237e;
    --secondary: #FF9800;
    --success: #4CAF50;
    --danger: #f44336;
    --warning: #FF9800;
    --info: #00BCD4;
    --dark: #1e1e1e;
    --light: #f5f5f5;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --transition: all 0.3s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:14px; }
body { font-family: var(--font); color: var(--gray-800); background: var(--gray-100); line-height:1.6; overflow-x:hidden; }

/* App Layout */
.app-wrapper { display:flex; min-height:100vh; }
.sidebar { width:var(--sidebar-width); background:linear-gradient(180deg, #1a237e 0%, #283593 100%); color:white; position:fixed; top:0; left:0; bottom:0; z-index:100; transition:var(--transition); overflow-y:auto; overflow-x:hidden; }
.sidebar-collapsed .sidebar { width:var(--sidebar-collapsed-width); }
.sidebar-collapsed .sidebar .sidebar-brand,
.sidebar-collapsed .sidebar .menu-item span,
.sidebar-collapsed .sidebar .sidebar-toggle svg { display:none; }
.sidebar-header { padding:16px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid rgba(255,255,255,0.1); }
.sidebar-logo { display:flex; align-items:center; gap:10px; text-decoration:none; color:white; white-space:nowrap; }
.sidebar-brand { font-weight:700; font-size:15px; }
.sidebar-toggle { background:none; border:none; color:white; cursor:pointer; padding:6px; border-radius:6px; transition:var(--transition); }
.sidebar-toggle:hover { background:rgba(255,255,255,0.1); }
.sidebar-nav { padding:10px 0; }
.sidebar-menu { list-style:none; }
.menu-item a { display:flex; align-items:center; gap:12px; padding:12px 20px; color:rgba(255,255,255,0.75); text-decoration:none; font-weight:500; font-size:13px; transition:var(--transition); white-space:nowrap; }
.menu-item a:hover, .menu-item.active a { color:white; background:rgba(255,255,255,0.1); border-left:3px solid var(--secondary); }

/* Main Content */
.main-content { flex:1; margin-left:var(--sidebar-width); transition:var(--transition); min-height:100vh; }
.sidebar-collapsed .main-content { margin-left:var(--sidebar-collapsed-width); }
.top-header { height:var(--header-height); background:var(--white); border-bottom:1px solid var(--gray-200); display:flex; align-items:center; justify-content:space-between; padding:0 24px; position:sticky; top:0; z-index:90; box-shadow:var(--shadow-sm); }
.header-left { display:flex; align-items:center; gap:16px; }
.mobile-toggle { display:none; background:none; border:none; cursor:pointer; color:var(--gray-700); padding:6px; }
.header-right { display:flex; align-items:center; gap:16px; }
.page-content { padding:24px; }

/* Notification */
.notification-bell { position:relative; cursor:pointer; color:var(--gray-600); }
.badge-pulse { position:absolute; top:-8px; right:-8px; background:var(--danger); color:white; font-size:10px; width:18px; height:18px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; animation:pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(244,67,54,0.4)} 70%{box-shadow:0 0 0 8px rgba(244,67,54,0)} 100%{box-shadow:0 0 0 0 rgba(244,67,54,0)} }
.notification-dropdown { display:none; position:absolute; top:100%; right:0; width:360px; background:white; border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); margin-top:8px; overflow:hidden; z-index:200; }
.notification-dropdown.show { display:block; }
.notif-header { padding:14px 16px; border-bottom:1px solid var(--gray-200); font-weight:600; font-size:14px; }
.notif-list { max-height:350px; overflow-y:auto; }
.notif-item { display:flex; gap:12px; padding:14px 16px; text-decoration:none; color:inherit; border-bottom:1px solid var(--gray-100); transition:var(--transition); }
.notif-item:hover, .notif-item.unread { background:#e3f2fd; }
.notif-body strong { font-size:13px; display:block; margin-bottom:2px; }
.notif-body p { font-size:12px; color:var(--gray-600); margin-bottom:4px; }
.notif-body small { font-size:11px; color:var(--gray-500); }
.notif-footer { display:block; text-align:center; padding:12px; font-size:13px; font-weight:600; color:var(--primary); text-decoration:none; }

/* User Dropdown */
.user-dropdown { position:relative; }
.user-trigger { display:flex; align-items:center; gap:10px; background:none; border:none; cursor:pointer; padding:6px; border-radius:var(--radius); transition:var(--transition); }
.user-trigger:hover { background:var(--gray-100); }
.user-avatar { width:36px; height:36px; border-radius:50%; background:var(--primary); color:white; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; }
.user-name { font-weight:500; font-size:14px; color:var(--gray-700); }
.user-menu { display:none; position:absolute; top:100%; right:0; background:white; border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); min-width:200px; overflow:hidden; z-index:200; margin-top:8px; }
.user-menu.show { display:block; }
.user-menu a { display:block; padding:12px 16px; color:var(--gray-700); text-decoration:none; font-size:13px; transition:var(--transition); }
.user-menu a:hover { background:var(--gray-100); color:var(--primary); }
.user-menu hr { border:none; border-top:1px solid var(--gray-200); margin:4px 0; }

/* Page Header */
.page-header { margin-bottom:24px; }
.page-header h1 { font-size:24px; font-weight:700; color:var(--gray-900); }
.page-header p { color:var(--gray-600); font-size:14px; margin-top:4px; }
.page-header-actions { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; }

/* Cards */
.card { background:var(--white); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); border:1px solid var(--gray-200); overflow:hidden; }
.card-header { padding:16px 20px; border-bottom:1px solid var(--gray-200); display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.card-header h3 { font-size:16px; font-weight:600; }
.card-body { padding:20px; }
.card-footer { padding:14px 20px; border-top:1px solid var(--gray-200); background:var(--gray-100); }

/* Stats Grid */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--white); border-radius:var(--radius-lg); padding:20px; box-shadow:var(--shadow-sm); display:flex; align-items:center; gap:16px; transition:var(--transition); border:1px solid var(--gray-200); }
.stat-card:hover { transform:translateY(-2px); box-shadow:var(--shadow); }
.stat-icon { width:48px; height:48px; border-radius:var(--radius); display:flex; align-items:center; justify-content:center; font-size:22px; }
.stat-icon.blue { background:#e3f2fd; color:var(--primary); }
.stat-icon.green { background:#e8f5e9; color:var(--success); }
.stat-icon.orange { background:#fff3e0; color:var(--warning); }
.stat-icon.red { background:#ffebee; color:var(--danger); }
.stat-icon.purple { background:#f3e5f5; color:#9C27B0; }
.stat-info h4 { font-size:24px; font-weight:700; color:var(--gray-900); }
.stat-info p { font-size:12px; color:var(--gray-600); margin-top:2px; }

/* Buttons */
.btn { display:inline-flex; align-items:center; gap:8px; padding:10px 20px; border-radius:var(--radius); font-size:13px; font-weight:600; cursor:pointer; border:none; text-decoration:none; transition:var(--transition); white-space:nowrap; }
.btn-primary { background:var(--primary); color:white; }
.btn-primary:hover { background:#1976D2; }
.btn-success { background:var(--success); color:white; }
.btn-success:hover { background:#388E3C; }
.btn-danger { background:var(--danger); color:white; }
.btn-danger:hover { background:#D32F2F; }
.btn-warning { background:var(--warning); color:white; }
.btn-outline { background:transparent; border:2px solid var(--gray-300); color:var(--gray-700); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-sm { padding:6px 12px; font-size:12px; }
.btn-lg { padding:14px 28px; font-size:15px; }
.btn-icon { width:36px; height:36px; padding:0; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; }

/* Tables */
.table-responsive { overflow-x:auto; }
.table { width:100%; border-collapse:collapse; }
.table th { background:var(--gray-100); padding:12px 14px; text-align:left; font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:0.5px; color:var(--gray-700); border-bottom:2px solid var(--gray-300); white-space:nowrap; }
.table td { padding:12px 14px; border-bottom:1px solid var(--gray-200); font-size:13px; }
.table tbody tr:hover { background:var(--gray-50); }

/* Badges */
.badge { display:inline-block; padding:4px 10px; border-radius:20px; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }
.badge-primary { background:#e3f2fd; color:#1565C0; }
.badge-success { background:#e8f5e9; color:#2E7D32; }
.badge-danger { background:#ffebee; color:#C62828; }
.badge-warning { background:#fff3e0; color:#E65100; }
.badge-info { background:#e0f7fa; color:#00838F; }
.badge-secondary { background:#f5f5f5; color:#616161; }
.badge-dark { background:#212121; color:white; }

/* Forms */
.form-group { margin-bottom:16px; }
.form-label { display:block; margin-bottom:6px; font-weight:600; font-size:13px; color:var(--gray-700); }
.form-control { width:100%; padding:10px 14px; border:2px solid var(--gray-300); border-radius:var(--radius); font-size:13px; font-family:inherit; transition:var(--transition); background:white; }
.form-control:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(33,150,243,0.1); }
select.form-control { cursor:pointer; }
textarea.form-control { resize:vertical; min-height:100px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-check { display:flex; align-items:center; gap:8px; }
.form-check input[type="checkbox"] { width:16px; height:16px; cursor:pointer; }

/* Grid Layout */
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid-3 { display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; }
.grid-4 { display:grid; grid-template-columns:repeat(4, 1fr); gap:16px; }

/* Alerts */
.alert { padding:12px 16px; border-radius:var(--radius); margin-bottom:16px; font-size:13px; display:flex; align-items:center; gap:10px; }
.alert-success { background:#e8f5e9; color:#2e7d32; border:1px solid #c8e6c9; }
.alert-danger { background:#ffebee; color:#c62828; border:1px solid #ffcdd2; }
.alert-warning { background:#fff3e0; color:#e65100; border:1px solid #ffe0b2; }
.alert-info { background:#e3f2fd; color:#1565c0; border:1px solid #bbdefb; }

/* Modals */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:1000; align-items:center; justify-content:center; }
.modal-overlay.show { display:flex; }
.modal { background:white; border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); width:100%; max-width:600px; max-height:90vh; overflow-y:auto; animation:slideUp 0.3s ease; }
.modal-lg { max-width:800px; }
.modal-sm { max-width:400px; }
.modal-header { padding:16px 20px; border-bottom:1px solid var(--gray-200); display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { font-size:16px; font-weight:600; }
.modal-close { background:none; border:none; font-size:20px; cursor:pointer; color:var(--gray-500); }
.modal-body { padding:20px; }
.modal-footer { padding:14px 20px; border-top:1px solid var(--gray-200); display:flex; justify-content:flex-end; gap:10px; }

/* Tabs */
.tabs { display:flex; border-bottom:2px solid var(--gray-200); margin-bottom:20px; }
.tab { padding:12px 20px; cursor:pointer; font-weight:500; font-size:14px; color:var(--gray-600); border-bottom:2px solid transparent; margin-bottom:-2px; transition:var(--transition); }
.tab:hover { color:var(--primary); }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }

/* Timeline */
.timeline { position:relative; padding-left:30px; }
.timeline::before { content:''; position:absolute; left:10px; top:0; bottom:0; width:2px; background:var(--gray-300); }
.timeline-item { position:relative; padding-bottom:20px; }
.timeline-item::before { content:''; position:absolute; left:-24px; top:4px; width:10px; height:10px; border-radius:50%; background:var(--primary); border:2px solid white; box-shadow:0 0 0 2px var(--primary); }
.timeline-item .time { font-size:12px; color:var(--gray-500); }
.timeline-item .content { background:var(--gray-100); padding:12px 16px; border-radius:var(--radius); margin-top:4px; }

/* Utilities */
.mt-1 { margin-top:8px; } .mt-2 { margin-top:16px; } .mt-3 { margin-top:24px; }
.mb-1 { margin-bottom:8px; } .mb-2 { margin-bottom:16px; } .mb-3 { margin-bottom:24px; }
.mr-1 { margin-right:8px; } .mr-2 { margin-right:16px; }
.p-1 { padding:8px; } .p-2 { padding:16px; } .p-3 { padding:24px; }
.text-center { text-align:center; }
.text-right { text-align:right; }
.text-muted { color:var(--gray-500); }
.text-primary { color:var(--primary); }
.text-success { color:var(--success); }
.text-danger { color:var(--danger); }
.text-warning { color:var(--warning); }
.font-bold { font-weight:700; }
.flex { display:flex; }
.flex-between { display:flex; justify-content:space-between; align-items:center; }
.flex-wrap { flex-wrap:wrap; }
.gap-1 { gap:8px; } .gap-2 { gap:16px; } .gap-3 { gap:24px; }
.w-full { width:100%; }

/* Loading */
.loading { display:inline-block; width:20px; height:20px; border:2px solid var(--gray-300); border-top-color:var(--primary); border-radius:50%; animation:spin 0.6s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.loading-overlay { position:absolute; inset:0; background:rgba(255,255,255,0.8); display:flex; align-items:center; justify-content:center; z-index:50; }

/* DataTables */
.dataTables_wrapper { font-size:13px; }
.dataTables_wrapper .dt-toolbar { display:flex; justify-content:space-between; align-items:center; padding:12px 0; flex-wrap:wrap; gap:10px; }
.dataTables_wrapper .dt-search { display:flex; align-items:center; gap:8px; }
.dataTables_wrapper .dt-search input { padding:8px 12px; border:2px solid var(--gray-300); border-radius:var(--radius); font-size:13px; }
.dataTables_wrapper .dt-pagination { display:flex; align-items:center; gap:4px; }
.dataTables_wrapper .dt-pagination button { padding:6px 12px; border:1px solid var(--gray-300); background:white; border-radius:var(--radius); cursor:pointer; font-size:12px; }
.dataTables_wrapper .dt-pagination button.active { background:var(--primary); color:white; border-color:var(--primary); }
.dataTables_wrapper .dt-pagination button:disabled { opacity:0.5; cursor:default; }

/* Responsive */
@media (max-width:1024px) {
    .sidebar { transform:translateX(-100%); }
    .sidebar-expanded .sidebar { transform:translateX(0); }
    .main-content { margin-left:0; }
    .mobile-toggle { display:block; }
    .grid-4, .grid-3 { grid-template-columns:repeat(2, 1fr); }
}
@media (max-width:768px) {
    .form-row { grid-template-columns:1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns:1fr; }
    .stats-grid { grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); }
    .page-header-actions { flex-direction:column; align-items:stretch; }
    .top-header { padding:0 16px; }
    .page-content { padding:16px; }
    .notification-dropdown { width:300px; right:-50px; }
}