:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --danger-color: #ef476f;
    --dark-bg: #0f172a;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --header-gradient: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: #f8fafc;
    color: var(--text-main);
    line-height: 1.6;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background: var(--header-gradient);
    padding: 30px;
    border-radius: 20px;
    color: white;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px -5px rgba(67, 97, 238, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary { background: white; color: var(--primary-color); }
.btn-warning { background: #ffd166; color: #856404; }
.btn-danger { background: var(--danger-color); color: white; }
.btn-success { background: #06d6a0; color: white; }
.btn-secondary { background: var(--border-color); color: var(--text-main); }

/* Filter Section */
.filters-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 15px 45px 15px 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    outline: none;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    border-color: var(--primary-color);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filter-grid select {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #f1f5f9;
    outline: none;
}

/* Table Styles */
.table-responsive {
    background: white;
    border-radius: 20px;
    overflow-x: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    min-width: 1500px; /* Ensure table doesn't compress too much */
}

thead {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 12px 15px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    white-space: nowrap;
    border-left: 1px solid #f1f5f9;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    white-space: nowrap;
}

tr:hover {
    background-color: #f8fafc;
}

.compact-table td {
    padding: 8px 10px;
}

.compact-table input, .compact-table select {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    width: 100%;
}

/* Badges */
.badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 50%;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: slideDown 0.3s ease;
}

.modal-content.large {
    width: 90%;
}

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

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

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 13px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fdfdfd;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
    background: white;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.btn-remove {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #ef4444;
    color: white;
}

.modal-actions {
    margin-top: 15px;
}

.info-text {
    background: #f1f5f9;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content { flex-direction: column; text-align: center; gap: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .modal-content { width: 95%; }
}

/* Print Styles - Hard Reset for No Backgrounds */
@media print {
    @page {
        size: A3 landscape;
        margin: 10mm;
    }

    /* Hide UI Elements */
    header, .filters-section, .header-actions, #selectAll, .row-select, .btn, .modal, .btn-remove, .toast-container {
        display: none !important;
    }
    
    body {
        background: #fff !important;
        background-color: #fff !important;
        color: #000 !important;
        padding: 0;
        margin: 0;
        -webkit-print-color-adjust: economy !important;
        print-color-adjust: economy !important;
    }

    .dashboard-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .table-responsive {
        box-shadow: none !important;
        border: none !important;
        overflow: visible !important;
        background: transparent !important;
    }

    table {
        width: 100% !important;
        min-width: 100% !important;
        border: 1px solid #000 !important;
        border-collapse: collapse !important;
        background: transparent !important;
    }

    th, td {
        border: 1px solid #000 !important;
        font-size: 8pt !important;
        padding: 4px !important;
        white-space: normal !important;
        word-wrap: break-word;
        background: none !important;
        background-color: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    th {
        font-weight: bold !important;
        background-color: #eee !important; /* Subtle grey for header is usually acceptable, but let's go full white if requested */
        background: none !important; 
    }

    /* Remove all badge backgrounds */
    .badge, span, strong, b, i {
        background: transparent !important;
        background-color: transparent !important;
        color: #000 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    h1 {
        color: #000 !important;
        text-align: center;
        margin-bottom: 10px;
        font-size: 18pt;
    }
}

/* Toast Notifications - Top Centered Professional Design */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: auto;
    max-width: 90%;
}

.toast {
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(-150%);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-color);
    min-width: 350px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Unique Action Colors */
.toast-add { border-top: 4px solid #10b981; }      /* Green for Add */
.toast-edit { border-top: 4px solid #f59e0b; }     /* Orange/Yellow for Edit */
.toast-delete { border-top: 4px solid #ef4444; }   /* Red for Delete */
.toast-error { border-top: 4px solid #7f1d1d; }    /* Dark Red for System Error */

.toast i {
    font-size: 22px;
}

.toast-add i { color: #10b981; }
.toast-edit i { color: #f59e0b; }
.toast-delete i { color: #ef4444; }
.toast-error i { color: #7f1d1d; }

.toast span {
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
}
