* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    padding: 20px;
}

.login-container {
    background: white;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 450px;
    width: 100%;
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    width: 180px;
    height: 60px;
    background: #1e5a8e;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 24px;
    font-weight: 700;
}

.logo-text {
    font-size: 14px;
    color: #666;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e5a8e;
    margin-bottom: 10px;
    text-align: center;
}

.login-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #1e5a8e;
    box-shadow: 0 0 0 4px rgba(30, 90, 142, 0.1);
}

.form-input.input-validation-error {
    border-color: #dc3545;
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    font-family: 'Tajawal', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(30, 90, 142, 0.3);
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

.validation-summary-errors ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e5a8e 0%, #2c7eb8 100%);
    color: white;
    padding: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 30px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 100px;
}

.sidebar-brand {
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}

.sidebar-logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
    white-space: nowrap;
}

.sidebar-subtitle {
    font-size: 13px;
    opacity: 0.8;
    white-space: nowrap;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 15px;
    white-space: nowrap;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.15);
    border-right: 4px solid white;
}

.sidebar-menu svg {
    margin-left: 12px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 15px;
}

.sidebar.collapsed .sidebar-menu svg {
    margin-left: 0;
}

.sidebar-menu .menu-text {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 280px;
    background: #f5f7fa;
    transition: margin-right 0.3s ease;
}

.main-content.sidebar-collapsed {
    margin-right: 80px;
}

.topbar {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.user-avatar-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e6ed;
}

.user-details {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.user-role {
    font-size: 13px;
    color: #666;
}

/* User Dropdown */
.user-dropdown-container {
    position: relative;
    cursor: pointer;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 1000;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #1e5a8e;
}

.dropdown-item.danger {
    color: #dc3545;
}

.dropdown-item.danger:hover {
    background: #fff5f5;
}

.dropdown-divider {
    height: 1px;
    background: #e0e6ed;
    margin: 8px 0;
}

.content-area {
    padding: 30px;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e5a8e;
    margin-bottom: 8px;
}

.page-subtitle {
    color: #666;
    font-size: 14px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s, border 0.3s;
    cursor: pointer;
    border: 3px solid transparent;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card.active {
    border-color: #1e5a8e;
    box-shadow: 0 8px 30px rgba(30, 90, 142, 0.2);
    transform: translateY(-3px);
}

.stat-card.active::after {
    content: '✓';
    position: absolute;
    top: 10px;
    left: 10px;
    background: #1e5a8e;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.stat-card {
    position: relative;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #fd7e14 0%, #ffa94d 100%);
}

.stat-icon.red {
    background: linear-gradient(135deg, #dc3545 0%, #e85d6a 100%);
}

.stat-details h3 {
    font-size: 32px;
    font-weight: 700;
    color: #1e5a8e;
    margin-bottom: 5px;
}

.stat-details p {
    color: #666;
    font-size: 14px;
}

/* Table */
.table-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.table-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e0e6ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.table-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e5a8e;
}

.filter-info {
    background: #e3f2fd;
    color: #1976d2;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 8px;
}

.filter-info.active {
    display: flex;
}

.filter-info .clear-filter {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    font-weight: bold;
    padding: 0 5px;
}

.table-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 40px 10px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    width: 250px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #1e5a8e;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 18px 25px;
    text-align: right;
    font-weight: 600;
    color: #1e5a8e;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.data-table th:hover {
    background: #e9ecef;
}

.data-table th .sort-icon {
    margin-right: 5px;
    opacity: 0.5;
}

.data-table th.sorted .sort-icon {
    opacity: 1;
}

.data-table td {
    padding: 18px 25px;
    border-top: 1px solid #e0e6ed;
    font-size: 14px;
    color: #333;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr.hidden {
    display: none;
}

.status-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-badge:hover {
    transform: scale(1.05);
}

.gender-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.gender-badge.male {
    background: #e3f2fd;
    color: #1565c0;
}

.gender-badge.female {
    background: #fce4ec;
    color: #c2185b;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon.view {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-icon.view:hover {
    background: #1976d2;
    color: white;
}

.btn-icon.delete {
    background: #ffebee;
    color: #d32f2f;
}

.btn-icon.delete:hover {
    background: #d32f2f;
    color: white;
}

/* Client Avatar */
.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #e0e6ed;
}

.client-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

/* Invoice View */
.invoice-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e6ed;
}

.invoice-logo-section {
    flex: 1;
}

.invoice-logo {
    width: 150px;
    height: 50px;
    background: #1e5a8e;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
}

