/* Responsive Styles for Mix Analyzer */

/* Base Mobile Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
    
    .results-section {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .app-title {
        text-align: left;
    }
    
    /* Intro Section */
    .intro-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .intro-section h2 {
        font-size: 1.4rem;
    }
    
    .intro-section p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    /* Upload Area */
    .upload-area {
        align-items: stretch;
        justify-content: flex-start;
        width: min(calc(100% - 28px), 420px);
        min-height: 0;
        height: auto !important;
        margin-left: auto;
        margin-right: auto;
        padding: 14px;
        gap: 8px;
        text-align: left;
        border-style: solid;
        border-radius: 16px;
    }

    .upload-area::after,
    .upload-area.show-indicator::after,
    .upload-area.show-button-indicator .button-wrapper::before {
        display: none !important;
    }

    .upload-icon {
        align-self: flex-start;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        margin-bottom: 0;
        border: 1px solid rgba(56, 189, 248, 0.2);
        border-radius: 10px;
        background: rgba(56, 189, 248, 0.08);
    }

    .upload-icon svg {
        width: 22px;
        height: 22px;
    }

    .upload-title {
        margin: 0;
        font-size: 1.08rem;
        line-height: 1.15;
        text-align: left;
    }

    .upload-subtitle {
        margin: 0;
        font-size: 0.82rem;
        line-height: 1.35;
        text-align: left;
    }

    .upload-copy-desktop {
        display: none;
    }

    .upload-copy-mobile {
        display: inline;
    }

    .upload-credit-hint {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .button-wrapper {
        width: 100%;
        margin: 6px 0 0;
        align-items: stretch;
    }

    /* Make upload button more prominent on mobile */
    .upload-button {
        width: 100%;
        min-height: 48px;
        padding: 0 16px;
        margin-top: 0;
        font-size: 0.96rem;
        font-weight: 700;
        border-radius: 12px;
        background: var(--gradient-primary);
        color: white;
        box-shadow: var(--shadow-md);
    }

    .upload-button svg {
        width: 18px;
        height: 18px;
    }

    .upload-format-help {
        margin-top: 8px;
        font-size: 0.76rem;
        font-weight: 500;
        line-height: 1.35;
        text-align: center;
    }

    .upload-model-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .upload-model-card {
        min-height: 128px;
        padding: 14px;
    }

    .upload-setup-continue {
        width: 100%;
    }
    
    /* Track Type Selector */
    .track-type-selector {
        padding: 15px 10px;
        flex-direction: column;
    }
    
    .info-tooltip {
        margin-left: 0;
        margin-top: 10px;
    }
    
    /* Progress Steps */
    .progress-steps {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .progress-step {
        margin-bottom: 10px;
    }
    
    .progress-step:not(:last-child)::after {
        display: none;
    }
}

/* Mobile Tabs System */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 12px 10px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        background-color: var(--card-bg);
        border-radius: 12px;
        margin: 0 0 15px 0;
        box-shadow: var(--shadow-md);
        position: sticky;
        top: 0;
        z-index: 10;
        scrollbar-width: none; /* Hide scrollbar Firefox */
        display: flex;
        align-items: center;
    }
    
    /* Scrollbar hiding for Webkit */
    .tabs::-webkit-scrollbar {
        height: 0;
        width: 0;
        display: none;
    }
    
    /* Start with the first tab visible by default */
    .tabs {
        scroll-padding-left: 10px;
    }
    
    .tab-button {
        padding: 12px 16px;
        white-space: nowrap;
        scroll-snap-align: start;
        flex: 0 0 auto;
        font-size: 16px;
        font-weight: 500;
        border-radius: 10px;
        margin-right: 8px;
        transition: all 0.2s ease;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        border: 1px solid transparent;
    }
    
    /* Indicate tabs are clickable with visual cue */
    .tab-button:not(.active) {
        background: var(--surface-elevated);
        border: var(--glass-border);
    }
    
    .tab-button.active {
        background-color: var(--primary-color);
        color: white;
        box-shadow: var(--shadow-md);
        transform: translateY(-2px) scale(1.05);
    }
    
    /* Visual tap feedback */
    .tab-button:active {
        transform: scale(0.95);
    }
    
    .tab-button.active:active {
        transform: translateY(-2px) scale(0.98);
    }
    
    /* Tap indicator for first tab */
    .tab-button.tap-indicator {
        position: relative;
        animation: pulse-highlight 2s infinite;
    }
    
    .tab-button.tap-indicator::after {
        content: '';
        position: absolute;
        top: -5px;
        right: -5px;
        width: 12px;
        height: 12px;
        background-color: var(--danger);
        border-radius: 50%;
        box-shadow: 0 0 0 rgba(255, 85, 85, 0.4);
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0% {
            transform: scale(0.95);
            box-shadow: 0 0 0 0 rgba(255, 85, 85, 0.7);
        }
        70% {
            transform: scale(1);
            box-shadow: 0 0 0 10px rgba(255, 85, 85, 0);
        }
        100% {
            transform: scale(0.95);
            box-shadow: 0 0 0 0 rgba(255, 85, 85, 0);
        }
    }
    
    @keyframes pulse-highlight {
        0%, 100% { background: var(--surface-elevated); }
        50% { background-color: var(--surface-elevated); }
    }
    
    /* Add label for tabs */
    .tabs::before {
        content: 'Tabs:';
        font-size: 14px;
        font-weight: 500;
        color: var(--text-secondary);
        margin-right: 10px;
        flex-shrink: 0;
        display: block;
    }
    
    /* Add more visible indicator for horizontal scrolling */
    .tabs::after {
        content: '';
        padding: 0 5px;
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234361ee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        opacity: 0.6;
        animation: bounce-horizontal 1.5s infinite;
    }
    
    @keyframes bounce-horizontal {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(5px); }
    }
}

