/* ========== LOADING STATES ========== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== ACCESSIBILITY IMPROVEMENTS ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========== FOCUS STYLES ========== */
.btn-edit:focus,
.btn-details:focus,
.btn-delete:focus,
.filter-input:focus,
.filter-select:focus,
.dropdown-display:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========== ENHANCED RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .filter-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cards-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-filters {
        padding: var(--space-md);
        margin: 0 calc(var(--space-md) * -1) var(--space-lg);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .admin-table {
        font-size: var(--font-size-xs);
        min-width: 600px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: var(--space-sm);
    }
    
    .colored-badge,
    .status-badge,
    .posted-badge,
    .priority-badge {
        font-size: 10px;
        padding: 4px 8px;
        min-width: auto;
    }
    
    .actions {
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }
    
    .btn-edit,
    .btn-details,
    .btn-delete {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .header-container {
        padding: 0 var(--space-md);
        height: 60px;
    }
    
    .brand-text h1 {
        font-size: var(--font-size-lg);
    }
    
    .main-nav {
        gap: var(--space-sm);
    }
    
    .nav-button span {
        display: none;
    }
    
    .user-name {
        display: none;
    }
    
    .content-wrapper {
        padding: var(--space-lg) var(--space-md);
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .auth-card {
        padding: var(--space-xl);
    }
    
    .form-grid,
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .date-range-inputs {
        grid-template-columns: 1fr;
    }
    
    .form-actions,
    .filter-actions {
        flex-direction: column;
    }
    
    .btn-secondary,
    .btn-primary {
        width: 100%;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: var(--space-md);
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .section-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .filter-group {
        justify-content: space-between;
        width: 100%;
    }
    
    /* Dashboard responsive */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
    
    .employee-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
    
    .stats-inline {
        flex-direction: column;
    }
    
    .cards-row {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .dashboard-card {
        padding: var(--space-lg);
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }
    
    .card-content h3 {
        font-size: var(--font-size-base);
    }
    
    .quick-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .color-palette {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .account-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        min-width: 500px;
    }
    
    .dropdown-options {
        max-height: 150px;
    }
    
    .modal-content {
        width: 95%;
        margin: var(--space-md);
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .action-buttons {
        gap: var(--space-md);
    }
    
    .action-button {
        padding: var(--space-md) var(--space-lg);
        font-size: var(--font-size-base);
    }
    
    .assignment-form,
    .filter-form {
        padding: var(--space-lg);
    }
    
    .modal-body {
        padding: var(--space-lg);
    }
    
    .admin-section {
        padding: var(--space-lg);
    }
    
    .results-count {
        align-self: stretch;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
    
    .dashboard-card .card-icon {
        width: 50px;
        height: 50px;
        font-size: var(--font-size-lg);
    }
    
    .quick-buttons {
        grid-template-columns: 1fr;
    }
    
    .color-palette {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .custom-color {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
    
    .table-container {
        margin: 0 calc(var(--space-lg) * -1);
        border-radius: 0;
    }
    
    /* Employee Status Responsive Adjustments */
    .employee-status-item {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .employee-status-item .form-select {
        margin-top: var(--space-sm);
    }
    
    .employee-completion-item {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .table-filters,
    .actions,
    .section-header,
    .modal {
        display: none !important;
    }
    
    .admin-table {
        border: 1px solid #000;
    }
    
    .admin-table th,
    .admin-table td {
        border: 1px solid #000;
        color: #000 !important;
        background: #fff !important;
    }
    
    .colored-badge,
    .status-badge,
    .posted-badge,
    .priority-badge {
        color: #000 !important;
        background: #fff !important;
        border: 1px solid #000 !important;
    }
}