/* ========================================
   RESPONSIVE STYLES FOR AITOOLS
   Mobile: 0 - 640px
   Tablet: 641px - 1024px
   Desktop: 1025px+
   ======================================== */

/* ========================================
   MOBILE NAVIGATION - Hamburger Menu
   ======================================== */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-nav-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
}

.hamburger-icon {
    width: 24px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary, #f9fafb);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-nav-toggle.open .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.open .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.open .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Dropdown Menu */
.mobile-nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.mobile-nav-dropdown.open {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-dropdown .nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-dropdown .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.mobile-nav-dropdown .nav-link:hover,
.mobile-nav-dropdown .nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue-glow);
}

/* ========================================
   TABLET STYLES (641px - 1024px)
   ======================================== */
@media (max-width: 1024px) {
    /* Dashboard Layout */
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
    
    /* Bento Grid */
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Landing Page Hero */
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .hero-visual {
        order: -1;
        max-width: 500px;
        margin: 0 auto;
    }
    
    /* Documentation */
    .docs-layout {
        grid-template-columns: 200px 1fr;
    }
    
    .docs-code-column {
        display: none;
    }
    
    /* Pricing Cards */
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pricing-card.featured {
        grid-column: span 2;
        max-width: 400px;
        margin: 0 auto;
    }
}

/* ========================================
   MOBILE STYLES (0 - 640px)
   ======================================== */