/* Mobile Analysis Cards */
@media (max-width: 768px) {
    .score-container {
        flex-direction: column;
    }
    
    .score-container .score-card {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .metrics-container {
        flex-direction: column;
    }
    
    .metric {
        width: 100%;
        margin-bottom: 12px;
        padding: 15px;
    }
    
    /* Analysis content improvements */
    .analysis-card {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .analysis-card h3 {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .analysis-card ul {
        padding-left: 0;
        margin: 0;
    }
    
    .analysis-card li {
        padding: 8px 0;
        line-height: 1.4;
        font-size: 16px;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    /* AI Insights Tab */
    .ai-sections-container {
        flex-direction: column;
    }
    
    .ai-section-card {
        width: 100%;
        margin-bottom: 15px;
        padding: 15px;
    }
    
    .ai-section-card h4 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .ai-section-card ul {
        padding-left: 0;
        margin: 0;
    }
    
    .ai-section-card li {
        padding: 6px 0;
        margin-bottom: 8px;
        line-height: 1.4;
        font-size: 16px;
        display: flex;
    }
    
    .ai-section-card li:before {
        content: "•";
        margin-right: 8px;
        color: var(--primary-color);
    }
    
    /* Score display improvements */
    .score-value {
        font-size: 32px;
        margin: 10px 0;
    }
    
    /* Tab improvements */
    .tab-pane {
        padding: 15px 12px;
    }
}

/* Visualizations Mobile Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0;
        grid-template-columns: 
            [full-start] minmax(0rem, 1fr) 
            [main-start] minmax(0, 100%) [main-end]
            minmax(0rem, 1fr) [full-end];
    }
    .visualization-grid {
        grid-template-columns: 1fr;
    }
    
    .visualization-container {
        max-height: 200px;
    }
    
    .visualization-card {
        margin-bottom: 20px;
    }
    
    /* Make visualizations tap-friendly */
    .visualization-container:hover::after {
        content: '🔍';
        position: absolute;
        top: 10px;
        right: 10px;
        display: flex;
        opacity: 0.7;
    }
    
    /* Preserve touch scrolling in charts */
    canvas {
        touch-action: pan-y;
    }
}

/* Footer Mobile Adjustments */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
    }
    
    .footer-section {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .footer-section h3 {
        font-size: 1.2rem;
    }
    
    .footer-bottom {
        padding: 15px 10px;
    }
}

/* Modal Adjustments for Mobile */
@media (max-width: 768px) {
    .modal-content {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
        max-width: none;
    }
    
    .modal-controls {
        padding: 10px;
    }
    
    .zoom-button {
        width: 40px;
        height: 40px;
    }
    
    .close-button {
        width: 40px;
        height: 40px;
    }
    
    .modal-title {
        min-height: 48px;
        padding: 12px 56px 10px 14px;
        font-size: 15px;
    }
}

/* Touch-friendly controls */
@media (max-width: 768px) {
    .upload-button, 
    .action-button,
    .tab-button,
    .regenerate-btn {
        padding: 12px 20px;
        min-height: 44px; /* Apple's recommended minimum touch target size */
    }

    .results-actions .action-button {
        width: 100%;
        padding: 12px 16px;
        min-height: 48px;
    }
    
    input[type="checkbox"] {
        transform: scale(1.2);
    }
}

@media (max-width: 480px) {
    .results-actions .action-button {
        padding: 11px 14px;
        min-height: 46px;
        font-size: 0.9rem;
    }
}

/* Touch feedback styles */
.touch-active {
    transform: scale(0.98) !important;
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.visualization-container.touched {
    opacity: 0.9;
    transform: scale(0.98);
}

.upload-area:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Landscape Orientation Adjustments */
@media (max-width: 900px) and (orientation: landscape) {
    .upload-area {
        padding: 15px;
        height: auto !important;
    }
    
    .visualization-container {
        max-height: 150px;
    }
    
    .modal-image {
        max-height: 100%;
    }
}

/* Text size adjustments for readability */
@media (max-width: 480px) {
    body {
        font-size: 15px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .upload-title {
        font-size: 1rem;
    }
    
    .score-card h3, .analysis-card h3, .visualization-card h3, .metric h4 {
        font-size: 1.1rem;
    }
    
    .score-value {
        font-size: 2rem;
    }
    
    /* Ensure lists are more readable */
    .analysis-card li, 
    .ai-section-card li, 
    .ai-suggestions-card li,
    .ai-processing-card li,
    .ai-translation-card li {
        margin-bottom: 12px;
        line-height: 1.4;
    }
}

/* Fix any potential overflow issues */
@media (max-width: 768px) {
    .chart-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure proper resizing of canvases */
    canvas {
        max-width: 100%;
        height: auto !important;
    }
    
    /* Improve readability of charts on small screens */
    #frequency-chart,
    #transients-chart {
        height: 250px !important;
    }
}

/* Responsive styles for feedback modal and button */
@media (max-width: 768px) {
    header {
        flex-direction: row;
        text-align: left;
        padding: 8px 0;
    }
    
    .header-container {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        padding: 0 10px;
    }
    
    .app-brand {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        margin-bottom: 0;
        max-width: 100%;
        flex-shrink: 0;
       
    }
    
    .app-logo {
        width: 50px;
        height: 50px;
        margin-right: 0;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .header-right {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        margin-left: 12px;
        flex: 1;
        min-width: 0;
        max-width: none;
        overflow: hidden;
    }
    
    .app-title {
        margin-bottom: 6px;
        align-self: flex-start;
        width: 100%;
        max-width: 100%; /* Ensure it doesn't exceed container width */
    }
    
    .app-title h1 {
        font-size: 1.15rem;
        text-align: left;
        line-height: 1.2;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
        max-width: 100%; /* Ensure text doesn't overflow */
    }
    
    .header-actions {
        margin-left: 0;
        margin-top: 0;
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        align-self: flex-start;
    }
    

@media (max-width: 480px) {

/* Extra small devices */
@media (max-width: 360px) {
    .app-logo {
        width: 38px;
        height: 38px;
    }
    
    .app-title h1 {
        font-size: 0.9rem;
    }
    

/* Add ripple effect for mobile touch */
.tap-ripple {
    position: absolute;
    background: var(--card-bg);
    border-radius: 50%;
    transform: scale(0);
    pointer-events: none;
    width: 100px;
    height: 100px;
    animation: ripple-animation 0.6s ease-out;
}

@keyframes ripple-animation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* Improve mobile analysis elements */
@media (max-width: 768px) {
    /* Make cards look more like actual cards with shadow and rounded corners */
    .score-card, .analysis-card, .ai-section-card, .metric, .chart-container {
        border-radius: 12px;
        box-shadow: var(--shadow-md);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        position: relative;
        overflow: hidden;
    }
    
    /* Add hover/touch effect */
    .score-card:active, .analysis-card:active, .ai-section-card:active, .metric:active {
        transform: scale(0.98);
        box-shadow: var(--shadow-sm);
    }
    
    /* Improve lists for touch */
    .analysis-card li, .ai-section-card li {
        position: relative;
        padding-left: 5px;
    }
    
    /* Enhance score display */
    .overall-score {
        margin: 30px auto;
    }
    
    .score-value {
        color: var(--primary-color);
        font-weight: 700;
    }
    
    /* AI Frequency Analysis specific improvements */
    .ai-frequency-card, .ai-description {
        padding: 12px !important;
    }
    
    .ai-header {
        margin-bottom: 10px;
    }
    
    .ai-header h3 {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    .ai-powered-by {
        font-size: 12px;
        margin: 0 0 5px 0;
    }
    
    /* Numbered items in frequency issues */
    .ai-section-card li {
        padding-left: 0;
    }
    
    /* Increase content vs padding ratio */
    #frequency-tab, #dynamics-tab, #stereo-tab, #clarity-tab, 
    #harmonic-tab, #transients-tab, #spatial-tab, 
    #visualizations-tab, #ai-insights-tab {
        padding: 12px 10px;
    }
    
    /* Remove excessive margins and paddings */
    .ai-frequency-issues, .ai-frequency-recommendations {
        margin-bottom: 10px;
    }
    
    /* Numbered list style for frequency issues */
    #ai-frequency-issues li, #ai-frequency-recommendations li {
        padding-left: 0;
        position: relative;
        counter-increment: item;
    }
}

/* Further optimize mobile content density */
@media (max-width: 480px) {
    
    .tabs {
        margin-bottom: 15px;
    }
    
    /* Make list items more efficient */
    .analysis-card li, .ai-section-card li {
        font-size: 15px;
        padding: 6px 0;
        line-height: 1.3;
    }
    
    /* Further reduce card padding */
    .analysis-card, .ai-section-card, .metric, .chart-container {
        padding: 12px !important;
        margin-bottom: 12px;
    }
    
    /* Make headings more compact */
    .analysis-card h3, .ai-section-card h4 {
        font-size: 17px;
        margin-bottom: 8px;
    }
    
    /* Reduce spacing between elements */
    .ai-section-card + .ai-section-card {
        margin-top: 10px;
    }
    
    /* Make bullet points more compact */
    .ai-section-card li:before {
        margin-right: 6px;
    }
    
    /* Increase touch targets while reducing visual space */
    .tab-button {
        padding: 10px 15px;
        font-size: 15px;
    }
    
    /* Make tab content full width */
    .tab-pane {
        padding: 10px 8px;
        width: 100%;
        box-sizing: border-box;
    }
} 