.company-info {
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

.invoice-details {
    text-align: left;
}

.invoice-number {
    font-size: 32px;
    font-weight: 700;
    color: #1e5a8e;
    margin-bottom: 10px;
}

.invoice-date {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.party-info {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
}

.party-title {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.party-name {
    font-size: 18px;
    font-weight: 700;
    color: #1e5a8e;
    margin-bottom: 10px;
}

.party-details {
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

.invoice-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.btn-invoice {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-invoice.primary {
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    color: white;
}

.btn-invoice.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 90, 142, 0.3);
}

.btn-invoice.secondary {
    background: white;
    color: #1e5a8e;
    border: 2px solid #1e5a8e;
}

.btn-invoice.secondary:hover {
    background: #1e5a8e;
    color: white;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-right: 4px solid;
}

.toast.success {
    border-color: #28a745;
}

.toast.error {
    border-color: #dc3545;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon {
    background: #d4edda;
    color: #28a745;
}

.toast.error .toast-icon {
    background: #f8d7da;
    color: #dc3545;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Confirm Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff3cd;
    color: #856404;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-icon.danger {
    background: #f8d7da;
    color: #721c24;
}

.modal-icon.logout {
    background: #e3f2fd;
    color: #1565c0;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.modal-message {
    color: #666;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn.confirm {
    background: #dc3545;
    color: white;
}

.modal-btn.confirm:hover {
    background: #c82333;
}

.modal-btn.confirm.logout-confirm {
    background: #1e5a8e;
}

.modal-btn.confirm.logout-confirm:hover {
    background: #15436a;
}

.modal-btn.cancel {
    background: #e0e6ed;
    color: #333;
}

.modal-btn.cancel:hover {
    background: #ccd3db;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

/* Non-clickable stat card */
.stat-card.no-click {
    cursor: default;
}

.stat-card.no-click:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

/* Quick Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border: 2px solid #e0e6ed;
    border-radius: 25px;
    background: white;
    color: #666;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #1e5a8e;
    color: #1e5a8e;
}

.filter-btn.active {
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    border-color: #1e5a8e;
    color: white;
}

/* Date Range Filter */
.date-range-filter {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.date-range-filter label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.date-range-filter input[type="date"] {
    padding: 10px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s;
}

.date-range-filter input[type="date"]:focus {
    outline: none;
    border-color: #1e5a8e;
}

.date-range-filter .btn-apply {
    padding: 10px 24px;
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.date-range-filter .btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(30, 90, 142, 0.3);
}

.date-range-filter .btn-clear {
    padding: 10px 20px;
    background: white;
    color: #666;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.date-range-filter .btn-clear:hover {
    border-color: #dc3545;
    color: #dc3545;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-top: 1px solid #e0e6ed;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-size-selector label {
    font-size: 14px;
    color: #666;
}

.page-size-selector select {
    padding: 8px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.page-size-selector select:focus {
    outline: none;
    border-color: #1e5a8e;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    background: white;
    color: #666;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    text-decoration: none;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: #1e5a8e;
    color: #1e5a8e;
}

.page-btn.active {
    background: linear-gradient(135deg, #1e5a8e 0%, #2c7eb8 100%);
    border-color: #1e5a8e;
    color: white;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-ellipsis {
    padding: 0 10px;
    color: #999;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar .sidebar-brand {
        display: none;
        /* Hide logo text on tablet */
    }

    .sidebar .menu-text {
        display: none;
    }

    .sidebar .sidebar-menu a {
        justify-content: center;
        padding: 15px;
    }

    .sidebar .sidebar-menu svg {
        margin: 0;
    }

    .main-content {
        margin-right: 80px;
    }

    /* Ensure header looks ok collapsed */
    .sidebar-header {
        padding: 15px;
        justify-content: center;
    }

    .sidebar-toggle {
        margin: 0;
        align-self: center;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(100%);
        /* Start hidden on right (RTL) */
        right: 0;
        left: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }

    /* In mobile open, show branding */
    .sidebar.mobile-open .sidebar-brand,
    .sidebar.mobile-open .menu-text {
        display: block;
    }

    .sidebar.mobile-open .sidebar-menu a {
        justify-content: flex-start;
        padding: 15px 25px;
    }

    .sidebar.mobile-open .sidebar-menu svg {
        margin-left: 12px;
    }

    .sidebar-header {
        flex-direction: column;
        /* Stack logo and button */
        gap: 10px;
        align-items: center;
        text-align: center;
    }

    .sidebar-toggle {
        align-self: flex-end;
        /* Put toggle in corner */
    }

    .main-content {
        margin-right: 0;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .invoice-header,
    .invoice-parties {
        flex-direction: column;
        gap: 20px;
    }

    .invoice-details {
        text-align: right;
        margin-top: 10px;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input {
        width: 100%;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Mobile Toggle in Topbar */
    .topbar {
        padding: 15px;
    }

    .mobile-menu-btn {
        display: block !important;
    }
}

/* Base Styles Update for Header Overlap Issue */
.sidebar-header {
    display: flex;
    flex-direction: column;
    /* Stack vertically as requested */
    align-items: center;
    text-align: center;
    padding: 20px;
    gap: 15px;
}

.sidebar-toggle {
    align-self: flex-end;
    /* Top content (in RTL this relies on direction) */
}

/* Adjust collapsed state for desktop if needed */
.sidebar.collapsed .sidebar-header {
    padding: 15px;
}

.sidebar.collapsed .sidebar-toggle {
    align-self: center;
    margin: 0;
}


@media print {
    body>* {
        display: none !important;
    }

    /* Exceptions: Only show the modal overlay and its content */
    .modal-overlay.active,
    .modal-overlay.active .modal-content,
    .invoice-container {
        display: block !important;
        visibility: visible !important;
    }

    /* Ensure Modal takes full page */
    .modal-overlay.active {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        background: white;
        z-index: 9999;
        overflow: visible;
        padding: 0 !important;
        margin: 0 !important;
    }

    .modal-content {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .invoice-container {
        box-shadow: none !important;
        padding: 20px !important;
        /* Keep some padding for aesthetics */
        margin: 0 !important;
        width: 100% !important;
    }

    /* Elements to hide in print */
    .company-info,
    .user-id-print-hide,
    .modal-buttons,
    .btn-icon,
    button,
    .sidebar,
    .topbar,
    .invoice-actions,
    .logout-btn {
        display: none !important;
    }

    /* Reset main content margins just in case */
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Force single page if possible and remove background graphics */
    @page {
        size: auto;
        /* auto is the initial value */
        margin: 0mm;
        /* this affects the margin in the printer settings */
    }

    html,
    body {
        height: auto;
        overflow: visible;
        background: white;
    }
}