/* ========================================
   PortretAI.pl - Responsive Stylesheet
   Mobile-first approach
   ======================================== */

/* ========== Mobile Adjustments (320px - 767px) ========== */
@media (max-width: 767px) {
    /* Info tooltip mobile */
    .info-tooltip {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: calc(100vw - 20px);
    }

    /* Typography adjustments */
    :root {
        --font-size-xs: 11px;
        --font-size-sm: 13px;
        --font-size-base: 15px;
        --font-size-lg: 17px;
        --font-size-xl: 20px;
        --font-size-2xl: 28px;
        --font-size-3xl: 36px;
    }

    /* Spacing adjustments */
    section {
        padding: var(--spacing-2xl) 0;
    }

    /* Hero section */
    .hero-section {
        min-height: 40vh;
        padding: var(--spacing-2xl) 0;
    }

    /* Hide hero background photos on mobile for better readability */
    .hero-section::before,
    .hero-section::after {
        display: none;
    }

    .hero-content {
        padding: 0 var(--spacing-sm);
    }

    .logo-text {
        font-size: clamp(28px, 8vw, 40px);
        line-height: 1.1;
    }

    .tagline {
        font-size: clamp(16px, 5vw, 20px);
        margin-bottom: var(--spacing-sm);
    }

    .subtitle {
        font-size: var(--font-size-sm);
        margin-bottom: var(--spacing-lg);
        padding: 0 var(--spacing-sm);
    }

    .stats {
        gap: var(--spacing-lg);
    }

    .stat-number {
        font-size: var(--font-size-xl);
    }

    .stat-label {
        font-size: var(--font-size-xs);
    }

    .cta-button {
        padding: 14px 32px;
        font-size: var(--font-size-base);
    }

    /* Upload section */
    .upload-area {
        padding: var(--spacing-lg);
    }

    .upload-placeholder {
        min-height: 200px;
    }

    .upload-icon {
        width: 48px;
        height: 48px;
    }

    .upload-text {
        font-size: var(--font-size-base);
    }

    .upload-hint {
        font-size: var(--font-size-xs);
    }

    /* Style grid */
    .style-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .style-card-image {
        height: 180px;
    }

    .style-card-image img {
        object-fit: contain;
        object-position: center;
    }

    /* Processing section */
    .generate-button {
        font-size: var(--font-size-lg);
        padding: 16px 40px;
        width: 100%;
        max-width: 100%;
    }

    /* Results section */
    .comparison-desktop {
        display: none;
    }

    .comparison-slider {
        display: block;
    }

    .result-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .result-actions button {
        width: 100%;
    }

    /* Payment card */
    .payment-card {
        padding: var(--spacing-lg);
    }

    .payment-title {
        font-size: var(--font-size-lg);
    }

    .price {
        font-size: 48px;
    }

    .code-input-group {
        flex-direction: column;
    }

    .verify-button {
        width: 100%;
    }

    /* Features section */
    .steps-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .advantages-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .step-number {
        width: 56px;
        height: 56px;
        font-size: var(--font-size-lg);
    }

    /* Examples section */
    .examples-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    /* FAQ section */
    .faq-question {
        padding: var(--spacing-md);
        font-size: var(--font-size-sm);
    }

    .faq-answer p {
        padding: 0 var(--spacing-md) var(--spacing-md);
        font-size: var(--font-size-sm);
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }

    .footer-links {
        align-items: center;
    }

    .footer-bottom {
        font-size: var(--font-size-xs);
    }

    /* Toast notifications */
    .toast-container {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
        bottom: var(--spacing-sm);
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }

    /* Loader */
    .loader-content {
        width: 95%;
        padding: var(--spacing-lg);
    }

    .spinner {
        width: 48px;
        height: 48px;
    }

    .loader-text {
        font-size: var(--font-size-lg);
    }
}

/* ========== Tablet (768px - 1023px) ========== */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Container adjustments */
    .container {
        padding: 0 var(--spacing-xl);
    }

    /* Hero section */
    .hero-section {
        min-height: 80vh;
    }

    /* Smaller hero photos on tablet */
    .hero-section::before,
    .hero-section::after {
        width: 15%;
    }

    .stats {
        gap: var(--spacing-xl);
    }

    /* Style grid */
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }

    /* Results - show both desktop and slider */
    .comparison-desktop {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .comparison-item img {
        max-height: 400px;
    }

    /* Features */
    .steps-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-lg);
    }

    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }

    /* Examples */
    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Payment */
    .payment-card {
        max-width: 600px;
    }
}

