/* Mobile Responsive Fixes for VCM QR Scanner */

/* Base responsive improvements */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-size: 16px; /* Prevent zoom on iOS */
}

body {
    min-width: 320px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fix for iOS Safari viewport issues */
@supports (-webkit-touch-callout: none) {
    .hero-bg {
        min-height: -webkit-fill-available;
    }
}

/* Improved viewport handling */
@viewport {
    width: device-width;
    initial-scale: 1;
}

/* Navigation Mobile Fixes */
.navbar-mobile {
    padding: 0.5rem 1rem;
}

.nav-logo {
    font-size: 0.875rem !important;
    line-height: 1.25rem;
}

@media (min-width: 640px) {
    .nav-logo {
        font-size: 1.125rem !important;
        line-height: 1.75rem;
    }
}

@media (min-width: 1024px) {
    .nav-logo {
        font-size: 1.25rem !important;
        line-height: 1.75rem;
    }
}

/* Mobile Menu Improvements */
#mobile-menu {
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 60;
    display: none; /* Start hidden */
}

#mobile-menu:not(.hidden) {
    display: block !important;
}

#mobile-menu.hidden {
    display: none !important;
}

.mobile-dropdown-content {
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    border-left: 3px solid #dc2626;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

.mobile-dropdown-content a {
    position: relative;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
    margin-left: 0.5rem;
}

.mobile-dropdown-content a:hover {
    border-left-color: #dc2626;
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.05) 0%, transparent 100%);
    transform: translateX(4px);
}

.mobile-dropdown-content a:before {
    content: '•';
    color: #dc2626;
    font-weight: bold;
    margin-right: 0.5rem;
    opacity: 0.7;
}

.mobile-dropdown-content a:hover:before {
    opacity: 1;
    transform: scale(1.2);
}

/* Enhanced mobile dropdown button */
.mobile-dropdown-btn {
    position: relative;
    transition: all 0.3s ease;
}

.mobile-dropdown-btn:hover {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.05) 0%, transparent 100%);
}

.mobile-dropdown-btn i {
    transition: all 0.3s ease;
}

.mobile-dropdown-btn[aria-expanded="true"] {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.1) 0%, transparent 100%);
    border-left: 3px solid #dc2626;
    padding-left: 0.75rem;
}

.mobile-dropdown-btn[aria-expanded="true"] i {
    color: #dc2626;
    transform: rotate(180deg);
}

/* Enhanced mobile menu items */
.mobile-menu-item {
    position: relative;
    transition: all 0.3s ease;
}

.mobile-menu-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.mobile-menu-item i {
    transition: all 0.3s ease;
}

.mobile-menu-item:hover i {
    transform: scale(1.1);
    color: #dc2626 !important;
}

/* Improved mobile menu container */
#mobile-menu .px-4 {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

/* Add subtle animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-item {
    animation: fadeInUp 0.3s ease-out;
}

.mobile-menu-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-item:nth-child(2) { animation-delay: 0.2s; }
.mobile-menu-item:nth-child(3) { animation-delay: 0.3s; }
.mobile-menu-item:nth-child(4) { animation-delay: 0.4s; }
.mobile-menu-item:nth-child(5) { animation-delay: 0.5s; }

/* Enhanced dropdown content styling */
.mobile-dropdown-content {
    border: 1px solid #e5e7eb;
    margin: 0.5rem 0;
    padding: 0.5rem 0;
}

.mobile-dropdown-content a {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    margin: 0.125rem 0.5rem;
    border-radius: 0.375rem;
}

/* Improved visual hierarchy */
.mobile-dropdown {
    margin: 0.25rem 0;
}

.mobile-dropdown-btn {
    font-weight: 500;
}

/* Better touch feedback */
.touch-target:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Responsive improvements for different mobile screen sizes */
@media (max-width: 480px) {
    #mobile-menu .px-4 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .mobile-menu-item,
    .mobile-dropdown-btn {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .mobile-dropdown-content a {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .mobile-menu-item i,
    .mobile-dropdown-btn i {
        margin-right: 0.5rem;
        font-size: 0.875rem;
    }
    
    .mobile-dropdown-content a:before {
        margin-right: 0.25rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    #mobile-menu {
        background: #1f2937;
        border-color: #374151;
    }
    
    .mobile-menu-item,
    .mobile-dropdown-btn {
        color: #f3f4f6;
    }
    
    .mobile-menu-item:hover,
    .mobile-dropdown-btn:hover {
        background: rgba(220, 38, 38, 0.1);
        color: #fca5a5;
    }
    
    .mobile-dropdown-content {
        background: #374151;
        border-color: #4b5563;
    }
    
    .mobile-dropdown-content a {
        color: #d1d5db;
    }
    
    .mobile-dropdown-content a:hover {
        color: #fca5a5;
        background: rgba(220, 38, 38, 0.1);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu-item,
    .mobile-dropdown-content,
    .mobile-dropdown-btn i,
    .touch-target {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mobile-dropdown-content {
        border-width: 2px;
        border-color: #000;
    }
    
    .mobile-dropdown-content a:before {
        color: #000;
        font-weight: 900;
    }
}

/* Enhanced Mobile Menu Button */
#mobile-menu-btn {
    position: relative;
    z-index: 70;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mobile-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#mobile-menu-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

#mobile-menu-btn:active {
    transform: scale(0.95);
}

#mobile-menu-btn i {
    transition: transform 0.3s ease;
    font-size: 1.25rem;
    pointer-events: none; /* Prevent icon from blocking clicks */
}

/* Mobile Menu Animation - Simplified */
#mobile-menu {
    transition: all 0.3s ease;
}

#mobile-menu:not(.hidden) {
    animation: slideDown 0.3s ease-out;
}

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

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Improve mobile touch targets */
.nav-link, .mobile-dropdown-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.mobile-dropdown-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
}

