/* JVStudio Global Styles */
:root {
    --primary-color: #5b13ec;
    --secondary-color: #00ffcc; /* For accents */
    --background-dark: #161022;
    --background-light: #f6f6f8;
    --text-light: #e0e0e0;
    --text-dark: #333333;
    --border-color: #333333;
    --header-bg: rgba(22, 16, 34, 0.9); /* Dark background with transparency */
    --nav-item-hover: rgba(91, 19, 236, 0.2);
}

body {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden; /* Prevent body scroll, iframe handles its own */
}

.jvstudio-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.jvstudio-header {
    background-color: var(--header-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0; /* Prevent header from shrinking */
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.logo .material-symbols-outlined {
    font-size: 32px;
}

.logo h1 {
    font-size: 1.8em;
    font-weight: 700;
    margin: 0;
    color: var(--text-light);
}

/* New styles for app selector dropdown and gallery link */
.main-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-selector-dropdown {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    appearance: none; /* Remove default select styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-6.5%200-12.3%203.2-16.1%208.1-3.8%204.9-4.5%2011.5-1.7%2017.4l133.3%20166c3.8%204.9%2010%207.9%2016.1%207.9s12.3-3%2016.1-7.9l133.3-166c2.8-5.9%202.1-12.5-.7-17.4z%22%2F%3E%3C%2Fsvg%3E'); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px; /* Make space for the arrow */
    transition: background-color 0.2s ease;
}

.app-selector-dropdown:hover {
    background-color: #4a0eaf; /* Darker primary */
}

.app-selector-dropdown option {
    background-color: var(--background-dark);
    color: white;
}

.gallery-link {
    background-color: #00aaff; /* A different accent color for gallery */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    text-decoration: none; /* Ensure it looks like a button */
    transition: background-color 0.2s ease;
}

.gallery-link:hover {
    background-color: #0088cc;
}

.jvstudio-main {
    flex-grow: 1; /* Allows main content to take remaining space */
    display: flex;
    overflow: hidden; /* Ensure iframe doesn't overflow */
}

#app-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: var(--background-dark); /* Default background for iframe */
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s ease;
}

.action-btn:hover {
    background-color: #4a0eaf; /* Darker primary */
}

.action-btn .material-symbols-outlined {
    font-size: 20px;
}

.upload-label {
    background-color: #00aaff; /* A different accent color for upload */
}

.upload-label:hover {
    background-color: #0088cc;
}

.hidden-file-input {
    display: none;
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    font-size: 1.2em;
    gap: 15px;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}


/* Responsive adjustments */
@media (max-width: 1024px) {
    .main-nav-wrapper {
        gap: 10px;
    }
    .app-selector-dropdown, .gallery-link {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    .app-selector-dropdown {
        padding-right: 25px; /* Adjust for smaller arrow */
        background-position: right 8px center;
        background-size: 10px;
    }
    .logo h1 {
        font-size: 1.5em;
    }
    .header-actions {
        gap: 10px;
    }
    .action-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 768px) {
    .jvstudio-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 15px;
    }
    .main-nav-wrapper {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    .app-selector-dropdown, .gallery-link {
        flex-grow: 1; /* Allow them to take more space */
        text-align: center;
        max-width: 200px; /* Limit max width */
    }
    .logo {
        width: 100%;
        justify-content: center;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        flex-wrap: wrap;
    }
    .action-btn {
        flex-grow: 1;
        max-width: 180px; /* Limit max width */
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-nav-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    .app-selector-dropdown, .gallery-link {
        max-width: none; /* Allow full width */
    }
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .action-btn {
        max-width: none; /* Allow full width */
    }
}