/* Al Qamar Steel - Main CSS */
/* Tailwind-like utility classes for PHP */

:root {
    --brand-primary: #1e3a5f;
    --brand-secondary: #2d5a8e;
    --brand-accent: #d4a843;
    --brand-steel: #6b7280;
    --color-danger: #ef4444;
    --color-success: #22c55e;
    --bg: #ffffff;
    --fg: #171717;
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --input-bg: #f9fafb;
    --input-border: #d1d5db;
    --hover-bg: #f3f4f6;
    --muted: #6b7280;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.dark {
    --bg: #0a0a0a;
    --fg: #ededed;
    --card-bg: #111827;
    --card-border: #1f2937;
    --sidebar-bg: #111827;
    --sidebar-border: #1f2937;
    --input-bg: #1f2937;
    --input-border: #374151;
    --hover-bg: #1f2937;
    --muted: #9ca3af;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: var(--sidebar-bg); border-inline-end: 1px solid var(--sidebar-border); position: fixed; top: 0; height: 100vh; z-index: 50; transition: transform 0.3s ease, width 0.3s ease; overflow-y: auto; }
.sidebar.collapsed { width: 72px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
.main-content { flex: 1; margin-inline-start: 280px; display: flex; flex-direction: column; min-height: 100vh; transition: margin 0.3s ease; }
.main-content.sidebar-open { margin-inline-start: 72px; }

/* Sidebar */
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--sidebar-border); height: 64px; }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.sidebar-logo-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--brand-primary); display: flex; align-items: center; justify-content: center; color: var(--brand-accent); font-weight: bold; font-size: 14px; }
.sidebar-logo-text h1 { font-size: 14px; font-weight: 700; color: var(--fg); line-height: 1.2; }
.sidebar-logo-text p { font-size: 10px; color: var(--muted); }
.sidebar-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--muted); transition: all 0.2s; font-size: 14px; font-weight: 500; }
.sidebar-nav a:hover { background: var(--hover-bg); color: var(--fg); }
.sidebar-nav a.active { background: var(--brand-primary); color: white; box-shadow: 0 2px 8px rgba(30,58,95,0.3); }
.sidebar-nav a.active svg { color: white; }
.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-border); text-align: center; font-size: 10px; color: var(--muted); }

/* Navbar */
.navbar { position: sticky; top: 0; z-index: 30; height: 64px; background: var(--sidebar-bg); border-bottom: 1px solid var(--sidebar-border); display: flex; align-items: center; padding: 0 24px; }
.navbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.navbar-right { display: flex; align-items: center; gap: 8px; }
.navbar-title { font-size: 18px; font-weight: 600; color: var(--fg); }
.navbar-breadcrumb { font-size: 12px; color: var(--muted); }
.navbar-btn { padding: 8px; border-radius: 8px; border: none; background: transparent; color: var(--muted); transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.navbar-btn:hover { background: var(--hover-bg); color: var(--fg); }
.search-box { display: flex; align-items: center; background: var(--hover-bg); border-radius: 8px; padding: 8px 12px; }
.search-box input { background: transparent; border: none; outline: none; font-size: 14px; color: var(--fg); width: 192px; margin-inline-start: 8px; }
.search-box input::placeholder { color: var(--muted); }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; border: none; background: transparent; cursor: pointer; }
.user-btn:hover { background: var(--hover-bg); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--shadow); }
.card-header { padding: 20px 24px 0; }
.card-title { font-size: 18px; font-weight: 700; color: var(--fg); }
.card-description { font-size: 14px; color: var(--muted); margin-top: 4px; }
.card-content { padding: 20px 24px; }
.card-footer { padding: 0 24px 20px; }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 20px; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--fg); }
.stat-card .stat-label { font-size: 14px; color: var(--muted); margin-top: 2px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--fg); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 8px; color: var(--fg); font-size: 14px; transition: border-color 0.2s; }
.form-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(30,58,95,0.1); }
.form-input::placeholder { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-input { min-height: 80px; resize: vertical; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; border: none; transition: all 0.2s; cursor: pointer; }
.btn-primary { background: var(--brand-primary); color: white; }
.btn-primary:hover { background: var(--brand-secondary); }
.btn-secondary { background: var(--hover-bg); color: var(--fg); border: 1px solid var(--card-border); }
.btn-secondary:hover { background: var(--input-bg); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover-bg); color: var(--fg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f3f4f6; color: #374151; }
.dark .badge-pending { background: #78350f20; color: #fbbf24; }
.dark .badge-approved { background: #065f4620; color: #34d399; }
.dark .badge-rejected { background: #991b1b20; color: #f87171; }
.dark .badge-cancelled { background: #37415120; color: #9ca3af; }

/* Tables */
.table-container { overflow-x: auto; border-radius: 12px; border: 1px solid var(--card-border); }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; text-align: start; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--hover-bg); border-bottom: 1px solid var(--card-border); }
td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--card-border); }
tr:hover { background: var(--hover-bg); }
tr:last-child td { border-bottom: none; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--card-border); margin-bottom: 16px; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--muted); border: none; background: transparent; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }
.dark .tab.active { color: var(--brand-accent); border-bottom-color: var(--brand-accent); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; animation: slideIn 0.3s ease; min-width: 300px; display: flex; align-items: center; gap: 8px; }
.toast-success { background: #065f46; color: white; }
.toast-error { background: #991b1b; color: white; }
.toast-info { background: var(--brand-primary); color: white; }

/* Auth Pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%); padding: 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); padding: 32px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--brand-primary); display: inline-flex; align-items: center; justify-content: center; color: var(--brand-accent); font-weight: bold; font-size: 20px; margin-bottom: 16px; }
.auth-title { font-size: 24px; font-weight: 700; color: var(--fg); }
.auth-subtitle { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* Empty State */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--muted); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; }
.avatar-lg { width: 80px; height: 80px; font-size: 32px; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: 100%; margin-top: 8px; min-width: 220px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); z-index: 50; padding: 8px; }
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; font-size: 14px; color: var(--fg); cursor: pointer; border: none; background: none; width: 100%; text-align: start; }
.dropdown-item:hover { background: var(--hover-bg); }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-divider { border-top: 1px solid var(--card-border); margin: 4px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb { background: #4b5563; }

/* Animations */
@keyframes slideIn { from { transform: translateX(10px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--card-border); border-top-color: var(--brand-primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }

/* RTL */
[dir="rtl"] .sidebar { border-inline-end: none; border-inline-start: 1px solid var(--sidebar-border); }
[dir="rtl"] .main-content { margin-inline-start: 0; margin-inline-end: 0; }
[dir="rtl"] .sidebar-nav a { padding-right: 12px; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(100%); }
    [dir="rtl"] .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-inline-start: 0 !important; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar { padding: 0 16px; }
    .card-content { padding: 16px; }
}

/* Print */
@media print {
    .sidebar, .navbar, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
}
