/*
  Vidia Mobile-Specific Stylesheet
  ---
  This file contains all responsive overrides to make the dashboard mobile-friendly,
  beautiful, and consistent with Vidia's design language.
*/

/* --- Base Mobile & Tablet Styles (max-width: 768px) --- */
@media (max-width: 768px) {
    /* 1. Layout & Grid Responsiveness */
    .container {
        padding: 0.5rem 1rem;
    }

    .main-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .header-content,
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }

    .auth-buttons {
        width: 100%;
        justify-content: space-between;
    }

    /* 2. Upload & Result Areas */
    .upload-area,
    .result-area {
        aspect-ratio: 4 / 3;
        min-height: 220px;
        max-height: 60vh;
        margin-bottom: 1rem;
    }

    /* 3. Typography */
    .mode-title,
    .generate-button,
    .result-button {
        font-size: clamp(1rem, 1.2vw + 0.7rem, 1.3rem);
    }

    .logo {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .logo img {
        width: 40px;
        margin-right: 0.75rem;
    }

    /* 4. Controls & Toggles */
    .advanced-setting {
        flex-direction: column;
        align-items: flex-start;
    }

    .advanced-setting-control {
        width: 100%;
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }

    .toggle-container {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        gap: 0.75rem;
        padding-left: 0.5rem;
    }

    .toggle-label {
        flex: 1;
        white-space: normal;
        word-wrap: break-word;
    }

    .switch {
        --switch_width: 3em;
        --switch_height: 1.5em;
    }

    /* 5. Buttons & Action Areas */
    .generate-button-area {
        position: sticky;
        bottom: 0;
        padding: 0.75rem;
        background: var(--background-color);
        border-top: 1px solid rgba(var(--primary-color-light), 0.2);
        z-index: 50;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .button-container {
        flex-direction: column;
    }

    .split-button {
        margin: 0;
        margin-bottom: 1rem;
    }

    .advanced-button {
        width: 100%;
    }

    /* 6. Drawer & Side Panels */
    .lora-gallery-drawer {
        width: 100%;
        height: auto;
        max-height: 75vh;
        top: auto;
        bottom: -100%;
        right: 0;
        border-left: none;
        border-top: 2px solid var(--primary-color);
        transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .lora-gallery-content {
      max-height: calc(75vh - 80px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .lora-gallery-drawer.open {
        bottom: 0;
    }

    /* 7. Notifications */
    .notifications-container {
        bottom: 15px;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
    }

    /* 8. Performance & Animations */
    @media (prefers-reduced-motion: reduce) {
      .wave, .glow-overlay, .mode-indicator, .defining-feature::after {
        animation: none !important;
      }
    }

    /* 9. Header & Footer */
    .mode-indicator {
        position: static;
        transform: none;
        margin: 0.5rem 0;
        flex-direction: row;
        gap: 1rem;
        padding: 0.75rem 1rem;
        justify-content: center;
        animation: none;
    }

    .footer-section {
        width: 100%;
        text-align: center;
        margin: 0.5rem 0;
    }

    .main-footer-row, .footer-nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-separator {
        display: none;
    }

    /* 10. Accessibility & Touch Targets */
    button, .auth-button, .generate-button, .advanced-button, .go-back-button, .lora-gallery-button, .top-up-button, input[type="range"] {
        min-height: 48px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 30px;
        height: 30px;
    }

    select, input[type="text"], input[type="number"] {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
        height: 48px;
    }

    .prompt-template {
        flex-direction: column;
        gap: 1rem;
    }

    .background-input-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .vertical-separator {
        display: none;
    }
}

/* --- Small Phone Specific Adjustments (max-width: 480px) --- */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem 0.75rem;
    }

    .mode-indicator {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .mode-logo {
        width: 28px;
        height: 28px;
    }

    .mode-title {
        font-size: clamp(0.9rem, 1vw + 0.6rem, 1.1rem);
    }

    .generate-button {
        font-size: 1rem;
        padding: 0.75rem 0.5rem;
    }

    .advanced-setting-label {
        font-size: 0.9rem;
    }

    .wave, .glow-overlay {
        animation: none !important;
    }
}

/* --- Tablet-specific optimizations (min-width: 769px) and (max-width: 1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-section {
        grid-template-columns: 1fr; /* Stack on tablets as well for better focus */
        gap: 2rem;
    }

    .advanced-section {
        padding: 1.5rem;
    }

    .advanced-dropdown-content {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }
}

/* --- iOS-specific adjustments for visual consistency --- */
@supports (-webkit-touch-callout: none) {
    .mode-logo {
        transform: scale(0.95);
    }
    
    .mode-logo svg {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}