.mobile-dropdown-btn:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

/* Mobile Navigation Fixes */
.navbar-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Navigation Container */
@media (max-width: 767px) {
    .nav-logo {
        font-size: 0.875rem !important;
        line-height: 1.25rem;
    }
    
    .container-responsive {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure mobile menu is properly positioned */
    #mobile-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        z-index: 60;
    }
    
    /* Force visibility when not hidden */
    #mobile-menu:not(.hidden) {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ensure proper stacking */
    nav {
        position: relative;
        z-index: 50;
    }
}

/* Hero Section Mobile Fixes */
.hero-bg {
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    padding-top: 6rem;
    padding-bottom: 2rem;
    position: relative;
}

.hero-content {
    padding: 0 1rem;
}

.hero-content h1 {
    font-size: 2.5rem;
    line-height: 1.1;
    word-break: break-word;
    hyphens: auto;
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1rem;
        line-height: 1.5;
    }
}

@media (min-width: 640px) {
    .hero-content h1 {
        font-size: 3rem;
    }
}

@media (min-width: 768px) {
    .hero-content h1 {
        font-size: 3.75rem;
    }
}

@media (min-width: 1024px) {
    .hero-content h1 {
        font-size: 5rem;
    }
}

@media (min-width: 1280px) {
    .hero-content h1 {
        font-size: 8rem;
    }
}

/* Card Grid Responsive */
.responsive-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Form Responsive */
.form-responsive {
    width: 100%;
    max-width: none;
}

@media (min-width: 640px) {
    .form-responsive {
        max-width: 28rem;
    }
}

