/* VibeCoding Layout System - Consolidated from app-layout.css and layout-fix.css */

/* Global body styling */
body {
    background-color: #000;
    color: #fff;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* Main app container with grid layout system */
.app-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "control mode-toggle"
        ". uploader"
        "audio uploader";
    gap: 20px;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    box-sizing: border-box;
    background: transparent;
    pointer-events: none;
}

/* Grid area assignments */
.control-panel {
    grid-area: control;
    pointer-events: auto;
    align-self: start;
}

.mode-toggle-dropdown {
    grid-area: mode-toggle;
    justify-self: end;
    align-self: start;
    pointer-events: auto;
}

.audio-visualizer {
    grid-area: audio;
    background-color: #1e1e1e;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    align-self: end;
    
    /* Enhanced sizing for natural content fit */
    box-sizing: border-box;
    
    /* Allow natural height to accommodate all content */
    height: auto;
    min-height: auto;
    max-height: none;
    
    /* Improved spacing between components */
    display: flex;
    flex-direction: column;
    gap: 16px;
    
    /* Match control panel width */
    width: fit-content;
    min-width: 500px;
    max-width: 500px;
    
    /* Prevent horizontal overflow but allow vertical expansion */
    overflow-x: hidden;
    overflow-y: visible;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Enhanced text content overflow handling in audio visualizer */
.audio-visualizer .mic-test {
    flex-shrink: 0;
    flex-grow: 0;
    min-height: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    padding: 4px 0;
}

.audio-visualizer .mic-test p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    line-height: 1.5;
    margin: 0;
    font-size: 13px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
    /* Better text wrapping - less aggressive */
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: break-word;
    max-width: 100%;
    letter-spacing: 0.3px;
}

.audio-visualizer #audioStatusDetection {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    line-height: 1.3;
    font-size: 12px;
    margin: 8px 0 0 0;
    flex-shrink: 0;
    flex-grow: 0;
    height: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Better text wrapping for status text */
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: break-word;
    padding: 12px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 44px;
    text-align: center;
    transition: all 0.3s ease;
}

.audio-visualizer .volume-meter {
    flex-shrink: 0;
    flex-grow: 0;
    margin: 0 0 12px 0;
    width: 100%;
    box-sizing: border-box;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.uploader-tabs-container {
    grid-area: uploader;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    min-width: 400px;
    max-width: 600px;
    justify-self: end;
    align-self: stretch;
}
/* Dual Canvas Layer System */
.canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Background Canvas - Layer 1 (behind everything) */
#backgroundCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Firework Canvas - Layer 2 (on top of background, behind UI) */
#animationCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Control panel button styling - moved to control-panel-simplified.css */
/* .control-panel button {
    background-color: #2c2c2c;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.control-panel button:hover {
    background-color: #3a3a3a;
} */

.mic-button {
    background-color: #4CAF50 !important;
}

/* Audio visualizer components */
.volume-meter {
    height: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 12px;
}

.level-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #4CAF50, #2196F3);
    transition: width 0.1s linear;
}

/* Upload button styling */
#selectFiles, #selectBgFiles {
    padding: 12px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 20 !important;
    position: relative !important;
    pointer-events: auto !important;
}
#selectFiles:hover, #selectBgFiles:hover {
    background-color: #45a049;
}

/* Tab button enhancements */
.uploader-tab-button {
    font-weight: 600;
    position: relative;
    z-index: 5;
    pointer-events: auto;
}

.uploader-tab-button.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Tab pane height management */
.uploader-tab-pane {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 5;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* Upload container styling */
.background-upload-container,
.image-upload-container {
    padding: 15px;
    position: relative;
    z-index: 5;
}

/* General button enhancements */
.button, button {
    position: relative;
    z-index: 10;
    cursor: pointer !important;
}

/* === RESPONSIVE DESIGN === */

/* Tablet layout (1024px and below) */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "control mode-toggle"
            ". uploader"
            "audio uploader";
        gap: 16px;
        padding: 16px;
    }
    
    .mode-toggle-dropdown {
        justify-self: end;
        align-self: start;
    }
    
    .uploader-tabs-container {
        justify-self: end;
        min-width: 350px;
        max-width: 100%;
        align-self: stretch;
    }
    
    .audio-visualizer {
        align-self: end;
        
        /* Enhanced spacing for tablet */
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 20px;
    }
}

/* Mobile layout (768px and below) */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .app-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px;
        height: auto;
        min-height: 100vh;
        width: 100vw;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;
        position: relative;
        top: 0;
        left: 0;
    }
    
    .control-panel {
        order: 1;
        width: 100%;
        max-width: 400px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 12px;
        margin: 0;
        align-self: center;
    }
    
    .mode-toggle-dropdown {
        order: 2;
        width: 100%;
        max-width: 400px;
        margin: 0;
        align-self: center;
        justify-self: center;
    }

    .uploader-tabs-container {
        order: 3;
        width: 100%;
        max-width: 400px;
        flex: 1 1 auto;
        margin: 0;
        box-sizing: border-box;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 300px;
        align-self: center;
    }

    .audio-visualizer {
        order: 4;
        width: 100%;
        max-width: 400px;
        padding: 16px;
        min-height: 100px;
        margin: 0;
        align-self: center;
        
        /* Enhanced mobile spacing */
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .uploader-tab-pane {
        height: 100%;
        max-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 12px;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .background-upload-container,
    .image-upload-container {
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .button, button {
        min-height: 44px;
        padding: 12px 16px;
    }

    #selectFiles,
    #selectBgFiles {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
        max-width: 200px;
        box-sizing: border-box;
    }
}

/* Small mobile layout (480px and below) */
@media (max-width: 480px) {
    .app-container {
        padding: 8px;
        gap: 8px;
        max-width: 100vw;
    }
    
    .control-panel {
        padding: 8px;
        gap: 6px;
        max-width: 350px;
        align-self: center;
    }
    
    .control-panel button {
        min-width: 60px;
        padding: 8px 12px;
    }

    .mode-toggle-dropdown {
        max-width: 350px;
        align-self: center;
    }

    .uploader-tabs-container {
        max-width: 350px;
        min-height: 250px;
        align-self: center;
    }

    .audio-visualizer {
        padding: 12px;
        min-height: 100px;
        max-width: 350px;
        align-self: center;
    }

    .background-upload-container,
    .image-upload-container {
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .uploader-tab-pane {
        padding: 8px;
    }

    #selectFiles,
    #selectBgFiles {
        max-width: 180px;
    }
}

/* Extra small mobile layout (360px and below) */
@media (max-width: 360px) {
    .app-container {
        padding: 6px;
        gap: 6px;
        grid-template-rows: auto auto 1fr auto;
    }
    
    .control-panel {
        padding: 6px;
        gap: 4px;
        max-width: 320px;
        align-self: start;
    }
    
    .control-panel button {
        min-width: 60px;
        padding: 6px 10px;
    }

    .mode-toggle-dropdown {
        max-width: 320px;
    }

    .uploader-tabs-container {
        max-width: 320px;
        align-self: stretch;
    }

    .background-upload-container,
    .image-upload-container {
        padding: 6px;
    }

    .audio-visualizer {
        padding: 10px;
        min-height: 80px;
        max-width: 320px;
        align-self: start;
        
        /* Keep content properly contained */
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
}