/* ========== Desktop (1024px - 1439px) ========== */
@media (min-width: 1024px) {
    /* Container adjustments */
    .container {
        padding: 0 var(--spacing-2xl);
    }

    /* Hero section */
    .stats {
        gap: var(--spacing-3xl);
    }

    /* Style grid - 3 columns on larger screens */
    .style-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Results - always show slider */
    .comparison-desktop {
        display: none;
    }

    .comparison-slider {
        display: block;
    }

    /* Features */
    .advantages-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Examples - 3 columns */
    .examples-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== Large Desktop (1440px+) ========== */
@media (min-width: 1440px) {
    /* Even more spacious layout */
    .container {
        padding: 0 var(--spacing-3xl);
    }

    section {
        padding: var(--spacing-3xl) 0;
    }

    /* Hero adjustments */
    .hero-section {
        padding: 80px 0;
    }

    /* Style grid - could go to 4 columns on very large screens */
    @media (min-width: 1600px) {
        .style-grid {
            grid-template-columns: repeat(4, 1fr);
        }
    }
}

/* ========== Touch Device Optimizations ========== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .style-card,
    .faq-question,
    button,
    a {
        min-height: 44px;
    }

    /* Remove hover effects that don't work well on touch */
    .style-card:hover,
    .step-card:hover,
    .advantage-card:hover,
    .example-card:hover {
        transform: none;
    }

    /* Make sliders easier to use */
    .slider-control::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
    }

    .slider-control::-moz-range-thumb {
        width: 32px;
        height: 32px;
    }
}

/* ========== Print Styles ========== */
@media print {
    /* Hide non-essential elements */
    .hero-section,
    .upload-section,
    .style-section,
    .processing-section,
    .payment-section,
    .footer,
    .loader-overlay,
    .toast-container,
    button {
        display: none !important;
    }

    /* Show results clearly */
    .results-section {
        display: block !important;
    }

    .comparison-desktop {
        display: grid !important;
        page-break-inside: avoid;
    }

    /* Ensure colors print correctly */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Remove backgrounds for better printing */
    body {
        background: white;
    }
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== High Contrast Mode ========== */
@media (prefers-contrast: high) {
    :root {
        --primary: #4338ca;
        --text-primary: #000000;
        --bg-primary: #ffffff;
        --border: #000000;
    }

    .style-card,
    .step-card,
    .advantage-card,
    .payment-card,
    .faq-item {
        border-width: 3px;
    }

    button {
        border: 2px solid currentColor;
    }
}

/* ========== Dark Mode (Optional - for future implementation) ========== */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support
    :root {
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --border: #374151;
        --border-light: #4b5563;
    }

    .hero-section {
        background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    }

    .upload-area,
    .style-card,
    .step-card,
    .advantage-card,
    .payment-card,
    .faq-item,
    .loader-content,
    .toast {
        background: var(--bg-secondary);
        border-color: var(--border);
    }

    .example-placeholder {
        background: var(--bg-tertiary);
    }
    */
}

/* ========== Landscape Orientation (Mobile) ========== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--spacing-xl) 0;
    }

    .stats {
        flex-direction: row;
    }

    .upload-placeholder {
        min-height: 150px;
    }

    .loader-overlay {
        padding: var(--spacing-sm);
    }

    .loader-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ========== Small Devices Only (max 320px) ========== */
@media (max-width: 320px) {
    :root {
        --spacing-xs: 2px;
        --spacing-sm: 6px;
        --spacing-md: 12px;
        --spacing-lg: 18px;
        --spacing-xl: 24px;
        --spacing-2xl: 36px;
        --spacing-3xl: 48px;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .logo-text {
        font-size: 32px;
    }

    .payment-card,
    .loader-content {
        padding: var(--spacing-md);
    }

    .price {
        font-size: 40px;
    }

    .benefit-item {
        font-size: var(--font-size-sm);
    }
}

/* ========== Focus Visible (Keyboard Navigation) ========== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
.style-card:focus-visible,
.faq-question:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ========== Download Modal Responsive ========== */
@media (max-width: 767px) {
    .download-modal-content {
        padding: var(--spacing-lg);
        max-width: 95%;
    }

    .download-modal-title {
        font-size: var(--font-size-lg);
    }

    .download-warning {
        flex-direction: column;
        text-align: center;
    }

    .download-warning svg {
        margin: 0 auto;
    }

    .download-email-group {
        flex-direction: column;
    }

    .download-email-btn {
        width: 100%;
        justify-content: center;
    }

    /* Examples modal responsive */
    .examples-modal {
        padding: var(--spacing-sm);
    }

    .examples-modal-close {
        top: -40px;
        width: 36px;
        height: 36px;
    }

    .examples-modal-slider {
        max-height: 70vh;
        aspect-ratio: 3/4;
    }

    .examples-slider-handle {
        width: 40px;
        height: 40px;
    }

    .examples-slider-labels {
        padding: 0 var(--spacing-sm);
        top: var(--spacing-sm);
    }

    .examples-label-before,
    .examples-label-after {
        font-size: var(--font-size-xs);
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .download-modal {
        padding: var(--spacing-sm);
    }

    .download-option-btn {
        font-size: var(--font-size-base);
        padding: var(--spacing-md);
    }
}

/* ========== Screen Reader Only ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