/* Input field improvements for mobile */
input, textarea, select {
    font-size: 16px !important; /* Prevent zoom on iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Login form mobile fixes */
.login-form input {
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 16px;
}

.login-form button {
    padding: 0.875rem 1rem;
    font-size: 16px;
    border-radius: 0.75rem;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.table-responsive table {
    min-width: 600px;
    width: 100%;
}

/* Button Responsive */
.btn-responsive {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    width: 100%;
}

@media (min-width: 640px) {
    .btn-responsive {
        width: auto;
        font-size: 1rem;
    }
}

/* Sidebar Mobile Fixes */
@media (max-width: 1023px) {
    .sidebar-mobile {
        position: fixed;
        top: 0;
        left: -100%;
        width: 16rem;
        height: 100vh;
        height: -webkit-fill-available; /* iOS Safari fix */
        z-index: 50;
        transition: left 0.3s ease-in-out;
        background: white;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar-mobile.open {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        height: -webkit-fill-available; /* iOS Safari fix */
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .main-content-mobile {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Prevent body scroll when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* Dashboard Cards Mobile */
.dashboard-card {
    padding: 1rem;
    border-radius: 0.75rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .dashboard-card {
        padding: 1.5rem;
    }
}

/* Stats Grid Mobile */
.stats-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Modal Mobile Fixes */
.modal-mobile {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
    .modal-mobile {
        margin: 3rem auto;
        max-width: 32rem;
    }
}

/* Text Responsive */
.text-responsive-sm {
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .text-responsive-sm {
        font-size: 1rem;
    }
}

.text-responsive-lg {
    font-size: 1.125rem;
}

@media (min-width: 640px) {
    .text-responsive-lg {
        font-size: 1.25rem;
    }
}

@media (min-width: 1024px) {
    .text-responsive-lg {
        font-size: 1.5rem;
    }
}

/* Image Responsive */
.img-responsive {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Container Responsive */
.container-responsive {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 640px) {
    .container-responsive {
        max-width: 640px;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 768px) {
    .container-responsive {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container-responsive {
        max-width: 1024px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .container-responsive {
        max-width: 1280px;
    }
}

/* Touch Improvements */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scroll Improvements */
.scroll-smooth {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Focus Improvements for Mobile */
.focus-mobile:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading States */
.loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-full-width {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .high-dpi-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        background-color: #1f2937;
        color: #f9fafb;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Landscape Mobile Fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-bg {
        min-height: auto;
        padding-top: 4rem;
        padding-bottom: 1rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
}

/* Very Small Screens */
@media (max-width: 320px) {
    .container-responsive {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .nav-logo {
        font-size: 0.75rem !important;
    }
}

/* Large Screens */
@media (min-width: 1536px) {
    .container-responsive {
        max-width: 1536px;
    }
}
/* Additional Mobile Browser Compatibility Fixes */

/* Fix for mobile Safari address bar height changes */
@supports (-webkit-touch-callout: none) {
    .min-h-screen {
        min-height: -webkit-fill-available;
    }
}

/* Improve mobile scrolling performance */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* Fix for mobile keyboard issues */
@media (max-height: 500px) {
    .hero-bg {
        min-height: auto;
        padding-top: 2rem;
        padding-bottom: 1rem;
    }
    
    .hero-content h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem;
    }
    
    .hero-content p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
}

/* Mobile-specific button improvements */
.btn-mobile {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    font-size: 16px;
    border-radius: 0.75rem;
    -webkit-tap-highlight-color: transparent;
}

/* Fix for mobile viewport units */
.mobile-vh-fix {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

/* Improve mobile carousel touch */
.carousel-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Mobile-specific grid improvements */
@media (max-width: 640px) {
    .responsive-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .news-grid, .events-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Mobile footer improvements */
@media (max-width: 768px) {
    footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    footer .space-y-3 > * + * {
        margin-top: 0.5rem;
    }
}

/* Mobile modal improvements */
@media (max-width: 640px) {
    .modal-mobile {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    
    .modal-mobile .modal-content {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Fix for mobile landscape orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-bg {
        padding-top: 2rem;
        padding-bottom: 1rem;
    }
    
    .hero-content {
        padding: 0 2rem;
    }
    
    .hero-content h1 {
        font-size: 2rem !important;
        line-height: 1.1;
        margin-bottom: 1rem;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

/* Mobile-specific animations */
@media (prefers-reduced-motion: no-preference) {
    .mobile-slide-in {
        animation: mobileSlideIn 0.3s ease-out;
    }
    
    @keyframes mobileSlideIn {
        from {
            transform: translateX(-100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS Safari bottom safe area */
    .mobile-safe-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Fix for iOS Safari top safe area */
    .mobile-safe-top {
        padding-top: env(safe-area-inset-top);
    }
    
    /* Fix for iOS Safari viewport height */
    .ios-vh-fix {
        height: -webkit-fill-available;
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .android-fix {
        -webkit-text-size-adjust: 100%;
    }
}

/* Improve mobile performance */
.mobile-optimized {
    will-change: transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Mobile-specific utility classes */
.mobile-hidden {
    display: none;
}

@media (min-width: 768px) {
    .mobile-hidden {
        display: block;
    }
}

.desktop-hidden {
    display: block;
}

@media (min-width: 768px) {
    .desktop-hidden {
        display: none;
    }
}

/* Fix for mobile sticky elements */
.mobile-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Mobile-specific spacing */
@media (max-width: 640px) {
    .mobile-px-4 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .mobile-py-8 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .mobile-mb-4 {
        margin-bottom: 1rem;
    }
    
    .mobile-text-sm {
        font-size: 0.875rem;
        line-height: 1.25rem;
    }
}

/* Payroll Table Responsiveness */
@media (max-width: 1024px) {
    /* Payroll table specific fixes */
    .payroll-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .payroll-table {
        min-width: 800px;
        width: 100%;
    }
    
    .payroll-table th,
    .payroll-table td {
        white-space: nowrap;
        padding: 0.5rem 0.375rem;
        font-size: 0.875rem;
        vertical-align: middle;
    }
    
    /* Prevent text wrapping in payroll amounts */
    .payroll-amount {
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
        text-align: right;
    }
    
    /* Ensure period column stays horizontal */
    .payroll-table td[data-label="Period"],
    .payroll-table th:first-child {
        min-width: 140px;
        white-space: nowrap;
    }
    
    /* Force horizontal layout for period text */
    .payroll-table td[data-label="Period"] {
        word-break: keep-all;
        overflow-wrap: normal;
        hyphens: none;
    }
    
    /* Compact action buttons for payroll */
    .payroll-actions {
        display: flex;
        gap: 0.25rem;
        flex-wrap: nowrap;
        min-width: fit-content;
    }
    
    .payroll-actions .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
        min-width: auto;
    }
    
    .payroll-actions .btn i {
        margin-right: 0.25rem;
    }
}

@media (max-width: 768px) {
    /* More aggressive payroll table compression */
    .payroll-table {
        min-width: 700px;
    }
    
    .payroll-table th,
    .payroll-table td {
        padding: 0.375rem 0.25rem;
        font-size: 0.8125rem;
    }
    
    /* Ensure period column stays readable and horizontal */
    .payroll-table td[data-label="Period"],
    .payroll-table th:first-child {
        min-width: 130px;
        font-size: 0.75rem;
        white-space: nowrap;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Hide less important columns on mobile */
    .payroll-table .hide-mobile {
        display: none;
    }
    
    /* Compact employee names */
    .payroll-employee-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Stack action buttons vertically on very small screens */
    .payroll-actions {
        flex-direction: column;
        gap: 0.125rem;
        min-width: 80px;
    }
    
    .payroll-actions .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.6875rem;
        text-align: center;
    }
}

/* Employee Payroll Page Specific */
@media (max-width: 640px) {
    /* Convert payroll table to card layout on mobile */
    .employee-payroll-mobile .payroll-table,
    .employee-payroll-mobile .payroll-table thead,
    .employee-payroll-mobile .payroll-table tbody,
    .employee-payroll-mobile .payroll-table th,
    .employee-payroll-mobile .payroll-table td,
    .employee-payroll-mobile .payroll-table tr {
        display: block;
    }
    
    .employee-payroll-mobile .payroll-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .employee-payroll-mobile .payroll-table tr {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    }
    
    .employee-payroll-mobile .payroll-table td {
        border: none;
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .employee-payroll-mobile .payroll-table td:last-child {
        border-bottom: none;
        padding-top: 0.75rem;
    }
    
    .employee-payroll-mobile .payroll-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 0.875rem;
        flex-shrink: 0;
        margin-right: 1rem;
    }
    
    .employee-payroll-mobile .payroll-table td .payroll-actions {
        flex-direction: column;
        gap: 0.375rem;
        justify-content: flex-start;
        width: 100%;
        padding: 0.25rem;
    }
    
    .employee-payroll-mobile .payroll-table td .action-btn {
        flex: none;
        width: 100%;
        padding: 0.375rem 0.5rem;
        font-size: 0.6875rem;
        margin: 0.125rem;
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
}

/* Payroll Summary Cards */
@media (max-width: 768px) {
    .payroll-summary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .payroll-summary-card {
        padding: 1rem;
    }
    
    .payroll-summary-card h3 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .payroll-summary-card .amount {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .payroll-summary-card .details {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .payroll-summary-actions {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .payroll-summary-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Admin Payroll Page Specific Fixes */
@media (max-width: 1024px) {
    /* Admin payroll table adjustments */
    .admin-payroll-table th,
    .admin-payroll-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8125rem;
    }
    
    /* Compact status badges */
    .admin-payroll-table .status-badge {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }
    
    /* Compact employee info */
    .admin-payroll-employee {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    /* Hide archived date column on mobile */
    .admin-payroll-table .archived-column {
        display: none;
    }
    
    /* Stack admin payroll actions */
    .admin-payroll-actions {
        flex-direction: column;
        gap: 0.125rem;
        min-width: 90px;
    }
    
    .admin-payroll-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
        width: 100%;
    }
}

/* Payroll Filter Form Responsiveness */
@media (max-width: 768px) {
    .payroll-filter-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .payroll-filter-form > * {
        width: 100%;
    }
    
    .payroll-filter-form input,
    .payroll-filter-form select,
    .payroll-filter-form button {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .payroll-filter-buttons {
        display: flex;
        gap: 0.5rem;
    }
    
    .payroll-filter-buttons button {
        flex: 1;
    }
}

/* Payroll Modal Responsiveness */
@media (max-width: 640px) {
    .payroll-modal {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        width: 100%;
    }
    
    .payroll-modal .modal-content {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .payroll-modal .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .payroll-modal .modal-body {
        padding: 1rem;
    }
}

/* Payroll Bulk Actions Mobile */
@media (max-width: 640px) {
    .payroll-bulk-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .payroll-bulk-actions button {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .payroll-bulk-info {
        text-align: center;
        margin-bottom: 0.5rem;
    }
}

/* Payroll Search Mobile */
@media (max-width: 640px) {
    .payroll-search-container {
        position: relative;
        width: 100%;
    }
    
    .payroll-search-input {
        width: 100%;
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        font-size: 1rem;
        border-radius: 0.5rem;
    }
    
    .payroll-search-icon {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: #6b7280;
    }
}

/* Prevent text wrapping in currency amounts */
.currency-amount {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-weight: 600;
}

/* Prevent date wrapping */
.date-range {
    white-space: nowrap;
    font-size: 0.875rem;
    min-width: fit-content;
    word-break: keep-all;
    overflow-wrap: normal;
    hyphens: none;
}

@media (max-width: 640px) {
    .date-range {
        font-size: 0.75rem;
        min-width: 120px;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
        word-break: keep-all;
        overflow-wrap: normal;
        hyphens: none;
    }
}

/* Employee name truncation */
.employee-name {
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .employee-name {
        max-width: 120px;
        font-size: 0.875rem;
    }
}

/* Status badge improvements */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .status-badge {
        font-size: 0.6875rem;
        padding: 0.125rem 0.375rem;
    }
}

/* Action button improvements */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.action-btn i {
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .action-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .action-btn i {
        margin-right: 0.125rem;
        font-size: 0.6875rem;
    }
}

@media (max-width: 640px) {
    .action-btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.6875rem;
        min-width: auto;
    }
    
    .action-btn span {
        display: none;
    }
    
    .action-btn i {
        margin-right: 0;
    }
}

/* Payroll period selector mobile */
@media (max-width: 640px) {
    .payroll-period-selector {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .payroll-period-selector select {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 0.5rem;
    }
    
    .payroll-period-selector label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: #374151;
    }
}

/* Payroll pagination mobile */
@media (max-width: 640px) {
    .payroll-pagination {
        display: flex;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .payroll-pagination .pagination {
        display: flex;
        gap: 0.25rem;
    }
    
    .payroll-pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 0.375rem;
        min-width: 44px;
        text-align: center;
    }
}
/* Employee Leave Pages Responsiveness */

/* Leave Management Index Page */
@media (max-width: 1024px) {
    .leave-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .leave-header h2 {
        text-align: center;
    }
    
    .leave-apply-btn {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 768px) {
    /* Leave balance cards */
    .leave-balance-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .leave-balance-card {
        padding: 1rem;
        text-align: center;
    }
    
    .leave-balance-card h3 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .leave-balance-card .balance-amount {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    /* Leave request cards */
    .leave-card {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .leave-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .leave-card-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        width: 100%;
    }
    
    .leave-card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }
    
    .leave-card-actions {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        margin-top: 0.75rem;
    }
    
    /* Bulk actions */
    .leave-bulk-actions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .leave-bulk-info {
        text-align: center;
    }
    
    /* Pending alert */
    .leave-pending-alert {
        padding: 1rem;
    }
    
    .leave-pending-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .leave-pending-actions {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .leave-pending-actions button {
        width: 100%;
        padding: 0.75rem;
    }
}

@media (max-width: 640px) {
    /* Convert leave cards to mobile-friendly layout */
    .leave-card-mobile {
        display: block;
        padding: 1rem;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        background: white;
        border: 1px solid #e5e7eb;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .leave-card-mobile-header {
        display: flex;
        align-items: center;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .leave-card-mobile-icon {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    
    .leave-card-mobile-title {
        flex: 1;
    }
    
    .leave-card-mobile-title h3 {
        font-size: 1rem;
        font-weight: 600;
        margin: 0 0 0.25rem 0;
    }
    
    .leave-card-mobile-title p {
        font-size: 0.875rem;
        color: #6b7280;
        margin: 0;
    }
    
    .leave-card-mobile-status {
        flex-shrink: 0;
    }
    
    .leave-card-mobile-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .leave-card-mobile-detail {
        text-align: center;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 0.375rem;
    }
    
    .leave-card-mobile-detail-label {
        font-size: 0.75rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
    }
    
    .leave-card-mobile-detail-value {
        font-size: 0.875rem;
        font-weight: 600;
        color: #111827;
    }
    
    .leave-card-mobile-actions {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
    }
    
    .leave-card-mobile-actions button {
        padding: 0.5rem;
        border-radius: 0.375rem;
        border: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    /* Hide desktop bulk actions on mobile */
    .leave-bulk-desktop {
        display: none;
    }
    
    /* Mobile-specific bulk actions */
    .leave-bulk-mobile {
        display: block;
        position: fixed;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        background: white;
        border-radius: 0.75rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        padding: 1rem;
        z-index: 40;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .leave-bulk-mobile.active {
        transform: translateY(0);
    }
    
    .leave-bulk-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
    }
    
    .leave-bulk-mobile-actions {
        display: flex;
        gap: 0.5rem;
    }
    
    .leave-bulk-mobile-actions button {
        flex: 1;
        padding: 0.75rem;
        border-radius: 0.5rem;
        font-size: 0.875rem;
        font-weight: 500;
    }
}

/* Leave Create/Apply Form Responsiveness */
@media (max-width: 768px) {
    .leave-form-container {
        max-width: none;
        margin: 0;
        padding: 0 1rem;
    }
    
    .leave-form {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .leave-form h2 {
        font-size: 1.5rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    /* Form grid adjustments */
    .leave-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .leave-form-group {
        margin-bottom: 1rem;
    }
    
    .leave-form-label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        display: block;
        font-weight: 600;
        color: #374151;
    }
    
    .leave-form-input,
    .leave-form-select,
    .leave-form-textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border: 1px solid #d1d5db;
        border-radius: 0.5rem;
        transition: border-color 0.2s ease;
    }
    
    .leave-form-input:focus,
    .leave-form-select:focus,
    .leave-form-textarea:focus {
        outline: none;
        border-color: #dc2626;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }
    
    /* File upload styling */
    .leave-file-upload {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .leave-file-upload-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
        background: #f3f4f6;
        border: 1px solid #d1d5db;
        border-radius: 0.5rem;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 0.875rem;
        color: #374151;
    }
    
    .leave-file-upload-btn:hover {
        background: #e5e7eb;
        border-color: #9ca3af;
    }
    
    .leave-file-upload-info {
        font-size: 0.75rem;
        color: #6b7280;
        text-align: center;
    }
    
    /* Form actions */
    .leave-form-actions {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }
    
    .leave-form-actions button,
    .leave-form-actions a {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        font-weight: 500;
        border-radius: 0.5rem;
        text-align: center;
        transition: all 0.2s ease;
        text-decoration: none;
        display: inline-block;
    }
    
    /* Validation messages */
    .leave-validation-error {
        background: #fef2f2;
        border: 1px solid #fecaca;
        border-radius: 0.5rem;
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .leave-validation-error p {
        color: #dc2626;
        font-size: 0.875rem;
        margin: 0;
    }
    
    /* Character counter */
    .leave-char-counter {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.5rem;
    }
    
    .leave-char-counter span {
        font-size: 0.75rem;
        color: #6b7280;
    }
}

@media (max-width: 640px) {
    .leave-form-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        margin: 0 -1rem -1rem -1rem;
        border-top: 1px solid #e5e7eb;
        border-radius: 0 0 0.5rem 0.5rem;
    }
}

/* Modal Responsiveness */
@media (max-width: 640px) {
    .leave-modal {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        width: 100%;
    }
    
    .leave-modal-content {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .leave-modal-header {
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .leave-modal-body {
        padding: 1rem;
        flex: 1;
    }
    
    .leave-modal-actions {
        padding: 1rem;
        border-top: 1px solid #e5e7eb;
        position: sticky;
        bottom: 0;
        background: white;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .leave-modal-actions button {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 0.5rem;
    }
}

/* Status badges responsive */
.leave-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .leave-status-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Leave type icons responsive */
.leave-type-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .leave-type-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.75rem;
    }
}

/* Pagination responsive */
@media (max-width: 640px) {
    .leave-pagination {
        display: flex;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .leave-pagination .pagination {
        display: flex;
        gap: 0.25rem;
    }
    
    .leave-pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 0.375rem;
        min-width: 44px;
        text-align: center;
    }
}

/* Touch improvements */
.leave-touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading states */
.leave-loading {
    opacity: 0.6;
    pointer-events: none;
}

.leave-loading-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .leave-card,
    .leave-modal,
    .leave-bulk-mobile {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .leave-card {
        border-width: 2px;
        border-color: #000;
    }
    
    .leave-status-badge {
        border: 2px solid currentColor;
    }
}

/* Print styles */
@media print {
    .leave-bulk-actions,
    .leave-modal,
    .leave-form-actions {
        display: none !important;
    }
    
    .leave-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* Employee Dashboard Responsiveness */
@media (max-width: 1024px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .dashboard-main-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-stat-card {
        padding: 1rem;
        text-align: center;
    }
    
    .dashboard-stat-card .stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        margin: 0 auto 0.75rem auto;
    }
    
    .dashboard-stat-card .stat-value {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .dashboard-stat-card .stat-label {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }
    
    /* Goal card mobile */
    .dashboard-goal-card {
        padding: 1rem;
    }
    
    .dashboard-goal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .dashboard-goal-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .dashboard-goal-actions {
        width: 100%;
        text-align: center;
    }
    
    .dashboard-goal-actions a {
        width: 100%;
        display: block;
        padding: 0.75rem;
    }
    
    /* QR code section mobile */
    .dashboard-qr-section {
        text-align: center;
        padding: 1rem;
    }
    
    .dashboard-qr-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dashboard-qr-actions button,
    .dashboard-qr-actions a {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Calendar widget mobile */
    .dashboard-calendar-widget {
        padding: 1rem;
    }
    
    .dashboard-calendar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Recent posts mobile */
    .dashboard-posts-widget {
        padding: 1rem;
    }
    
    .dashboard-post-item {
        padding: 0.75rem;
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .dashboard-post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Attendance table mobile */
    .dashboard-attendance-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .dashboard-attendance-table table {
        min-width: 600px;
    }
    
    .dashboard-attendance-table th,
    .dashboard-attendance-table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    /* Convert dashboard to mobile-friendly cards */
    .dashboard-mobile-card {
        background: white;
        border-radius: 0.75rem;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .dashboard-mobile-header {
        display: flex;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .dashboard-mobile-icon {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    
    .dashboard-mobile-title {
        flex: 1;
    }
    
    .dashboard-mobile-title h3 {
        font-size: 1rem;
        font-weight: 600;
        margin: 0 0 0.25rem 0;
    }
    
    .dashboard-mobile-title p {
        font-size: 0.875rem;
        color: #6b7280;
        margin: 0;
    }
    
    /* Mobile QR modal */
    .dashboard-qr-modal-mobile {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        border-radius: 0.75rem;
    }
    
    .dashboard-qr-modal-content {
        padding: 1.5rem;
        text-align: center;
    }
    
    .dashboard-qr-modal-image {
        max-width: 200px;
        margin: 0 auto 1rem auto;
    }
}

/* Employee Attendance Page Responsiveness */
@media (max-width: 1024px) {
    .attendance-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .attendance-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .attendance-filter-form {
        flex-direction: column;
        gap: 1rem;
    }
    
    .attendance-filter-form > * {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .attendance-stat-card {
        padding: 1rem;
        text-align: center;
    }
    
    .attendance-stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        margin: 0 auto 0.75rem auto;
    }
    
    .attendance-stat-value {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .attendance-filter-container {
        padding: 1rem;
    }
    
    .attendance-filter-actions {
        display: flex;
        gap: 0.5rem;
    }
    
    .attendance-filter-actions button,
    .attendance-filter-actions a {
        flex: 1;
        padding: 0.75rem;
        font-size: 0.875rem;
        text-align: center;
    }
    
    /* Attendance table mobile */
    .attendance-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.5rem;
        border: 1px solid #e5e7eb;
    }
    
    .attendance-table {
        min-width: 700px;
        width: 100%;
    }
    
    .attendance-table th,
    .attendance-table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.875rem;
        white-space: nowrap;
        vertical-align: middle;
    }
    
    .attendance-table .hide-mobile {
        display: none;
    }
    
    .attendance-actions {
        display: flex;
        gap: 0.25rem;
        flex-wrap: nowrap;
        min-width: fit-content;
    }
    
    .attendance-actions .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
        min-width: auto;
    }
}

@media (max-width: 640px) {
    /* Convert attendance table to mobile cards */
    .attendance-mobile-card {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .attendance-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .attendance-mobile-date {
        font-weight: 600;
        color: #111827;
    }
    
    .attendance-mobile-status {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        border-radius: 9999px;
        font-weight: 500;
    }
    
    .attendance-mobile-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .attendance-mobile-detail {
        text-align: center;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 0.375rem;
    }
    
    .attendance-mobile-detail-label {
        font-size: 0.75rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
    }
    
    .attendance-mobile-detail-value {
        font-size: 0.875rem;
        font-weight: 600;
        color: #111827;
    }
    
    .attendance-mobile-actions {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
    }
    
    .attendance-mobile-actions button {
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.75rem;
        font-weight: 500;
    }
}

/* Employee Overtime Pages Responsiveness */
@media (max-width: 1024px) {
    .overtime-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .overtime-apply-btn {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 768px) {
    /* Overtime table mobile */
    .overtime-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0.5rem;
        border: 1px solid #e5e7eb;
    }
    
    .overtime-table {
        min-width: 700px;
        width: 100%;
    }
    
    .overtime-table th,
    .overtime-table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.875rem;
        white-space: nowrap;
        vertical-align: middle;
    }
    
    .overtime-table .hide-mobile {
        display: none;
    }
    
    .overtime-actions {
        display: flex;
        gap: 0.25rem;
        flex-wrap: nowrap;
        min-width: fit-content;
    }
    
    .overtime-actions .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
        min-width: auto;
    }
    
    /* Overtime create form mobile */
    .overtime-form-container {
        max-width: none;
        margin: 0;
        padding: 0 1rem;
    }
    
    .overtime-form {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .overtime-form h2 {
        font-size: 1.5rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .overtime-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .overtime-form-group {
        margin-bottom: 1rem;
    }
    
    .overtime-form-label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        display: block;
        font-weight: 600;
        color: #374151;
    }
    
    .overtime-form-input,
    .overtime-form-select,
    .overtime-form-textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border: 1px solid #d1d5db;
        border-radius: 0.5rem;
        transition: border-color 0.2s ease;
    }
    
    .overtime-form-input:focus,
    .overtime-form-select:focus,
    .overtime-form-textarea:focus {
        outline: none;
        border-color: #dc2626;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }
    
    .overtime-form-actions {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }
    
    .overtime-form-actions button,
    .overtime-form-actions a {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        font-weight: 500;
        border-radius: 0.5rem;
        text-align: center;
        transition: all 0.2s ease;
        text-decoration: none;
        display: inline-block;
    }
    
    .overtime-info-card {
        padding: 1rem;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .overtime-info-card h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .overtime-info-card ul {
        font-size: 0.875rem;
        line-height: 1.5;
    }
}

@media (max-width: 640px) {
    /* Convert overtime table to mobile cards */
    .overtime-mobile-card {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .overtime-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .overtime-mobile-date {
        font-weight: 600;
        color: #111827;
    }
    
    .overtime-mobile-status {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        border-radius: 9999px;
        font-weight: 500;
    }
    
    .overtime-mobile-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .overtime-mobile-detail {
        text-align: center;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 0.375rem;
    }
    
    .overtime-mobile-detail-label {
        font-size: 0.75rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
    }
    
    .overtime-mobile-detail-value {
        font-size: 0.875rem;
        font-weight: 600;
        color: #111827;
    }
    
    .overtime-mobile-actions {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-end;
    }
    
    .overtime-mobile-actions button {
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.75rem;
        font-weight: 500;
    }
    
    .overtime-form-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        margin: 0 -1rem -1rem -1rem;
        border-top: 1px solid #e5e7eb;
        border-radius: 0 0 0.5rem 0.5rem;
    }
}

/* Employee Files (201 File) Responsiveness */
@media (max-width: 1024px) {
    .files-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .files-header-info {
        text-align: center;
    }
    
    .files-header-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .files-header-actions a,
    .files-header-actions button {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 768px) {
    /* Files tabs mobile */
    .files-tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 1rem;
    }
    
    .files-tabs-nav .tab-button {
        white-space: nowrap;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        min-width: fit-content;
    }
    
    /* Files content mobile */
    .files-tab-content {
        padding: 1rem;
    }
    
    .files-section {
        margin-bottom: 1.5rem;
    }
    
    .files-section h4 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .files-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .files-info-item {
        padding: 0.75rem;
        background: #f9fafb;
        border-radius: 0.5rem;
    }
    
    .files-info-label {
        font-size: 0.75rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
        display: block;
    }
    
    .files-info-value {
        font-size: 0.875rem;
        font-weight: 500;
        color: #111827;
    }
    
    /* Documents list mobile */
    .files-document-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .files-document-item {
        display: flex;
        align-items: center;
        padding: 1rem;
        background: #f9fafb;
        border-radius: 0.5rem;
        border: 1px solid #e5e7eb;
    }
    
    .files-document-icon {
        width: 2.5rem;
        height: 2.5rem;
        background: #dbeafe;
        border-radius: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    
    .files-document-info {
        flex: 1;
        min-width: 0;
    }
    
    .files-document-name {
        font-weight: 500;
        color: #111827;
        margin-bottom: 0.25rem;
        word-break: break-word;
    }
    
    .files-document-meta {
        font-size: 0.75rem;
        color: #6b7280;
    }
    
    .files-document-actions {
        flex-shrink: 0;
        margin-left: 0.75rem;
    }
    
    .files-document-actions button {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 0.375rem;
    }
    
    /* Training records mobile */
    .files-training-item {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .files-training-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .files-training-title {
        font-weight: 600;
        color: #111827;
        margin-bottom: 0.25rem;
    }
    
    .files-training-type {
        font-size: 0.75rem;
        color: #6b7280;
    }
    
    .files-training-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .files-training-detail {
        text-align: center;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 0.375rem;
    }
    
    .files-training-detail-label {
        font-size: 0.75rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
    }
    
    .files-training-detail-value {
        font-size: 0.875rem;
        font-weight: 500;
        color: #111827;
    }
    
    /* Education records mobile */
    .files-education-item {
        background: #f9fafb;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .files-education-level {
        font-weight: 600;
        color: #111827;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .files-education-details {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .files-education-detail {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .files-education-detail:last-child {
        border-bottom: none;
    }
    
    .files-education-detail-label {
        font-size: 0.875rem;
        color: #6b7280;
        font-weight: 500;
    }
    
    .files-education-detail-value {
        font-size: 0.875rem;
        color: #111827;
        text-align: right;
        word-break: break-word;
    }
}

@media (max-width: 640px) {
    /* Files request update form mobile */
    .files-update-form {
        padding: 1rem;
    }
    
    .files-update-form h2 {
        font-size: 1.25rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .files-update-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .files-update-group {
        margin-bottom: 1rem;
    }
    
    .files-update-label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        display: block;
        font-weight: 600;
        color: #374151;
    }
    
    .files-update-current {
        font-size: 0.75rem;
        color: #6b7280;
        margin-bottom: 0.25rem;
    }
    
    .files-update-input,
    .files-update-select,
    .files-update-textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border: 1px solid #d1d5db;
        border-radius: 0.5rem;
        transition: border-color 0.2s ease;
    }
    
    .files-update-input:focus,
    .files-update-select:focus,
    .files-update-textarea:focus {
        outline: none;
        border-color: #dc2626;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }
    
    .files-update-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        margin: 0 -1rem -1rem -1rem;
        border-top: 1px solid #e5e7eb;
        border-radius: 0 0 0.5rem 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .files-update-actions button,
    .files-update-actions a {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        font-weight: 500;
        border-radius: 0.5rem;
        text-align: center;
        text-decoration: none;
        display: inline-block;
    }
    
    /* Pending requests mobile */
    .files-pending-request {
        background: #fef3c7;
        border: 1px solid #f59e0b;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .files-pending-header {
        display: flex;
        align-items: center;
        margin-bottom: 0.75rem;
    }
    
    .files-pending-icon {
        width: 1.5rem;
        height: 1.5rem;
        color: #f59e0b;
        margin-right: 0.5rem;
    }
    
    .files-pending-title {
        font-weight: 600;
        color: #92400e;
        font-size: 0.875rem;
    }
    
    .files-pending-details {
        font-size: 0.75rem;
        color: #92400e;
        line-height: 1.4;
    }
    
    /* Files modal mobile */
    .files-modal-mobile {
        margin: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        width: 100%;
    }
    
    .files-modal-content {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .files-modal-header {
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .files-modal-body {
        padding: 1rem;
        flex: 1;
    }
}

/* Touch improvements for all employee pages */
.employee-touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading states for all employee pages */
.employee-loading {
    opacity: 0.6;
    pointer-events: none;
}

.employee-loading-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Accessibility improvements for all employee pages */
@media (prefers-reduced-motion: reduce) {
    .dashboard-mobile-card,
    .attendance-mobile-card,
    .overtime-mobile-card,
    .files-modal-mobile {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode for all employee pages */
@media (prefers-contrast: high) {
    .dashboard-mobile-card,
    .attendance-mobile-card,
    .overtime-mobile-card,
    .files-document-item {
        border-width: 2px;
        border-color: #000;
    }
}

/* Print styles for all employee pages */
@media print {
    .dashboard-qr-actions,
    .attendance-actions,
    .overtime-actions,
    .files-header-actions,
    .files-update-actions {
        display: none !important;
    }
    
    .dashboard-mobile-card,
    .attendance-mobile-card,
    .overtime-mobile-card,
    .files-document-item {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}