/* ====================================
   MOBILE STYLES (max-width: 900px)
   Minimal - nur notwendige Anpassungen
   ==================================== */

@media (max-width: 900px) {

    /* ===== HEADER MOBILE ===== */
    header {
        padding: 0 1rem;
        /* Removed vertical padding to gain space */
        z-index: 2005 !important;
        height: 52px !important;
        /* Smaller height */
        display: flex !important;
        align-items: center !important;
    }

    .header-content {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        grid-template-columns: unset !important;
        padding: 0 !important;
    }

    .header-left {
        display: none !important;
    }

    /* Hamburger Button - LEFT */
    .mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        order: 1;
        background: transparent;
        border: none;
        padding: 0;
        cursor: pointer;
        width: 32px;
        height: 32px;
        z-index: 2100;
        position: relative;
        transition: transform 0.2s ease;
    }

    .mobile-hamburger span {
        position: absolute;
        display: block;
        width: 24px;
        height: 2px;
        background-color: #ffffff;
        border-radius: 4px;
        transition: all 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    }

    /* Initial Positions */
    .mobile-hamburger span:nth-child(1) {
        transform: translateY(-8px);
        width: 20px;
        right: 4px;
    }

    .mobile-hamburger span:nth-child(2) {
        transform: translateY(0);
        width: 24px;
    }

    .mobile-hamburger span:nth-child(3) {
        transform: translateY(8px);
        width: 16px;
        right: 4px;
    }

    /* Transform to X when open */
    .mobile-hamburger.open span:nth-child(1) {
        transform: rotate(45deg);
        width: 24px;
        right: auto;
    }

    .mobile-hamburger.open span:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }

    .mobile-hamburger.open span:nth-child(3) {
        transform: rotate(-45deg);
        width: 24px;
        right: auto;
    }

    .mobile-hamburger:active {
        transform: scale(0.9);
    }

    .mobile-hamburger:active {
        transform: scale(0.92);
    }

    /* User Button RIGHT */
    .header-right {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        order: 3;
        flex-shrink: 0;
        position: relative;
        z-index: 2200;
        /* Ensure it's on top */
    }

    /* Mobile nav: Show flexbox but center only the logo */
    nav {
        display: flex !important;
        justify-content: center;
        align-items: center;
        order: 2;
        width: auto;
        flex: 1;
        pointer-events: none;
        /* Prevent nav from blocking clicks on hamburger/user icon */
    }

    /* Hide nav groups (left and right navigation) */
    .nav-group {
        display: none !important;
    }

    /* Show logo in nav on mobile */
    .header-logo-container {
        display: flex !important;
        justify-content: center;
        align-items: center;
        opacity: 1 !important;
        visibility: visible !important;
        width: auto !important;
        margin: 0 !important;
        transform: none !important;
        pointer-events: auto !important;
        gap: 0.5rem;
    }

    .logo-title {
        font-size: 1.15rem !important;
        white-space: nowrap !important;
        font-weight: 600 !important;
    }

    .user-icon-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 50% !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        z-index: 2500 !important;
    }

    #user-status-dot {
        width: 10px !important;
        height: 10px !important;
        top: 2px !important;
        right: 2px !important;
    }

    .user-menu {
        position: fixed !important;
        top: 52px !important;
        /* Match new header height */
        right: 15px !important;
        width: 220px !important;
        z-index: 3000 !important;
    }

    .logo-tagline {
        display: block !important;
        font-size: 0.55rem;
        opacity: 1;
        white-space: nowrap;
    }

    .header-logo-element {
        display: flex;
        align-items: center;
    }

    .header-logo-element img {
        width: 32px;
        height: auto;
        object-fit: contain;
    }

    /* Hide desktop dropdowns and contact button */
    .lang-selector,
    .social-dropdown,
    #contact-nav-btn {
        display: none !important;
    }

    /* ===== MOBILE MENU ===== */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(26, 60, 40, 0.98);
        backdrop-filter: blur(8px);
        z-index: 1999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .mobile-menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        z-index: 1998;
        transition: all 0.3s ease;
    }

    .mobile-menu-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu.open {
        left: 0;
    }

    .mobile-menu-content {
        padding: 5rem 1.5rem 2rem 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 0;
        position: relative;
    }

    /* Close Button */
    .mobile-menu-close {
        position: absolute;
        top: 1rem;
        right: 1.5rem;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.8rem;
        cursor: pointer;
        padding: 0.5rem;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        z-index: 2000;
    }

    .mobile-menu-close:active {
        transform: scale(0.9);
        opacity: 0.7;
    }

    .mobile-menu-link {
        color: white;
        text-decoration: none;
        padding: 1rem 1rem;
        font-family: 'Josefin Sans', sans-serif;
        font-size: 0.95rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 6px;
        transition: all 0.2s ease;
        display: block;
    }

    .mobile-menu-link:active {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Mobile Menu Dropdowns */
    .mobile-menu-dropdown {
        position: relative;
    }

    .mobile-menu-dropdown-btn {
        width: 100%;
        background: transparent;
        border: none;
        color: white;
        padding: 1rem 1rem;
        font-family: 'Josefin Sans', sans-serif;
        font-size: 0.95rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        cursor: pointer;
        border-radius: 6px;
        transition: all 0.2s ease;
        text-align: left;
    }

    .mobile-menu-dropdown-btn:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-dropdown-content {
        display: none;
        flex-direction: column;
        gap: 0;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 6px;
        overflow: hidden;
        margin: 0 1rem;
    }

    .mobile-menu-dropdown-content.open {
        display: flex;
    }

    .mobile-menu-dropdown-content a {
        color: white;
        text-decoration: none;
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
        transition: all 0.2s ease;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-dropdown-content a:last-child {
        border-bottom: none;
    }

    .mobile-menu-dropdown-content a:active {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Mobile Menu Backdrop */
    .mobile-menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        z-index: 1998;
        transition: all 0.3s ease;
    }

    .mobile-menu-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    .dropdown-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .dropdown-inner {
        width: 160px;
    }

    .dropdown-content a {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        gap: 8px;
    }

    /* Hero */
    .hero-card {
        display: none;
    }

    .content-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        margin: 0 auto !important;
    }

    .split-layout {
        width: 100% !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: center !important;
        display: flex !important;
        gap: 1.5rem !important;
        margin: 0 auto !important;
    }

    .input-column,
    .result-column {
        width: 100% !important;
        max-width: 500px !important;
        /* Limit width for better mobile readability */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: center !important;
        margin: 0 auto !important;
    }

    /* Sections handled in wizard section below */
    .step-header {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 auto 1rem auto !important;
    }

    .step-header h2 {
        margin-bottom: 0.5rem !important;
        text-align: center !important;
    }

    .input-group {
        width: 100% !important;
        max-width: 350px !important;
        /* Reduced width */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        margin: 0 auto 1.5rem auto !important;
    }

    .input-group label {
        text-align: center !important;
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }

    .controls {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.8rem !important;
        margin: 1rem auto !important;
    }

    h2 {
        font-size: 1.25rem !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
        width: 100% !important;
    }

    .step-section>p {
        text-align: center !important;
        margin: 0 auto 1.2rem auto !important;
        width: 100% !important;
    }

    /* Progress Bar */
    /* Progress Bar handled in wizard section below */


    /* Camera Area */
    .camera-container {
        width: 100% !important;
        max-width: 400px !important;
        height: 300px !important;
        margin: 0 auto 1rem auto !important;
    }

    /* Photo Mode Selector */
    .photo-mode-selector {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 1rem !important;
        margin: 0 auto 1.5rem auto !important;
    }

    .mode-label {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Controls */
    .controls {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 38px;
    }

    #start-camera-btn {
        flex: 1;
        min-width: 140px;
    }

    /* Input */
    .input-group {
        max-width: 100%;
    }

    input[type="number"],
    input[type="url"] {
        width: 100% !important;
        max-width: 330px !important;
        /* Reduced width */
        padding: 0.7rem;
        font-size: 1.1rem;
        min-height: 44px;
        text-align: center;
    }

    label {
        font-size: 0.9rem;
    }

    /* Garment Grid - 2 columns (3 rows x 2 cols) */
    .garment-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .drop-zone {
        min-height: 130px;
        padding: 0.8rem;
        border-radius: 10px;
    }

    .drop-zone p {
        font-size: 0.95rem;
    }

    .garment-preview {
        max-height: 140px;
        margin-top: 0.6rem;
    }

    .remove-btn,
    .save-garment-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    /* Primary Button */
    .primary-btn {
        font-size: 1rem;
        padding: 0.9rem 1.5rem;
        max-width: 100%;
    }

    /* Result Area */
    #result-area {
        padding: 1.2rem;
        min-height: 250px;
        margin-top: 1rem;
    }

    .loader {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(255, 255, 255, 0.3);
        border-top: 3px solid #1a3c28;
    }

    #result-image {
        max-height: 400px;
    }

    .result-actions {
        gap: 0.6rem;
        margin-top: 1rem;
    }

    .secondary-btn,
    .small-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
        min-width: 100px;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 1.5rem 1rem;
        border-radius: 14px;
    }

    .close-modal {
        font-size: 1.6rem;
        top: 10px;
        right: 15px;
    }

    /* Closet */
    #closet-modal .modal-content {
        border-radius: 0;
    }

    .closet-tabs {
        gap: 0.4rem;
        padding: 0.8rem;
    }

    .closet-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    .closet-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
        padding: 1rem;
    }

    .closet-item {
        padding: 0;
    }

    .closet-item img {
        aspect-ratio: 3 / 4;
    }

    .item-category {
        font-size: 0.65rem;
        padding: 0.6rem 0.8rem;
    }

    /* --- Wizard & Navigation Fix --- */
    .wizard-progress-bar {
        width: 100% !important;
        max-width: 450px !important;
        margin: 0 auto 1.5rem auto !important;
        display: flex !important;
        background: rgba(113, 183, 142, 0.8) !important;
        border-radius: 50px !important;
        padding: 0 !important;
        position: relative !important;
        z-index: 100 !important;
        overflow: hidden !important;
        /* Keep pill inside borders */
    }

    .wizard-step {
        flex: 1 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem !important;
        padding: 12px 5px !important;
        /* Increased padding slightly for better height */
        color: #1a3c28 !important;
        z-index: 102 !important;
        background: transparent !important;
        white-space: nowrap;
    }

    .wizard-step.active {
        color: #ffffff !important;
        font-weight: 600 !important;
    }

    .wizard-pill {
        position: absolute !important;
        background: #2d5a3d !important;
        z-index: 101 !important;
        height: 100% !important;
        top: 0 !important;
        border-radius: 50px !important;
        transition: all 0.4s ease !important;
    }

    .step-section {
        display: none;
        width: 100% !important;
    }

    .step-section.active-step {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        animation: fadeIn 0.3s ease;
    }

    .wizard-navigation {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        margin-top: 2rem !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        pointer-events: auto !important;
    }

    .wizard-btn {
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        border-radius: 50px !important;
    }



    #result-area {
        padding: 1rem;
    }


    #result-image {
        max-width: 100%;
    }

    .result-image-container {
        max-width: 100%;
    }

    .result-overlay-top {
        top: 0.5rem;
        padding: 0.4rem 1rem;
    }

    .result-overlay-top h2 {
        font-size: 1rem;
        margin-bottom: 0rem !important;
    }

    .result-overlay-bottom {
        bottom: 0.5rem;
        padding: 0 0.5rem;
        gap: 0.5rem;
    }

    .result-overlay-bottom button {
        font-size: 0.75rem;
        padding: 0.5rem 0.8rem;
    }

    .delete-item-btn {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .empty-message {
        padding: 2rem 1rem;
        font-size: 0.9rem;
    }

    /* Lightbox */
    .lightbox {
        background-color: rgba(0, 0, 0, 0.98);
        cursor: pointer;
    }

    #lightbox-img {
        max-width: 90%;
        /* Slightly smaller for more space */
        max-height: 70%;
        /* Give more space top/bottom for clicking */
        cursor: default;
    }

    .close-lightbox {
        position: absolute !important;
        top: 60px !important;
        right: 20px !important;
        width: auto !important;
        height: auto !important;
        background: none !important;
        border: none !important;
        color: white !important;
        font-size: 45px !important;
        font-weight: 300 !important;
        text-shadow: 0 0 12px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.7) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 2200 !important;
        box-shadow: none !important;
        padding: 10px !important;
        line-height: 0.8 !important;
        transition: opacity 0.2s !important;
    }

    .close-lightbox:active {
        opacity: 0.6;
    }

    .zoom-controls {
        right: 20px;
        width: 45px;
        height: 220px;
        top: 60%;
        /* Position it lower to not overlap with X button area too much */
        transform: translateY(-50%);
        background: rgba(10, 10, 10, 0.85);
        /* Solid dark background */
        border: 1px solid rgba(255, 255, 255, 0.4);
        border-radius: 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }

    #zoom-slider {
        width: 160px;
        height: 6px;
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(-90deg);
        transform-origin: center;
        margin: 0;
    }

    /* Privacy Banner */
    .privacy-banner {
        padding: 1rem;
    }

    .banner-content {
        flex-direction: column;
        gap: 0.8rem;
    }

    .banner-content p {
        font-size: 0.8rem;
    }

    #accept-privacy-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    /* AI Agent */
    .ai-agent-container {
        bottom: 70px;
        right: 10px;
        gap: 10px;
    }

    .ai-magic-btn {
        width: 50px;
        height: 50px;
    }

    .ai-bubble {
        max-width: 220px;
        padding: 0.9rem 1rem;
        font-size: 0.85rem;
    }

    /* Auth Modal */
    #auth-modal input,
    #auth-modal textarea {
        font-size: 16px;
        /* Prevent iOS zoom */
        min-height: 40px;
    }

    /* User Dropdown */
    .user-menu {
        min-width: 160px;
        right: -0.5rem;
    }

    .user-menu .dropdown-inner a {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Extra small phones */
@media (max-width: 480px) {
    .hero-card h1 {
        font-size: 1.6rem;
    }

    .content-container {
        padding: 1rem;
    }

    h2 {
        font-size: 1rem;
    }

    .step-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .clear-all-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    .garment-grid {
        gap: 0.8rem;
    }

    .controls {
        gap: 0.4rem;
    }

    button {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }

    .primary-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
    }

    .closet-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    /* Adjust countdown for small screens */
    #photo-countdown {
        font-size: 5rem;
    }
}

.silhouette-face {
    width: 270px;
    height: 270px;
}