:root {
    --primary: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--background);
    color: var(--text);
    margin: 0;
    direction: rtl;
}

.main-header {
    background: var(--surface);
    padding: 1rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-header .top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary);
}

.logo p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--secondary);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.date-selector {
    display: flex;
    gap: 0.5rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

select,
input,
button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-family: inherit;
}

button {
    cursor: pointer;
    border: none;
    color: white;
    font-weight: 500;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: var(--secondary);
}

.btn-success {
    background-color: var(--success);
}

.btn-danger {
    background-color: var(--danger);
}

.btn-warning {
    background-color: var(--warning);
}

.btn-info {
    background-color: #3b82f6;
}

.search-box input {
    width: 250px;
}

.content {
    padding: 2rem;
}

.table-container {
    background: var(--surface);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #f8fafc;
    font-weight: 600;
}

tr:hover {
    background-color: #f8fafc;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-paid {
    background-color: #dcfce7;
    color: #166534;
}

.badge-unpaid {
    background-color: #fee2e2;
    color: #991b1b;
}

.actions-cell button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin-left: 0.2rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.large-modal {
    max-width: 800px;
}

.close {
    position: absolute;
    left: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
}

.negative-salary {
    color: var(--danger);
    font-weight: bold;
}

/* Calendar Modal */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.calendar-day {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
    font-weight: bold;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.calendar-day.header {
    background: #f0f0f0;
    cursor: default;
    font-size: 0.9em;
}

.calendar-day:hover:not(.header) {
    border-color: #aaa;
    transform: scale(1.02);
}

/* Status Colors */
.status-present {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.status-absent {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.status-holiday {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.status-off {
    background-color: #f8f9fa;
    color: #6c757d;
}

.status-annual_leave {
    background-color: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* Legend */
.calendar-legend {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.legend-box {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

/* Print Styles */
.print-only {
    display: none;
}

@media print {
    .print-only {
        display: table-cell !important;
    }

    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .content {
        padding: 0;
    }

    .table-container {
        box-shadow: none;
    }

    /* Compact print styles */
    body {
        font-size: 12px;
        /* Smaller font */
    }

    th,
    td {
        padding: 4px !important;
        /* Smaller padding */
        border-bottom: 1px solid #000;
    }

    h1 {
        font-size: 1.2rem;
        margin: 5px 0;
    }

    p {
        font-size: 0.8rem;
        margin: 0;
    }

    /* Remove signature area */
    tfoot::after {
        display: none !important;
    }
}