/*
 * Responsive Styles for Abha Manpower Service
 * Mobile-first responsive design
 */

/* Mobile Small (< 375px) */
@media (max-width: 374px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .text-4xl {
        font-size: 1.75rem;
    }

    .text-3xl {
        font-size: 1.5rem;
    }
}

/* Mobile (< 640px) */
@media (max-width: 639px) {
    /* Hero Section */
    .hero-section {
        min-height: 500px;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .hero-section h1,
    .hero-slide h1 {
        font-size: 1.875rem !important;
        line-height: 1.2;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    .hero-section p,
    .hero-slide p {
        font-size: 1rem !important;
        text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
    }

    /* Hero content padding adjustment */
    .hero-slide .container {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    /* Buttons */
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    /* Navigation */
    #mobile-menu {
        position: fixed;
        top: 68px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 68px);
        overflow-y: auto;
        z-index: 40;
    }

    /* Cards Grid */
    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    /* Stats Counter */
    .counter {
        font-size: 2rem !important;
    }

    /* Testimonials */
    .testimonial-carousel {
        padding: 1rem;
    }

    /* Job Cards */
    .job-card {
        margin-bottom: 1rem;
    }

    /* Form Inputs */
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Modal */
    #applicationModal .max-w-2xl {
        max-width: 95%;
        margin: 1rem;
    }

    /* Footer */
    footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Tablet (640px - 768px) */
@media (min-width: 640px) and (max-width: 767px) {
    /* Hero */
    .hero-section h1 {
        font-size: 2.5rem;
    }

    /* Grid adjustments */
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet to Desktop (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Container */
    .container {
        max-width: 720px;
    }

    /* Hero */
    .hero-section h1 {
        font-size: 3rem;
    }

    /* Grid Adjustments */
    .lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lg\\:grid-cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Job Cards */
    .md\\:grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Footer */
    footer .lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Desktop (1024px - 1280px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .container {
        max-width: 960px;
    }
}

/* Large Desktop (1280px - 1536px) */
@media (min-width: 1280px) and (max-width: 1535px) {
    .container {
        max-width: 1200px;
    }
}

/* Extra Large Desktop (> 1536px) */
@media (min-width: 1536px) {
    .container {
        max-width: 1400px;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 400px;
    }

    .hero-section .py-32 {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .hover\\:shadow-xl:hover {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    /* Larger tap targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 1rem 1.5rem;
    }
}

/* Print Styles */
@media print {
    /* Hide unnecessary elements */
    header,
    footer,
    nav,
    .whatsapp-float,
    .btn,
    button {
        display: none !important;
    }

    /* Adjust layout */
    body {
        font-size: 12pt;
        color: black;
        background: white;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Break page after sections */
    section {
        page-break-after: auto;
    }

    h1, h2 {
        page-break-after: avoid;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed in future */
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid currentColor;
    }

    .card {
        border: 1px solid currentColor;
    }
}

/* Specific Component Responsive Fixes */

/* Job Search Bar */
@media (max-width: 768px) {
    .job-search-bar {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .job-search-bar button {
        width: 100%;
    }
}

/* About Page Timeline */
@media (max-width: 640px) {
    .timeline-item {
        padding-left: 2rem;
    }

    .timeline-item::before {
        left: 0.5rem;
    }
}

/* Contact Page */
@media (max-width: 1024px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* Job Detail Sticky Sidebar */
@media (max-width: 1024px) {
    .sticky-sidebar {
        position: static !important;
    }
}

/* Employers Page Industries */
@media (max-width: 640px) {
    .industries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .industries-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile Menu Animation */
@media (max-width: 1024px) {
    #mobile-menu {
        transition: max-height 0.3s ease-in-out;
    }

    #mobile-menu.hidden {
        max-height: 0;
        overflow: hidden;
    }
}

/* Utility Classes for Responsive */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 1024px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}

/* Responsive Typography */
@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.5rem;
    }

    h4 {
        font-size: 1.25rem;
    }

    p {
        font-size: 0.9375rem;
    }
}

/* Responsive Padding and Margins */
@media (max-width: 640px) {
    .py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .py-16 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* ========================================
   ENHANCED MOBILE RESPONSIVE STYLES
   ======================================== */

/* Mobile Navigation Enhancements */
@media (max-width: 1023px) {
    /* Ensure navigation is mobile-friendly */
    nav {
        position: sticky;
        top: 0;
        z-index: 10000;
    }

    /* Ensure navbar stays above mobile menu when closed */
    nav.bg-blue-600 {
        position: sticky;
        z-index: 10000;
    }

    /* Modern Mobile Menu - Slide-in from Right */
    .mobile-menu-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        pointer-events: none;
    }

    .mobile-menu-container:not(.hidden) {
        pointer-events: auto;
    }

    /* Overlay */
    .mobile-menu-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(4px);
    }

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

    /* Menu Content - Slides in from right */
    .mobile-menu-content {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .menu-active .mobile-menu-content {
        transform: translateX(0);
    }

    /* Menu Navigation - No header, starts at top */
    .mobile-menu-nav {
        flex: 1;
        padding: 24px 0;
        overflow-y: auto;
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
        padding: 16px 24px;
        color: rgba(255, 255, 255, 0.95);
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.3s ease;
        border-left: 4px solid transparent;
        position: relative;
    }

    .mobile-nav-link::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        background: rgba(255, 255, 255, 0.1);
        transition: width 0.3s ease;
    }

    .mobile-nav-link:hover::before,
    .mobile-nav-link.active::before {
        width: 100%;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link.active {
        color: #ffffff;
        border-left-color: #ffffff;
        background: rgba(255, 255, 255, 0.1);
    }

    .mobile-nav-link i {
        font-size: 18px;
        width: 24px;
        text-align: center;
    }

    /* Menu Footer */
    .mobile-menu-footer {
        padding: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        background: rgba(0, 0, 0, 0.1);
    }

    .mobile-cta-button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 14px 20px;
        background: #ffffff;
        color: #2563eb;
        font-weight: 600;
        font-size: 16px;
        border-radius: 8px;
        text-decoration: none;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .mobile-cta-button:hover {
        background: #f1f5f9;
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }

    /* Animated Hamburger Icon - Larger and Better Positioned */
    .hamburger-icon {
        width: 32px;
        height: 26px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        cursor: pointer;
        position: relative;
    }

    .hamburger-line {
        width: 100%;
        height: 3px;
        background: #ffffff;
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
        display: block;
    }

    /* Hamburger Animation - Transform to X */
    .menu-open .hamburger-line:nth-child(1) {
        transform: translateY(11.5px) rotate(45deg);
    }

    .menu-open .hamburger-line:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    .menu-open .hamburger-line:nth-child(3) {
        transform: translateY(-11.5px) rotate(-45deg);
    }

    /* Hamburger Button Hover */
    #mobile-menu-btn {
        padding: 10px;
        border-radius: 8px;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 48px;
        min-height: 48px;
    }

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

    #mobile-menu-btn:active {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(0.95);
    }
}

/* Mobile Container and Spacing */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Reduce excessive padding on mobile */
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    /* Card spacing */
    .card,
    .bg-white {
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* Mobile Menu Adjustments for Small Screens */
    .mobile-menu-content {
        width: 90%;
        max-width: 280px;
    }

    .hamburger-icon {
        width: 30px;
        height: 24px;
    }

    #mobile-menu-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }

    .mobile-nav-link {
        padding: 14px 20px;
        font-size: 15px;
    }

    .mobile-menu-nav {
        padding: 20px 0;
    }

    .mobile-menu-footer {
        padding: 16px;
    }
}

/* Extra Small Mobile Screens */
@media (max-width: 375px) {
    .hamburger-icon {
        width: 28px;
        height: 22px;
    }

    .hamburger-line {
        height: 2.5px;
    }

    .menu-open .hamburger-line:nth-child(1) {
        transform: translateY(9.75px) rotate(45deg);
    }

    .menu-open .hamburger-line:nth-child(3) {
        transform: translateY(-9.75px) rotate(-45deg);
    }

    .mobile-menu-content {
        width: 92%;
    }

    .mobile-nav-link {
        padding: 12px 18px;
        font-size: 14px;
    }

    .mobile-nav-link i {
        font-size: 16px;
        width: 20px;
    }

    .mobile-menu-nav {
        padding: 18px 0;
    }
}

/* Mobile Tables - Make scrollable */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    table {
        min-width: 600px;
    }

    /* Stack table cells on very small screens */
    @media (max-width: 480px) {
        table thead {
            display: none;
        }

        table, table tbody, table tr, table td {
            display: block;
            width: 100%;
        }

        table tr {
            margin-bottom: 1rem;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            padding: 1rem;
        }

        table td {
            text-align: right;
            padding-left: 50%;
            position: relative;
        }

        table td::before {
            content: attr(data-label);
            position: absolute;
            left: 1rem;
            font-weight: 600;
            text-align: left;
        }
    }
}

/* Mobile Forms */
@media (max-width: 640px) {
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem;
        border-radius: 8px;
    }

    .btn,
    button[type="submit"] {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    /* Form groups stack on mobile */
    .row > div[class*="col-"] {
        margin-bottom: 1rem;
    }
}

/* Mobile Images and Media */
@media (max-width: 640px) {
    img {
        max-width: 100%;
        height: auto;
    }

    /* Responsive embeds */
    iframe,
    video {
        max-width: 100%;
        height: auto;
    }
}

/* Mobile Modal Adjustments */
@media (max-width: 640px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* Mobile Breadcrumbs */
@media (max-width: 640px) {
    .breadcrumb {
        font-size: 0.875rem;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Mobile Statistics Cards */
@media (max-width: 640px) {
    .stats-grid,
    .statistics-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}

/* Mobile Job Cards */
@media (max-width: 640px) {
    .job-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .job-card .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Job details page */
    .job-details-sidebar {
        position: static !important;
        margin-top: 2rem;
    }
}

/* Mobile Contact Cards */
@media (max-width: 640px) {
    .contact-info-card {
        margin-bottom: 1rem;
        padding: 1.5rem 1rem;
    }

    .contact-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}

/* Mobile Footer */
@media (max-width: 640px) {
    footer {
        text-align: center;
    }

    footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    footer .social-links {
        justify-content: center;
    }
}

/* Mobile Overflow Fix */
@media (max-width: 640px) {
    body {
        overflow-x: hidden;
    }

    * {
        max-width: 100%;
    }
}

/* Tablet Optimizations (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    /* Two column layouts on tablet */
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .lg\\:grid-cols-3,
    .lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Safe Area Insets for Notched Devices (iPhone X+) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    nav {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    footer {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Mobile Button Improvements */
@media (max-width: 640px) {
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group .btn {
        width: 100%;
        border-radius: 8px !important;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-section,
    .simple-hero-wrapper {
        min-height: 400px;
    }

    section {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}

/* Fix for Small Mobile Devices (iPhone SE, etc) */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}
