/* ===== FONT & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Tajawal', sans-serif;
    background: #f0f2f5;
    color: #1a202c;
    direction: rtl;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    right: 0; top: 0;
    width: 260px; height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow: hidden;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-brand { display: none; }

.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
    width: 44px; height: 44px; min-width: 44px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white;
}
.brand-name { font-size: 16px; font-weight: 700; color: #f1f5f9; display: block; }
.brand-sub { font-size: 11px; color: #94a3b8; }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 12px 0;
    scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.nav-section-title {
    font-size: 10px; font-weight: 600; color: #64748b;
    text-transform: uppercase; letter-spacing: 1.2px;
    padding: 16px 20px 6px;
}
.sidebar.collapsed .nav-section-title { display: none; }
.nav-item { margin: 2px 8px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    color: #94a3b8; text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 14px; font-weight: 400;
}
.nav-link i { font-size: 16px; min-width: 20px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.nav-link.active { background: linear-gradient(135deg, #3b82f6, #6366f1); color: white; font-weight: 500; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 10px;
}
.user-avatar {
    width: 38px; height: 38px; min-width: 38px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white; font-size: 16px;
}
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; display: block; }
.user-role { font-size: 11px; color: #64748b; }
.btn-logout {
    margin-right: auto;
    color: #ef4444; padding: 8px;
    border-radius: 8px; transition: background 0.2s;
}
.btn-logout:hover { background: rgba(239,68,68,0.15); }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-right: 260px;
    min-height: 100vh;
    transition: margin-right 0.3s ease;
}
.main-content.sidebar-collapsed { margin-right: 70px; }

/* ===== TOP BAR ===== */
.top-bar {
    background: white;
    padding: 0 24px;
    height: 64px;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid #e2e8f0;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.sidebar-toggle { background: none; border: none; font-size: 20px; color: #64748b; cursor: pointer; padding: 8px; border-radius: 8px; }
.sidebar-toggle:hover { background: #f1f5f9; }
.top-bar-title { font-size: 18px; font-weight: 700; color: #1e293b; flex: 1; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.current-time { font-size: 12px; color: #94a3b8; font-weight: 500; }

/* ===== CONTENT ===== */
.content-wrapper { padding: 24px; }

/* ===== CARDS ===== */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    background: white;
}
.card-header {
    background: white;
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0 !important;
    font-weight: 700; font-size: 16px;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    display: flex; align-items: center; gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.stat-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.red { background: #fef2f2; color: #ef4444; }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }
.stat-value { font-size: 28px; font-weight: 800; color: #1e293b; }
.stat-label { font-size: 13px; color: #94a3b8; font-weight: 500; }

/* ===== TABLES ===== */
.table { font-size: 14px; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; border-bottom: 2px solid #e2e8f0; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ===== BADGES ===== */
.badge-open { background: #fef3c7; color: #92400e; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.badge-completed { background: #dcfce7; color: #166534; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.badge-cancelled { background: #fee2e2; color: #991b1b; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.badge-incoming { background: #dbeafe; color: #1e40af; border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 600; }
.badge-outgoing { background: #fce7f3; color: #9d174d; border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 600; }

/* ===== FORMS ===== */
.form-control, .form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 14px;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-label { font-weight: 600; color: #374151; font-size: 14px; margin-bottom: 6px; }

/* ===== BUTTONS ===== */
.btn { border-radius: 10px; font-family: 'Tajawal', sans-serif; font-weight: 600; }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #6366f1); border: none; }
.btn-primary:hover { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); border: none; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); border: none; color: white; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); border: none; }

/* ===== WEIGHT FORM ===== */
.weight-form-card {
    background: white;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.weight-form-header {
    background: linear-gradient(135deg, #0f172a, #1e3a5f);
    padding: 24px 28px;
    color: white;
}
.weight-form-header h4 { font-size: 20px; font-weight: 700; margin: 0; }
.weight-form-header p { font-size: 13px; color: rgba(255,255,255,0.6); margin: 4px 0 0; }
.weight-display {
    background: #0f172a;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}
.weight-display .weight-number {
    font-size: 48px; font-weight: 800;
    color: #34d399; font-family: 'Tajawal', monospace;
}
.weight-display .weight-unit { font-size: 16px; color: #64748b; }

/* ===== TICKET / KARTA ===== */
.ticket {
    max-width: 400px; margin: 0 auto;
    background: white;
    border: 2px solid #1e293b;
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
}
.ticket-header {
    background: linear-gradient(135deg, #0f172a, #1e3a5f);
    color: white; text-align: center;
    padding: 16px;
}
.ticket-header h3 { font-size: 20px; font-weight: 800; margin: 0; }
.ticket-header .ticket-no { font-size: 14px; color: #94a3b8; margin-top: 4px; }
.ticket-body { padding: 16px; }
.ticket-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px dashed #e2e8f0;
    font-size: 14px;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row .label { color: #64748b; font-weight: 500; }
.ticket-row .value { font-weight: 700; color: #1e293b; }
.ticket-total {
    background: #0f172a; color: white;
    padding: 12px 16px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 16px; font-weight: 800;
}
.ticket-footer { padding: 12px 16px; text-align: center; background: #f8fafc; }
.ticket-footer p { font-size: 11px; color: #94a3b8; margin: 2px 0; }

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar, .top-bar, .no-print, .btn, .alert { display: none !important; }
    .main-content { margin-right: 0 !important; }
    .content-wrapper { padding: 0 !important; }
    .ticket { border: 2px solid black; max-width: 100%; }
    body { background: white; }
}

/* ===== ALERTS ===== */
.alert { border-radius: 12px; border: none; }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 24px; font-weight: 800; color: #1e293b; margin: 0; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: white; border-radius: 24px;
    padding: 40px 36px;
    width: 100%; max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
.login-icon { text-align: center; margin-bottom: 24px; }
.login-icon .icon-wrap {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 36px; color: white;
    box-shadow: 0 8px 25px rgba(59,130,246,0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-right: 0; }
}
