:root {
    --primary-color: #0ea5e9;
    --primary-dark: #0284c7;
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

@font-face {
    font-family: 'Jameel Noori Nastaleeq';
    src: local('Jameel Noori Nastaleeq');
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Poppins', sans-serif; font-weight: 600; }

/* The Urdu Class for bilingual text */
.urdu-text { font-family: 'Jameel Noori Nastaleeq', Arial, sans-serif; font-size: 1.25rem; line-height: 1.6; direction: rtl; }

/* LAYOUT */
#app-container { display: flex; width: 100%; }

/* Sidebar Navigation */
#sidebar {
    width: 260px; background-color: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; transition: all 0.3s;
    position: fixed; height: 100vh; z-index: 1000;
}
#sidebar .brand { padding: 20px; font-size: 22px; font-family: 'Poppins'; font-weight: 700; color: #fff; text-align: center; border-bottom: 1px solid var(--sidebar-hover); }
#sidebar .nav-links { flex: 1; padding: 15px 0; overflow-y: auto; }
#sidebar .nav-links a { display: flex; align-items: center; padding: 12px 20px; color: var(--sidebar-text); text-decoration: none; font-size: 15px; transition: 0.2s; }
#sidebar .nav-links a:hover, #sidebar .nav-links a.active { background-color: var(--sidebar-hover); color: var(--sidebar-text-active); border-left: 4px solid var(--primary-color); }
#sidebar .nav-links a svg { margin-right: 12px; width: 20px; height: 20px; }

/* Main Content Area */
#main-content {
    flex: 1; margin-left: 260px; display: flex; flex-direction: column; transition: margin-left 0.3s; width: calc(100% - 260px);
}

/* Header */
header.app-header {
    background: var(--card-bg); height: 60px; padding: 0 20px; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 900;
}
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-main); }
.header-actions { display: flex; align-items: center; gap: 15px; }
.user-profile { font-weight: 500; display: flex; align-items: center; gap: 8px; font-size:14px; }

/* Page Content Window */
.page-wrapper { padding: 25px; flex: 1; overflow-y: auto; }

/* Unified Required Footer */
footer.hardcoded-footer {
    background: var(--sidebar-bg); color: #94a3b8; text-align: center; padding: 20px; margin-top: auto;
    font-size: 14px; line-height: 1.6; border-top: 1px solid var(--sidebar-hover);
}
footer.hardcoded-footer a { color: var(--primary-color); text-decoration: none; font-weight: bold; }
footer.hardcoded-footer a:hover { text-decoration: underline; }

/* Utility Classes */
.card { background: var(--card-bg); border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.02); border: 1px solid var(--border-color); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 16px; margin-bottom: 15px; color: var(--text-main); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.btn { padding: 8px 16px; border-radius: 6px; font-size: 14px; font-family: 'Poppins', sans-serif; font-weight: 500; cursor: pointer; border: none; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: 0.2s;}
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Forms & Tables */
.form-group { margin-bottom: 15px; }
.form-control { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-family: 'Montserrat'; outline: none; }
.form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
table th, table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-color); }
table th { background: #f8fafc; font-family: 'Poppins'; font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 12px; }
table tr:hover { background: #f1f5f9; }

/* Badges */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce3; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Mobile Responsiveness (Less than 992px) */
@media (max-width: 992px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.active { transform: translateX(0); }
    #main-content { margin-left: 0; width: 100%; }
    .menu-toggle { display: block; }
    
    /* Smart stackable mobile cards for tables */
    .mobile-smart-table table, .mobile-smart-table thead, .mobile-smart-table tbody, .mobile-smart-table th, .mobile-smart-table td, .mobile-smart-table tr { display: block; }
    .mobile-smart-table thead tr { position: absolute; top: -9999px; left: -9999px; }
    .mobile-smart-table tr { border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 15px; padding: 10px; background: #fff; }
    .mobile-smart-table td { border: none; border-bottom: 1px solid #f1f5f9; position: relative; padding-left: 50%; min-height: 40px; text-align: right; }
    .mobile-smart-table td:last-child { border-bottom: 0; }
    /* Inject label from data-label attr */
    .mobile-smart-table td:before { position: absolute; top: 12px; left: 10px; width: 45%; padding-right: 10px; white-space: nowrap; font-weight: 600; color: var(--text-muted); text-align: left; content: attr(data-label); font-family: 'Poppins', sans-serif; font-size:12px; }
}
