/* تحسين إضافي للجداول والبطاقات على الجوال */
@media (max-width: 768px) {
    /* إخفاء أعمدة رقمية أو ثانوية في الجداول */
    .table th:nth-child(1),
    .table td:nth-child(1),
    .table th:nth-child(4),
    .table td:nth-child(4),
    .table th:nth-child(5),
    .table td:nth-child(5),
    .table th:nth-child(6),
    .table td:nth-child(6),
    .table th:nth-child(7),
    .table td:nth-child(7) {
        display: none;
    }
    /* جعل أزرار الإجراءات تأخذ كامل العرض وتكون متباعدة */
    .action-btns {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    .action-btns .btn {
        min-width: 38px;
        min-height: 38px;
        font-size: 1.1rem;
        padding: 0.5rem 0.7rem;
    }
    /* تصغير حجم الجدول وتكبير النص */
    .table {
        font-size: 0.95rem;
    }
    .card-header, .card-title {
        font-size: 1.1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .search-filter-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    .form-group, .search-box {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .table th, .table td {
        padding: 0.3rem 0.2rem;
        font-size: 0.85rem;
    }
    .card {
        padding: 0.5rem;
    }
    .card-header, .card-title {
        font-size: 1rem;
    }
    .btn {
        font-size: 1rem;
        min-height: 38px;
        padding: 0.5rem 0.7rem;
    }
    .action-btns {
        gap: 0.3rem;
    }
}
/* 
 * نظام إدارة محطات الصرف الصحي
 * ملف التصميم الاحترافي المتجاوب 100%
 * يدعم الوضع الليلي والنهاري
 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --dark-text: #1e293b;
    --light-text: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.3s ease;
}

/* Responsive root font sizing for better scaling on phones */
html {
    font-size: 16px; /* base */
}

@media (max-width: 1200px) {
    html { font-size: 15px; }
}

@media (max-width: 768px) {
    /* smaller base on tablets */
    html { font-size: 14px; }
}

@media (max-width: 480px) {
    /* phones: slightly smaller but readable */
    html { font-size: 13px; }
}

/* الوضع الليلي */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --light-bg: #1e293b;
    --white: #0f172a;
    --dark-text: #f1f5f9;
    --light-text: #94a3b8;
    --border-color: #334155;
    --secondary-color: #475569;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* تحسين الخطوط العربية */
body, input, textarea, select, button {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Topbar */
.topbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Header layout helpers for mobile */
.topbar .topbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .left-block {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none; /* center-only branding, actions still clickable */
}

.mobile-logo .logo { pointer-events: auto; }

.right-block { margin-left: auto; }

.mobile-actions { display: flex; align-items: center; gap: 0.5rem; }

.btn-ghost {
    background: transparent;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-btn { min-width: 40px; min-height: 40px; font-size: 1.05rem; }

/* Ensure desktop keeps previous layout */
@media (min-width: 992px) {
    .mobile-logo { position: static; transform: none; pointer-events: auto; }
}

.topbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 1);
}

/* Sidebar Navigation */
.sidebar {
    background: var(--white);
    box-shadow: var(--shadow-md);
    padding: 1.5rem 0;
    margin: 1.5rem 0;
    border-radius: var(--radius-lg);
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--dark-text);
    text-decoration: none;
    transition: var(--transition);
    border-right: 3px solid transparent;
}

.nav-link:hover, .nav-link.active {
    background: linear-gradient(90deg, transparent 0%, rgba(37, 99, 235, 0.1) 100%);
    border-right-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.main-content {
    padding-bottom: 2rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* make cards visually squarish on small screens */
    aspect-ratio: 1 / 1;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--stat-color) 0%, transparent 100%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card.primary { --stat-color: var(--primary-color); }
.stat-card.success { --stat-color: var(--success-color); }
.stat-card.warning { --stat-color: var(--warning-color); }
.stat-card.danger { --stat-color: var(--danger-color); }
.stat-card.info { --stat-color: var(--info-color); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: white;
    background: var(--stat-color);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-text);
    line-height: 1;
    text-align: center;
}

.stat-label {
    color: var(--light-text);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.table th {
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.badge-info { background: rgba(6, 182, 212, 0.1); color: var(--info-color); }
.badge-secondary { background: rgba(100, 116, 139, 0.1); color: var(--secondary-color); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    justify-content: center;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-text);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    background: var(--white);
    color: var(--dark-text);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: var(--light-bg);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-right: 4px solid var(--success-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-right: 4px solid var(--danger-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-right: 4px solid var(--warning-color);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
    border-right: 4px solid var(--info-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--light-text);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.page-link {
    padding: 0.5rem 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--dark-text);
    text-decoration: none;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Search & Filter */
.search-filter-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
}

.login-title {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--light-text);
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    left: 1rem;
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--light-text);
    margin-bottom: 1rem;
}

.empty-state-text {
    color: var(--light-text);
    font-size: 1.125rem;
}

/* Action Buttons Group */
.action-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
}

@media (max-width: 768px) {
    .topbar-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .logo {
        justify-content: center;
    }
    
    .topbar-actions {
        justify-content: space-between;
    }
    
    /* On small tablets show up to 3 cards per row */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Mobile header adjustments */
    .topbar .topbar-content {
        flex-direction: row;
        align-items: center;
    }

    .mobile-logo { display: block; }

    .mobile-hamburger { display: inline-flex; }

    /* compact topbar actions on small screens */
    .topbar .topbar-actions { gap: 0.5rem; }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .search-filter-bar {
        flex-direction: column;
    }
    
    .search-box {
        width: 100%;
    }
    
    /* تحسين الأزرار على الموبايل */
    .btn {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        min-height: 44px; /* حجم لمس مناسب */
    }
    
    .btn-sm {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
        min-height: 40px;
    }
    
    /* تحسين الجداول على الموبايل */
    .table-responsive {
        border: none;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive table {
        margin-bottom: 0;
    }
    
    /* إخفاء أعمدة غير ضرورية على الموبايل */
    .hide-mobile {
        display: none !important;
    }
    
    /* تحسين النماذج على الموبايل */
    .form-control {
        font-size: 1rem;
        padding: 0.75rem;
        min-height: 44px;
    }
    
    /* تحسين البطاقات الإحصائية */
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
    }
    
    /* تحسين القائمة الجانبية على الموبايل */
    .offcanvas {
        width: 280px;
    }
    
    .offcanvas .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    /* تحسين التنبيهات */
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    /* make container effectively full width on small phones */
    .container {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .action-btns {
        flex-direction: column;
        width: 100%;
    }
    
    .action-btns .btn {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 0.5rem;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.375rem;
    }
    
    /* إخفاء المزيد من الأعمدة على الشاشات الصغيرة جداً */
    .hide-small {
        display: none !important;
    }
    
    /* تحسين الشعار */
    .logo {
        font-size: 1.25rem;
    }
    
    .logo-icon {
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
    }
    
    /* تحسين شريط العلوي */
    .topbar {
        padding: 0.5rem 0;
    }
    
    .user-info {
        padding: 0.25rem 0.5rem;
    }
    
    .user-avatar {
        width: 30px;
        height: 30px;
    }
    
    /* تحسين الأزرار في الجداول */
    .table .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Force 2-per-row stat cards on small phones for better readability */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        aspect-ratio: 1/1;
        padding: 0.5rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    /* Header: make actions compact and touch-friendly */
    .mobile-logo { left: 50%; }
    .mobile-hamburger { font-size: 1.1rem; }
    .mobile-actions .mobile-btn { padding: 0.45rem; }

    /* Improve table scrolling touch behaviour */
    .table-container {
        -webkit-overflow-scrolling: touch;
    }

    /* Reduce card header/footer spacing globally on phones */
    .card {
        padding: 0.75rem;
    }
}

/* Print Styles */
@media print {
    .topbar,
    .sidebar,
    .btn,
    .action-btns,
    .search-filter-bar {
        display: none !important;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }

/* Animations */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
