/* Attendance Page Styles */

/* Upload Section */
.upload-section {
    padding: 40px 0;
    background: var(--bg-light);
}

.upload-card {
    background: var(--white);
    padding: 3rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: 600px;
    margin: 0 auto;
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.upload-icon svg {
    width: 40px;
    height: 40px;
}

.upload-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-size: 1.5rem;
}

.upload-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.upload-card .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.upload-card .btn svg {
    width: 20px;
    height: 20px;
}

.file-name {
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

/* Controls Section */
.attendance-controls {
    padding: 30px 0;
    background: var(--white);
    border-bottom: 2px solid var(--border-color);
}

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

.search-filter-group {
    display: flex;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 20px;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action svg {
    width: 18px;
    height: 18px;
}

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

/* Statistics Section */
.attendance-stats {
    padding: 40px 0;
    background: var(--bg-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
}

.stat-card.present {
    border-left-color: #10b981;
}

.stat-card.absent {
    border-left-color: #ef4444;
}

.stat-card.late {
    border-left-color: #f59e0b;
}

.stat-card.rate {
    border-left-color: var(--primary-color);
}

.stat-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.present .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-card.absent .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-card.late .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-card.rate .stat-icon {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
}

.stat-info h4 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.stat-info p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Table Section */
.attendance-table-section {
    padding: 40px 0 80px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h2 {
    color: var(--text-dark);
    font-size: 1.8rem;
}

.table-info {
    color: var(--text-light);
}

.table-info strong {
    color: var(--primary-color);
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    -webkit-overflow-scrolling: touch;
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

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

.attendance-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attendance-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.attendance-table tbody tr:hover {
    background: var(--bg-light);
}

.attendance-table td {
    padding: 1rem 0.75rem;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.attendance-table tbody tr:last-child {
    border-bottom: none;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.present {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.absent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-badge.late {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-badge.excused {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.status-badge.holiday,
.status-badge.weekoff,
.status-badge.other {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* Stat Numbers */
.stat-number {
    font-weight: 700;
    font-size: 1rem;
}

.stat-number.present {
    color: #10b981;
}

.stat-number.absent {
    color: #ef4444;
}

/* Attendance Rate */
.attendance-rate {
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
}

.attendance-rate.good {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.attendance-rate.poor {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Fixed columns for employee info */
.attendance-table th:nth-child(1),
.attendance-table th:nth-child(2),
.attendance-table th:nth-child(3) {
    position: sticky;
    left: 0;
    background: var(--primary-color);
    z-index: 10;
}

.attendance-table th:nth-child(2) {
    left: 60px;
}

.attendance-table th:nth-child(3) {
    left: 180px;
}

.attendance-table td:nth-child(1),
.attendance-table td:nth-child(2),
.attendance-table td:nth-child(3) {
    position: sticky;
    background: var(--white);
    z-index: 5;
}

.attendance-table td:nth-child(1) {
    left: 0;
    min-width: 60px;
}

.attendance-table td:nth-child(2) {
    left: 60px;
    min-width: 120px;
}

.attendance-table td:nth-child(3) {
    left: 180px;
    min-width: 150px;
}

.attendance-table tbody tr:hover td:nth-child(1),
.attendance-table tbody tr:hover td:nth-child(2),
.attendance-table tbody tr:hover td:nth-child(3) {
    background: var(--bg-light);
}

/* Date columns styling */
.attendance-table th:nth-child(n+4):nth-last-child(n+5) {
    text-align: center;
    min-width: 50px;
    white-space: nowrap;
}

.attendance-table td:nth-child(n+4):nth-last-child(n+5) {
    text-align: center;
    min-width: 50px;
}

/* Summary columns */
.attendance-table th:nth-last-child(-n+4) {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 700;
    min-width: 80px;
}

.attendance-table td:nth-last-child(-n+4) {
    font-weight: 600;
}

/* Scrollbar styling */
.table-wrapper::-webkit-scrollbar {
    height: 10px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

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

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.icon-btn.edit {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

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

.icon-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.icon-btn.delete:hover {
    background: #ef4444;
    color: var(--white);
}

/* Empty State */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.empty-state p {
    color: var(--text-light);
}

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

.modal-content {
    background: var(--white);
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.close-btn svg {
    width: 20px;
    height: 20px;
}

#attendanceForm {
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Toast Message */
.toast-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    z-index: 3000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

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

.toast-message.success {
    background: #10b981;
    color: var(--white);
}

.toast-message.error {
    background: #ef4444;
    color: var(--white);
}

/* Print Styles */
@media print {
    .navbar,
    .upload-section,
    .attendance-controls,
    .footer,
    .action-btns {
        display: none !important;
    }

    .attendance-stats {
        break-inside: avoid;
    }

    .attendance-table {
        border: 1px solid #000;
        font-size: 0.85rem;
    }

    .attendance-table th {
        background: #f0f0f0 !important;
        color: #000 !important;
    }

    .status-badge {
        border: 1px solid currentColor;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .controls-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .search-filter-group {
        flex-direction: column;
    }

    .action-buttons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .upload-card {
        padding: 2rem;
    }

    .upload-icon {
        width: 60px;
        height: 60px;
    }

    .upload-icon svg {
        width: 30px;
        height: 30px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-wrapper {
        border-radius: 5px;
    }

    .attendance-table {
        min-width: 1500px;
    }

    .attendance-table th,
    .attendance-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Sticky columns on mobile */
    .attendance-table th:nth-child(1) {
        left: 0;
        min-width: 50px;
    }

    .attendance-table th:nth-child(2) {
        left: 50px;
        min-width: 100px;
    }

    .attendance-table th:nth-child(3) {
        left: 150px;
        min-width: 120px;
    }

    .attendance-table td:nth-child(1) {
        left: 0;
        min-width: 50px;
    }

    .attendance-table td:nth-child(2) {
        left: 50px;
        min-width: 100px;
    }

    .attendance-table td:nth-child(3) {
        left: 150px;
        min-width: 120px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 20px;
    }

    #attendanceForm {
        padding: 1.5rem;
    }

    .btn-action {
        flex: 1;
        justify-content: center;
    }

    .action-buttons {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .upload-card h3 {
        font-size: 1.25rem;
    }

    .stat-info h4 {
        font-size: 1.5rem;
    }

    .attendance-table {
        min-width: 1200px;
        font-size: 0.8rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .attendance-table th:nth-child(n+4):nth-last-child(n+5) {
        min-width: 40px;
    }

    .attendance-table td:nth-child(n+4):nth-last-child(n+5) {
        min-width: 40px;
        padding: 0.5rem 0.25rem;
    }

    .icon-btn {
        width: 28px;
        height: 28px;
    }

    .icon-btn svg {
        width: 16px;
        height: 16px;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }
}
