:root {
    --primary-color: #005D50;
    --secondary-color: #00382E;
    --text-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-hover-bg: rgba(255, 255, 255, 0.1);
    --font-heading: 'Sanchez', serif;
    --font-body: 'Montserrat', sans-serif;

    /* Studio Specifics */
    --accent-color: #4DB6AC;
    --input-bg: rgba(0, 0, 0, 0.2);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* --- Header & Nav (Consistent with Hub) --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 56, 46, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
}

/* --- Main Layout --- */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 80px - 60px);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    gap: 24px;
    height: calc(100vh - 80px - 60px - 4rem);
    /* Fill remaining space safely */
    min-height: 600px;
}

/* --- Studio Panels --- */
.panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;

    /* Liquid glass effect */
    background-image: radial-gradient(140% 120% at -10% -10%,
            rgba(255, 255, 255, .1) 0%,
            rgba(255, 255, 255, .05) 35%,
            rgba(255, 255, 255, .01) 75%);
}

.controls-panel {
    flex: 0 0 400px;
    gap: 24px;
    overflow-y: auto;
}

.results-panel {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Controls */
.control-group {
    display: flex;
    flex-direction: column;
}

.section-title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 8px;
    display: block;
}

.helper-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: rgba(0, 0, 0, 0.1);
}

.upload-zone:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.upload-content {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.image-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff5252;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Select Inputs */
.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.95rem;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s;
}

select option {
    background: #00382E;
    color: var(--text-color);
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.7;
}

/* Generate Button */
.generate-btn {
    margin-top: auto;
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.generate-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results & Layout */
.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-color);
}

.results-container {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    padding: 0;
}

.result-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--card-border);
    transition: border-color 0.3s ease;
}

.image-wrapper {
    width: 100%;
    height: 100%;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.download-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.regenerate-btn {
    position: absolute;
    bottom: 16px;
    right: 64px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.regenerate-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.regenerate-btn svg {
    transition: transform 0.5s ease;
}

.regenerate-btn:hover svg {
    transform: rotate(-180deg);
}

.edit-btn {
    position: absolute;
    bottom: 16px;
    right: 112px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.play-btn {
    position: absolute;
    bottom: 16px;
    right: 160px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.play-btn:hover {
    background: rgba(77, 182, 172, 0.5);
}

.video-progress {
    position: absolute;
    bottom: 64px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 56, 46, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    z-index: 10;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Video Modal */
.video-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 90%;
    max-height: 90%;
}

.video-modal-content video {
    max-width: 100%;
    max-height: 75vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.close-video-modal {
    position: absolute;
    top: 24px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.video-download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    color: white;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.video-download-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.edit-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: rgba(0, 56, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.edit-overlay textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 8px;
    resize: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.edit-overlay textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.edit-actions button {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.cancel-edit {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.submit-edit {
    background: var(--accent-color);
    color: #00382E;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    top: 24px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.hidden {
    display: none !important;
}

/* --- Footer (Consistent) --- */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 32, 26, 0.3);
    padding: 1.5rem 0;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .controls-panel {
        flex: none;
        width: 100%;
    }

    .results-panel {
        height: 600px;
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 1rem;
    }

    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid #ffffff;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}