/* Mobile Responsive Styles - Separate File */
/* This file contains only mobile-specific styles that override desktop styles */
/* Media query: max-width 768px for tablets and phones */

@media screen and (max-width: 768px) {
    
    /* ==================== 
       BASE STYLES 
       ==================== */
    body {
        font-size: 14px;
        overflow-x: hidden;
    }
    
    /* ==================== 
       HEADER & NAVIGATION - WITH MOBILE LOGIN BUTTONS
       ==================== */
    .main-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
    }
    
    .navbar {
        flex-direction: row;
        padding: 12px 15px;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-brand .brand-link {
        font-size: 1.4rem;
    }
    
    /* Mobile Navbar Auth Buttons - Show only on mobile */
    .mobile-nav-auth {
        display: flex !important;
        flex-direction: row;
        gap: 8px;
        padding: 15px;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: 10px;
    }
    
    .mobile-nav-btn {
        flex: 1;
        padding: 12px 16px;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        text-align: center;
    }
    
    .mobile-nav-btn.btn-secondary {
        background: #ffffff;
        color: #333333;
        border: 1px solid #e0e0e0;
    }
    
    .mobile-nav-btn.btn-primary {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
        color: #ffffff;
        border: 1px solid #2d3748;
    }
    
    /* Hide mobile nav auth on desktop */
    @media screen and (min-width: 769px) {
        .mobile-nav-auth {
            display: none !important;
        }
        
        /* Also hide on larger screens */
        @media screen and (min-width: 1024px) {
            .mobile-nav-auth {
                display: none !important;
            }
        }
    }
    
    /* Mobile Menu Toggle */
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: calc(100vh - 60px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        transition: left 0.3s ease;
        z-index: 999;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-links {
        flex-direction: column;
        padding: 20px;
        gap: 0;
    }
    
    .nav-links li {
        width: 100%;
    }
    
    .nav-link {
        display: block;
        padding: 15px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        font-size: 1rem;
    }
    
    /* Hamburger Menu Button */
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }
    
    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background: #000000;
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* ==================== 
       FLOATING AUTH BUTTONS - HIDDEN ON MOBILE (moved to navbar)
       ==================== */
    .floating-auth-buttons {
        display: none !important;
    }
    
    /* Show floating auth only on desktop */
    @media screen and (min-width: 769px) {
        .floating-auth-buttons {
            display: flex !important;
        }
    }
    
    .floating-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
        min-width: auto;
        border-radius: 20px;
        flex: 0 1 auto;
    }
    
    .floating-credits {
        padding: 8px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .floating-refill-btn,
    .floating-profile-btn {
        padding: 8px 10px;
        font-size: 0.75rem;
        min-width: auto;
    }
    
    /* Hide floating buttons when scrolled down on mobile */
    .floating-auth-buttons.scrolled-down {
        transform: translateY(100px);
        opacity: 0;
        pointer-events: none;
    }
    
    /* ==================== 
       HERO SECTION 
       ==================== */
    .hero {
        padding: 100px 15px 60px;
        min-height: auto;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero-badge {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 15px;
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: 25px;
        padding: 0 10px;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 12px;
        padding: 0 20px;
    }
    
    .hero-cta .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 0.95rem;
    }
    
    /* ==================== 
       CHAT SECTION 
       ==================== */
    .app-layout {
        flex-direction: column;
        height: calc(100vh - 60px);
        margin-top: 60px;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        height: calc(100vh - 60px);
    }
    
    .chat-messages {
        padding: 60px 15px 100px;
        height: calc(100vh - 160px);
    }
    
    .message {
        max-width: 90%;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .chat-input-container {
        padding: 10px 15px;
        left: 0;
        right: 0;
    }
    
    .chat-input-wrapper {
        padding: 8px 12px;
    }
    
    #chatInput {
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    #chatInput::placeholder {
        font-size: 0.8rem;
    }
    
    .input-actions {
        gap: 8px;
    }
    
    .action-btn {
        width: 36px;
        height: 36px;
    }
    
    /* ==================== 
       TOOL SECTIONS / DEMO SECTION - ENHANCED MOBILE
       ==================== */
    .demo-section {
        flex-direction: column;
        padding: 80px 10px 40px;
        height: auto;
        min-height: auto;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .demo-container {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 0;
    }
    
    .phishing-container,
    .email-container,
    .virus-container {
        padding: 15px 10px;
        height: auto;
        min-height: auto;
        width: 100%;
        max-width: 100%;
    }
    
    .tool-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding-bottom: 15px;
        padding-top: 10px;
    }
    
    .tool-title h2 {
        font-size: 1.3rem;
        margin: 0;
    }
    
    .tool-title p {
        font-size: 0.85rem;
        margin: 5px 0 0 0;
    }
    
    .tool-main {
        padding: 15px 10px;
        width: 100%;
    }
    
    .scan-input-wrapper {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    #phishingInput,
    #emailInput,
    #virusInput {
        width: 100%;
        font-size: 0.9rem;
        padding: 12px;
        box-sizing: border-box;
    }
    
    .scan-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .tool-results {
        padding: 15px 10px;
        width: 100%;
    }
    
    /* Sidebar on mobile - ENHANCED TO SHOW TOOLS */
    .sidebar {
        width: 100%;
        max-width: 100%;
        left: 0;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        display: block !important; /* Always show sidebar on mobile */
        position: relative;
        height: auto;
        max-height: 300px;
        overflow-y: auto;
        margin-bottom: 15px;
    }
    
    /* Mobile sidebar toggle button (for collapsing) */
    .mobile-sidebar-toggle {
        display: flex !important;
        position: absolute;
        top: 70px;
        left: 15px;
        z-index: 997;
        width: 40px;
        height: 40px;
        background: #ffffff;
        border: 1px solid rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        font-size: 1.2rem;
    }
    
    /* Collapsed sidebar state */
    .sidebar.collapsed {
        max-height: 60px !important;
        min-height: 60px !important;
    }
    
    .sidebar.collapsed .tools-section,
    .sidebar.collapsed .tools-list,
    .sidebar.collapsed .tools-label {
        display: none !important;
        opacity: 0;
        visibility: hidden;
    }
    
    .sidebar:not(.collapsed) {
        max-height: 400px !important;
    }
    
    /* FORCE horizontal text in collapsed sidebar - override desktop styles */
    /* Hide the vertical pseudo-element text */
    .sidebar.collapsed::after,
    #sidebar.collapsed::after,
    aside.sidebar.collapsed::after {
        display: none !important;
        content: none !important;
    }
    
    /* Show the sidebar title when collapsed */
    .sidebar.collapsed .sidebar-header,
    #sidebar.collapsed .sidebar-header {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Show the sidebar title when collapsed - override display:none */
    .sidebar.collapsed .sidebar-title,
    #sidebar.collapsed .sidebar-title {
        display: flex !important;
        align-items: center !important;
    }
    
    .sidebar.collapsed .sidebar-header .sidebar-title,
    .sidebar.collapsed .sidebar-title,
    #sidebar.collapsed .sidebar-title,
    aside.sidebar.collapsed .sidebar-title {
        transform: none !important;
        rotate: 0deg !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: calc(100% - 60px) !important;
        font-size: 0.9rem !important;
        letter-spacing: normal !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* Force sidebar header to stay horizontal */
    .sidebar.collapsed .sidebar-header,
    #sidebar.collapsed .sidebar-header,
    aside.sidebar.collapsed .sidebar-header {
        flex-direction: row !important;
        writing-mode: horizontal-tb !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    /* Default sidebar title - always horizontal on mobile */
    .sidebar-title,
    #sidebar .sidebar-title,
    aside.sidebar .sidebar-title {
        transform: none !important;
        rotate: 0deg !important;
        writing-mode: horizontal-tb !important;
        text-orientation: mixed !important;
        font-size: 1rem;
        margin: 0;
    }
    
    .sidebar-header {
        padding: 12px 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(0, 0, 0, 0.02);
        min-height: 36px;
        flex-shrink: 0;
        flex-direction: row !important;
    }
    
    .toggle-btn {
        display: flex !important;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        background: #ffffff;
        border: 1px solid rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        font-size: 1.2rem;
        cursor: pointer;
        padding: 0;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .toggle-btn:active {
        background: rgba(0, 0, 0, 0.05);
        transform: scale(0.95);
    }
    
    .tools-section {
        padding: 10px;
    }
    
    .tools-label {
        font-size: 0.75rem;
        padding: 0 5px;
        margin-bottom: 10px;
    }
    
    .tool-item {
        padding: 12px;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .tool-icon {
        min-width: 24px;
        font-size: 1.2rem;
    }
    
    .tool-name {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .tool-description {
        font-size: 0.75rem;
        color: #666;
    }
    
    .scan-btn {
        width: 100%;
        padding: 12px 20px;
    }
    
    .tool-results {
        padding: 20px 15px;
    }
    
    /* ==================== 
       TOOL CARDS / GRID 
       ==================== */
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px 15px;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    .tool-icon {
        font-size: 2rem;
    }
    
    .tool-name {
        font-size: 1rem;
    }
    
    .tool-description {
        font-size: 0.85rem;
    }
    
    /* ==================== 
       LOCKED TOOL OVERLAY 
       ==================== */
    .locked-tool-overlay {
        left: 0 !important;
        padding: 20px;
    }
    
    .locked-content {
        padding: 30px 20px;
        max-width: 100%;
        margin: 0 15px;
    }
    
    .lock-icon {
        font-size: 36px;
    }
    
    .locked-content h3 {
        font-size: 1.3rem;
    }
    
    .locked-content p {
        font-size: 0.9rem;
    }
    
    .locked-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .locked-actions .btn {
        width: 100%;
    }
    
    /* ==================== 
       AI MODELS SECTION - ENHANCED MOBILE STYLES
       ==================== */
    .ai-models-section {
        padding: 40px 10px;
        overflow-x: hidden;
    }
    
    .ai-models-heading {
        font-size: 1.5rem;
        margin-bottom: 30px;
        padding: 0 10px;
        line-height: 1.3;
    }
    
    .ai-models-wrapper {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 0 10px;
        max-width: 100%;
    }
    
    .ai-models-column {
        display: flex;
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .ai-models-card {
        padding: 15px 15px 15px 50px;
        border-radius: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .ai-models-card h3 {
        font-size: 16px;
        margin: 0 0 4px 0;
    }
    
    .ai-models-tag {
        font-size: 11px;
        padding: 3px 8px;
        margin: 4px 0;
    }
    
    .ai-models-card p {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .ai-models-icon {
        left: 12px;
        width: 24px;
        height: 24px;
    }
    
    .ai-models-center {
        display: none;
    }
    
    /* Show single column layout on mobile */
    .ai-models-wrapper > * {
        width: 100%;
        max-width: 100%;
    }
    
    /* ==================== 
       COMPARISON SECTION 
       ==================== */
    .comparison-section {
        padding: 60px 15px;
    }
    
    .comparison-heading {
        font-size: 1.8rem;
        margin-bottom: 40px;
    }
    
    .comparison-wrapper {
        flex-direction: column;
        gap: 20px;
        padding: 0 15px;
    }
    
    .comparison-column {
        max-width: 100%;
    }
    
    .column-header h3 {
        font-size: 1.1rem;
    }
    
    .metric-item {
        padding: 10px 15px;
    }
    
    .metric-label span {
        font-size: 0.85rem;
    }
    
    .metric-value {
        font-size: 0.9rem;
    }
    
    /* ==================== 
       FOOTER 
       ==================== */
    .main-footer {
        padding: 40px 15px 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }
    
    .footer-brand {
        max-width: 100%;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 20px;
    }
    
    .footer-column h4 {
        margin-bottom: 10px;
    }
    
    .footer-column ul li {
        margin-bottom: 8px;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    /* ==================== 
       MODALS & OVERLAYS 
       ==================== */
    .modal-content {
        width: 95%;
        max-width: 100%;
        margin: 20px;
        padding: 20px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    /* ==================== 
       FORMS (LOGIN/SIGNUP) 
       ==================== */
    .auth-container {
        padding: 100px 15px 40px;
        min-height: auto;
    }
    
    .auth-box {
        padding: 30px 20px;
        max-width: 100%;
    }
    
    .auth-header h2 {
        font-size: 1.6rem;
    }
    
    .form-group input {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .auth-btn {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    /* ==================== 
       ADMIN PANEL 
       ==================== */
    .admin-container {
        padding: 80px 15px 20px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .admin-header h1 {
        font-size: 1.5rem;
    }
    
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .admin-table-container {
        overflow-x: auto;
    }
    
    .admin-table {
        min-width: 600px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    /* ==================== 
       CHAT SUGGESTIONS 
       ==================== */
    .chat-suggestions {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .suggestion-chip {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* ==================== 
       SCROLLBAR HIDE ON MOBILE 
       ==================== */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    /* ==================== 
       TOUCH OPTIMIZATIONS 
       ==================== */
    .btn,
    .action-btn,
    .nav-link,
    .tool-card,
    .suggestion-chip {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent zoom on input focus for iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px;
    }
}

/* ==================== 
   SMALL PHONES (max-width: 480px)
   ==================== */
@media screen and (max-width: 480px) {
    
    .hero-title {
        font-size: 1.7rem;
    }
    
    .hero-description {
        font-size: 0.9rem;
    }
    
    .ai-models-heading,
    .comparison-heading {
        font-size: 1.5rem;
    }
    
    .message {
        max-width: 95%;
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    .tool-title h2 {
        font-size: 1.3rem;
    }
    
    .floating-auth-buttons {
        bottom: 15px;
        right: 10px;
    }
    
    .floating-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .locked-content {
        padding: 25px 15px;
    }
    
    .locked-content h3 {
        font-size: 1.1rem;
    }
    
    .lock-icon {
        font-size: 32px;
    }
}

/* ==================== 
   ADDITIONAL MOBILE FIXES
   ==================== */
@media screen and (max-width: 768px) {
    
    /* Ensure floating auth buttons stay visible and properly sized */
    .floating-auth-buttons {
        max-width: calc(100% - 20px);
        box-sizing: border-box;
    }
    
    .auth-logged-out,
    .auth-logged-in {
        max-width: 100%;
    }
    
    /* AI Models extra fixes */
    .ai-models-section {
        width: 100vw;
        max-width: 100%;
    }
    
    .ai-models-wrapper {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .ai-models-card {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Prevent horizontal scroll on mobile */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Ensure all containers respect mobile viewport */
    .hero-content,
    .demo-container,
    .chat-container,
    .phishing-container,
    .email-container,
    .virus-container {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Fix for navbar on very small screens */
    @media screen and (max-width: 360px) {
        .navbar {
            padding: 10px;
        }
        
        .nav-brand .brand-link {
            font-size: 1.2rem;
        }
        
        .floating-btn {
            padding: 8px 10px;
            font-size: 0.75rem;
        }
        
        .ai-models-heading {
            font-size: 1.3rem;
        }
    }
}

/* ==================== 
   LANDSCAPE ORIENTATION 
   ==================== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    
    .hero {
        padding: 80px 15px 40px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .chat-messages {
        height: calc(100vh - 140px);
    }
    
    .floating-auth-buttons {
        flex-direction: row;
        bottom: 10px;
    }
    
    .sidebar {
        max-height: 70vh;
    }
}

/* ==================== 
   TOUCH DEVICE OPTIMIZATIONS
   ==================== */
@media (hover: none) and (pointer: coarse) {
    
    .btn:hover,
    .action-btn:hover,
    .nav-link:hover {
        transform: none;
    }
    
    .tool-card:hover {
        transform: translateY(-2px);
    }
    
    /* Increase touch targets */
    .nav-link,
    .btn,
    .action-btn {
        padding: 12px 16px;
    }
}

/* ==================== 
   FINAL MOBILE FIXES - Extra small screens
   ==================== */
@media screen and (max-width: 768px) {
    
    /* Force all fixed elements to respect mobile viewport */
    .floating-auth-buttons {
        left: 5px !important;
        right: 5px !important;
        bottom: 10px !important;
    }
    
    /* Make auth buttons stack better on very small screens */
    @media screen and (max-width: 400px) {
        .auth-logged-out {
            flex-direction: column;
            gap: 6px;
        }
        
        .auth-logged-in {
            flex-wrap: wrap;
            justify-content: center;
        }
        
        .floating-btn {
            width: 100%;
            text-align: center;
        }
    }
    
    /* AI Models - ensure proper mobile layout */
    .ai-models-wrapper {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }
    
    .ai-models-column {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .ai-models-card {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
