/* ===================================
   MOBILE RESPONSIVE UTILITIES
   For TalentoBot Application
   =================================== */

/* ===================================
   1. HAMBURGER MENU
   =================================== */

.hamburger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    background: transparent;
    border: none;
    z-index: 1001;
}

.hamburger-menu span {
    width: 25px;
    height: 3px;
    background: #37352F;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    padding: 80px 20px 20px;
    overflow-y: auto;
}

.mobile-nav-drawer.active {
    right: 0;
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.mobile-nav-item {
    display: block;
    padding: 16px 20px;
    color: #37352F;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: #F7F6F3;
}

.mobile-nav-item.create-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 16px;
}

.mobile-nav-item.create-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Logout button in mobile drawer */
.mobile-nav-item.logout,
button.mobile-nav-item.logout {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    color: #dc2626;
    font-weight: 600;
}

.mobile-nav-item.logout:hover,
button.mobile-nav-item.logout:hover {
    background: #fee2e2;
    color: #991b1b;
}

/* ===================================
   2. TOUCH OPTIMIZATION
   =================================== */

/* Minimum touch target size: 44x44px (Apple HIG) */
@media (max-width: 768px) {
    button,
    .button,
    a.nav-link,
    .action-link,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }

    /* Increase tap target for small icons */
    .action-link,
    .delete-btn,
    .edit-btn {
        padding: 12px;
        font-size: 1.2em;
    }

    /* Remove hover states on touch devices */
    @media (hover: none) {
        *:hover {
            /* Disable hover effects */
        }
    }

    /* Add tap highlight */
    * {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    }

    /* Increase spacing for easier tapping */
    .nav-menu {
        gap: 16px;
    }

    .stats-grid,
    .projects-grid {
        gap: 20px;
    }
}

/* ===================================
   3. LAYOUT FIXES FOR MOBILE
   =================================== */

@media (max-width: 1100px) {
    /* Hide desktop navigation */
    .nav-menu {
        display: none;
    }

    /* Show hamburger menu */
    .hamburger-menu {
        display: flex;
    }

    /* Stack cards vertically */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .projects-grid {
        grid-template-columns: 1fr !important;
    }

    /* Full-width containers */
    .main-content {
        padding: 20px 16px;
        max-width: 100%;
    }

    .interview-container,
    .container,
    .main-layout {
        padding: 16px;
        max-width: 100%;
    }

    /* Font size adjustments */
    .page-title {
        font-size: 1.75rem;
    }

    .page-subtitle {
        font-size: 0.95rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Card adjustments */
    .stat-card,
    .project-card {
        padding: 20px;
    }

    /* Header adjustments */
    .header {
        padding: 12px 16px;
    }

    .header-content {
        gap: 12px;
    }

    .logo {
        font-size: 1.1rem;
    }

    /* Hide long text on mobile */
    .user-email {
        display: none;
    }

    /* Table to cards on mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Modal adjustments */
    .modal-content,
    .exit-modal-content {
        width: 90%;
        max-width: 90%;
        margin: 16px;
    }

    /* Form adjustments */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Sidebar to top on mobile */
    .folder-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #E9E9E7;
        min-height: auto;
        max-height: 300px;
        overflow-y: auto;
    }

    .main-layout {
        flex-direction: column;
    }
}

/* ===================================
   4. TABLET ADJUSTMENTS (768px - 1024px)
   =================================== */

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

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-content {
        padding: 30px 24px;
    }
}

/* ===================================
   5. SMALL MOBILE (max 375px)
   =================================== */

@media (max-width: 375px) {
    .page-title {
        font-size: 1.5rem;
    }

    .stat-card,
    .project-card {
        padding: 16px;
    }

    .header {
        padding: 10px 12px;
    }

    .logo {
        font-size: 1rem;
    }

    button,
    .button {
        font-size: 0.9rem;
        padding: 10px 16px;
    }
}

/* ===================================
   6. LANDSCAPE MODE
   =================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .interview-container {
        max-height: 100vh;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===================================
   7. SAFE AREAS (for notched devices)
   =================================== */

@supports (padding: max(0px)) {
    .header,
    .main-content,
    .chat-input-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .mobile-nav-drawer {
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* ===================================
   8. ACCESSIBILITY HELPERS
   =================================== */

/* Skip to main content */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #37352F;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