@media (max-width: 640px) {
    /* Show mobile hamburger menu */
    .mobile-nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        z-index: 100;
        background: rgba(59, 130, 246, 0.1);
        border-radius: 8px;
    }
    
    /* Mobile Sidebar - slides in from left */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1001;
        transition: left 0.3s ease;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* Adjust main content */
    .main-content {
        margin-left: 0;
    }
    
    /* Dashboard Header */
    .dashboard-header {
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
    }
    
    .breadcrumbs {
        display: none;
    }
    
    .header-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
        margin-left: auto;
    }
    
    .credit-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Dashboard Content */
    .dashboard-content {
        padding: 1rem;
    }
    
    /* Bento Grid - Single Column */
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Section Title */
    .section-title {
        font-size: 1rem;
    }
    
    /* API Key Section */
    .api-key-container {
        padding: 1rem;
    }
    
    .api-key-input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .api-key-input {
        font-size: 0.75rem;
    }
    
    .api-key-input-group .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Chart */
    .chart-wrapper {
        height: 160px;
    }
    
    .chart-y-axis {
        font-size: 0.6rem;
        min-width: 25px;
    }
    
    .bar-label {
        font-size: 0.55rem;
    }
    
    .bar-column {
        max-width: 40px;
    }
    
    .bar {
        max-width: 28px;
    }
    
    /* Usage Stats Grid */
    .usage-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .usage-stat-item {
        padding: 0.75rem;
    }
    
    .stat-info .stat-value {
        font-size: 1.25rem;
    }
    
    /* ========================================
       LANDING PAGE MOBILE
       ======================================== */
    .landing-nav {
        padding: 0.75rem 1rem !important;
    }
    
    .landing-nav-buttons {
        gap: 0.5rem !important;
    }
    
    .landing-nav-buttons a {
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }
    
    .hero-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        padding: 2rem 1rem !important;
    }
    
    .hero-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .hero-visual {
        display: none !important;
    }
    
    .hero-cta-group {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .hero-cta-group button,
    .hero-cta-group a,
    .btn-hero-primary,
    .btn-hero-secondary {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.875rem 1.5rem !important;
    }
    
    .hero-stats {
        gap: 1.5rem !important;
        justify-content: space-between !important;
    }
    
    .hero-stats > div > div:first-child {
        font-size: 1.5rem !important;
    }
    
    .hero-stats > div > div:last-child {
        font-size: 0.75rem !important;
    }
    
    /* ========================================
       AUTH PAGES MOBILE (Login/Register)
       ======================================== */
    .auth-container {
        padding: 1rem !important;
    }
    
    .auth-card {
        padding: 1.5rem !important;
        margin: 0 !important;
    }
    
    .auth-card h1 {
        font-size: 1.5rem !important;
    }
    
    /* ========================================
       PRICING PAGE MOBILE
       ======================================== */
    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .pricing-card {
        transform: none !important;
        padding: 1.5rem !important;
    }
    
    /* ========================================
       DOCUMENTATION PAGE MOBILE
       ======================================== */
    .docs-layout {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .docs-sidebar {
        display: none !important;
        position: static !important;
    }
    
    .docs-layout main {
        padding: 0 !important;
    }
    
    .docs-layout main h1 {
        font-size: 1.75rem !important;
    }
    
    .docs-layout main h2 {
        font-size: 1.25rem !important;
    }
    
    .docs-layout > aside:last-child {
        display: none !important;
    }
    
    /* ========================================
       DEMO PAGE MOBILE
       ======================================== */
    .demo-container {
        padding: 1rem !important;
    }
    
    .upload-zone {
        padding: 1.5rem 1rem !important;
        min-height: 180px !important;
    }
    
    .upload-zone h3 {
        font-size: 1rem !important;
    }
    
    .usage-banner {
        padding: 1rem !important;
    }
    
    .face-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* ========================================
       BILLING PAGE MOBILE
       ======================================== */
    .billing-cards {
        grid-template-columns: 1fr !important;
    }
    
    /* ========================================
       API KEYS PAGE MOBILE
       ======================================== */
    .keys-list {
        gap: 1rem !important;
    }
    
    .key-item {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    .key-actions {
        flex-direction: row !important;
        justify-content: flex-end !important;
    }
    
    /* Demo Section */
    .demo-section {
        padding: 1.5rem 1rem;
    }
    
    .demo-title {
        font-size: 1.5rem;
    }
    
    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-card {
        padding: 1.25rem;
    }
    
    /* Profile Page */
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-card {
        padding: 1.25rem;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .profile-avatar-large {
        width: 80px;
        height: 80px;
    }
    
    /* Billing Page */
    .billing-grid {
        grid-template-columns: 1fr;
    }
    
    .billing-card {
        padding: 1.25rem;
    }
    
    /* Modal/Dialog */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.25rem;
    }
    
    /* Forms */
    .form-input,
    .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    /* Profile Dropdown */
    .profile-dropdown {
        width: 260px;
        right: -0.5rem;
    }
    
    /* Hide on Mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Show on Mobile */
    .show-mobile {
        display: block !important;
    }
    
    /* Text Adjustments */
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.375rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    /* Spacing Adjustments */
    .section {
        padding: 2rem 1rem;
    }
    
    .section-lg {
        padding: 3rem 1rem;
    }
}

/* ========================================
   SMALL MOBILE (0 - 380px)
   ======================================== */
@media (max-width: 380px) {
    .hero-title {
        font-size: 1.625rem;
    }
    
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .credit-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .profile-dropdown {
        width: calc(100vw - 2rem);
        right: -0.5rem;
    }
    
    .chart-wrapper {
        height: 140px;
    }
    
    .bar-label {
        font-size: 0.5rem;
    }
}

/* ========================================
   LANDSCAPE MOBILE
   ======================================== */
@media (max-width: 640px) and (orientation: landscape) {
    .landing-hero {
        padding: 1.5rem 1rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .chart-wrapper {
        height: 120px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-link {
        padding: 1rem;
        min-height: 48px;
    }
    
    .btn {
        min-height: 44px;
    }
    
    .form-input,
    .form-select {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch */
    .stat-card:hover {
        transform: none;
    }
    
    .bar:hover {
        filter: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .sidebar,
    .mobile-nav-toggle,
    .mobile-nav-dropdown,
    .dashboard-header {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-content {
        padding: 0;
    }
}

