html {
    color-scheme: light !important;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
    min-width: 200px;
    max-width: 1000px;
    margin: 0 auto;
    margin-top: 120px !important;
    margin-bottom: 220px !important;
    min-height: 100vh;
    background: #125057 !important;
    padding: 16px;
}

/* ===== نافذة التحميل ===== */
#loadingOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#loadingOverlay.show {
    display: flex;
    opacity: 1;
}

.loading-box {
    background: white;
    border-radius: 24px;
    padding: 40px 35px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.loading-spinner-custom {
    width: 60px;
    height: 60px;
    border: 5px solid #e8f0f8;
    border-top: 5px solid #1a4b6b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-box h3 {
    color: #0b2a40;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}

.loading-box p {
    color: #4a7a9c;
    font-size: 14px;
    font-weight: 500;
}

.loading-box .loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* ===== الهيدر ===== */
.header {
    background: linear-gradient(145deg, #0c666b, #2bc7d9) !important;
    border-radius: 20px 10px 20px 10px;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
    gap: 10px;
}
.header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.company-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
}
.company-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.company-name {
    color: white !important;
    font-size: 24px !important;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    text-shadow: 2px 2px 1px rgba(0, 0, 0, 0.4);
}
.app-name {
    color: #FFD985 !important;
    font-size: 14px;
    font-weight: 700;
}
.app-name span {
    color: #ffffff !important;
}
.header .count-badge {
    background: #004d59 !important;
    color: #d9d9d9 !important;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
}

/* ===== شريط البحث ===== */
.search-bar {
    background: #208796 !important;
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.search-bar .month-select {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white !important;
    font-weight: 600;
    font-size: 10px;
}
.search-bar .month-select select {
    padding: 10px 12px;
    height: 35px;
    line-height: 35px;
    border-radius: 50px;
    border: none;
    background: #CCF3FF !important;
    font-size: 13px;
    font-weight: 600;
    color: #292626 !important;
    outline: none;
    cursor: pointer;
}
.search-bar .search-input-wrap {
    height: 35px;
    flex: 1;
    display: flex;
    align-items: center;
    background: #EDFBFF !important;
    border-radius: 50px;
    padding: 0 16px;
    min-width: 150px;
}
.search-bar .search-input-wrap input {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: #0b2a40;
}
.search-bar .search-input-wrap input::placeholder {
    color: #999;
}
.search-bar .search-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #1c6675, #16798c) !important;
    border: none;
    border-radius: 50%;
    color: white !important;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.search-bar .search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.search-bar .search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.search-bar .clear-btn {
    width: 44px;
    height: 44px;
    background: #383838 !important;
    border: none;
    border-radius: 50%;
    color: white !important;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.search-bar .clear-btn:hover {
    background: #5a6268 !important;
}

/* ===== جدول البيانات ===== */
.data-container {
    background: white !important;
    background-color: white !important;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    margin-bottom: 20px;
}
.data-container .table-header {
    color: white !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}
.data-container .table-header h3 {
    color: #0b2a40 !important;
    font-size: 18px;
    font-weight: 700;
}
.data-container .table-header h3 i {
    color: #eb7602 !important;
    margin-left: 8px;
}
.data-container .table-header .count {
    background: #135961 !important;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 13px;
    color: #FFF5CF !important;
    font-weight: 600;
}
.table-wrapper {
    background: white !important;
    background-color: white !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 500px;
}
table thead {
    background: linear-gradient(145deg, #0c666b, #16a1a8) !important;
    color: #D4F5FF !important;
}
table thead th {
    padding: 10px 12px;
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
table tbody tr {
    border-bottom: 1px solid #e8f0f8 !important;
    transition: background 0.2s;
    cursor: pointer;
}
table tbody tr:hover {
    background: #f0f8ff !important;
}
table tbody td {
    padding: 8px 12px;
    color: #1a3a4a !important;
    font-size: 12px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
table tbody td .employee-name-link {
    color: #1a4b6b !important;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}
table tbody td .employee-name-link:hover {
    border-bottom-color: #1a4b6b !important;
}
.status-badge {
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}
.status-badge.present {
    background: #d4edda !important;
    color: #155724 !important;
}
.status-badge.absent {
    background: #f8d7da !important;
    color: #721c24 !important;
}
.status-badge.late {
    background: #fff3cd !important;
    color: #856404 !important;
}
.status-badge.leave {
    background: #cce5ff !important;
    color: #004085 !important;
}

.loading-spinner {
    text-align: center;
    padding: 30px 20px;
}
.loading-spinner i {
    font-size: 30px;
    color: #1a4b6b !important;
    animation: spin 1s linear infinite;
}

/* ===== الأيام ===== */
.days-container {
    background: #19888c !important;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}
.days-container .section-title {
    color: #5cd6ff !important;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.days-container .section-title i {
    color: #f7d44a !important;
}
.days-container .section-title .sub {
    font-size: 11px;
    color: #DBF1FF !important;
    font-weight: 400;
    margin-right: auto;
}
.days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}
.day-card {
    background: #f8fcff !important;
    border: 2px solid #e8f0f8 !important;
    border-radius: 8px;
    padding: 5px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.day-card:hover {
    border-color: #1a4b6b !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.day-card.active {
    border-color: #1a4b6b !important;
    background: #e8f4fd !important;
}
.day-card .date {
    font-size: 12px;
    font-weight: 700;
    color: #0b2a40;
}
.day-card .day-name {
    font-size: 9px;
    color: #4a7a9c !important;
    margin-top: 4px;
}
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: white !important;
    grid-column: 1/-1;
}
.empty-state i {
    font-size: 40px;
    color: #dce8f2 !important;
    margin-bottom: 10px;
    display: block;
}

/* ===== نتائج البحث ===== */
.search-results {
    background: #f5f5f5 !important;
    background-color: #f5f5f5 !important;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-top: 20px;
    display: none;
}
.search-results.show {
    display: block;
}
.search-results .result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid white !important;
    flex-wrap: wrap;
    gap: 10px;
}
.search-results .result-header h3 {
    color: #0b2a40 !important;
    font-size: 18px;
    font-weight: 700;
}
.search-results .result-header h3 i {
    color: #28a745 !important;
    margin-left: 8px;
}

.employee-card {
    background: #e8f4fd !important;
    border: 2px solid #1a4b6b !important;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.employee-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #cde0ec !important;
}
.employee-photo-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1a4b6b !important;
    background: white !important;
}
.employee-photo-placeholder {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #e8f0f8 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #1a4b6b !important;
}
.employee-photo-placeholder i {
    font-size: 40px;
    color: #4a7a9c !important;
}
.employee-info-summary {
    flex: 1;
}
.employee-name-title {
    font-size: 22px;
    font-weight: 800;
    color: #0b2a40 !important;
    margin: 0;
}
.employee-job-title {
    font-size: 14px;
    color: #4a7a9c;
    font-weight: 600;
}
.employee-card .info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2px;
    text-align: center;
}
.employee-card .info-item {
    display: flex;
    flex-direction: column;
}
.employee-card .info-item .label {
    font-size: 10px;
    color: #4a7a9c !important;
    font-weight: 600;
    text-transform: uppercase;
}
.employee-card .info-item .value {
    font-size: 12px;
    font-weight: 700;
    color: #0b2a40 !important;
}
.employee-card .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1px;
    padding-top: 10px;
    text-align: center;
}
.employee-card .stats-grid .stat-number {
    font-size: 14px;
    font-weight: 800;
    color: #0b2a40 !important;
}
.employee-card .stats-grid .stat-label {
    font-size: 10px;
    color: #4a7a9c !important;
    font-weight: 600;
    text-transform: uppercase;
}

.days-summary-table {
    width: 90%;
    border-collapse: collapse;
    font-size: 12px;
}
.days-summary-table thead {
    background: #005973 !important;
    color: white !important;
}
.days-summary-table thead th {
    padding: 10px 14px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.days-summary-table tbody tr {
    border-bottom: 1px solid #e8f0f8;
    transition: background 0.2s;
}
.days-summary-table tbody tr:hover {
    background: #f0f8ff !important;
}
.days-summary-table tbody td {
    padding: 10px 14px;
    color: #1a3a4a !important;
    font-size: 13px;
}
.no-results {
    text-align: center;
    padding: 30px 20px;
    color: #4a7a9c !important;
}
.no-results i {
    font-size: 40px;
    color: #dce8f2 !important;
    margin-bottom: 10px;
    display: block;
}

@media (max-width: 480px) {
    body { padding: 10px; }
    .header { padding: 14px 16px; }
    .company-logo { width: 35px; height: 35px; }
    .company-name { font-size: 13px; }
    .app-name { font-size: 15px; }
    .search-bar { flex-direction: row; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
    .search-bar .month-select { font-size: 12px; flex: 1; min-width: 100px; }
    .search-bar .month-select select { padding: 6px 10px; font-size: 12px; }
    .search-bar .search-input-wrap { min-width: 120px; flex: 2; }
    .search-bar .search-input-wrap input { font-size: 13px; padding: 8px 0; }
    .search-bar .search-btn,
    .search-bar .clear-btn { width: 38px; height: 38px; font-size: 15px; }
    .days-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
    .day-card { padding: 10px 8px; }
    .day-card .date { font-size: 13px; }
    .data-container { padding: 14px; }
    table { font-size: 11px; min-width: 350px; }
    table thead th,
    table tbody td { padding: 6px 8px; }
    .employee-card { padding: 12px 14px; }
    .employee-card .info-grid { grid-template-columns: 1fr 1fr; gap: 5px; }
    .employee-card .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
    .employee-card .stats-grid .stat-number { font-size: 16px; }
    .days-summary-table { font-size: 12px; }
    .days-summary-table thead th,
    .days-summary-table tbody td { padding: 8px 10px; }
    .employee-card-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .employee-photo-img,
    .employee-photo-placeholder {
        width: 60px;
        height: 60px;
    }
    .employee-name-title {
        font-size: 18px;
    }
}
@media (max-width: 360px) {
    .search-bar .month-select { min-width: 80px; font-size: 11px; }
    .search-bar .month-select select { font-size: 11px; padding: 5px 8px; }
    .search-bar .search-input-wrap { min-width: 80px; }
    .search-bar .search-input-wrap input { font-size: 12px; }
    .search-bar .search-btn,
    .search-bar .clear-btn { width: 34px; height: 34px; font-size: 13px; }
    .days-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); gap: 6px; }
    .day-card .date { font-size: 11px; }
    .employee-card .info-grid { grid-template-columns: 1fr; }
    .employee-card .stats-grid { grid-template-columns: 1fr 1fr; }
}