:root {
    --bg-color: #0b1121;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Background Animation */
.circles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, #111827 0%, var(--bg-color) 100%);
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 20s infinite alternate;
}

.circle-1 {
    width: 500px;
    height: 500px;
    background-color: #1d4ed8;
    top: -150px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 400px;
    height: 400px;
    background-color: #4338ca;
    bottom: -100px;
    right: -50px;
    animation-delay: -5s;
}

.circle-3 {
    width: 300px;
    height: 300px;
    background-color: #0284c7;
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
    100% { transform: translate(-50px, 100px) scale(0.9); }
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    margin-bottom: 30px;
}

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

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.credits {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
}

.btn-icon:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    flex-grow: 1;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.generation-panel, .result-panel {
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-size: 1.2rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

/* Forms */
.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-row {
    display: flex;
    gap: 15px;
}

.half-width {
    flex: 1;
}

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 15px;
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Upload Zone */
.upload-zone {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--text-muted);
    border-radius: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    cursor: pointer;
    gap: 10px;
    color: var(--text-muted);
}

.upload-label i {
    font-size: 2rem;
    color: var(--primary-color);
}

.preview-container {
    padding: 10px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
}

#imagePreview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger-color);
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.remove-btn:hover {
    transform: scale(1.1);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #475569;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.modal-note {
    margin-top: 20px;
    margin-bottom: 0 !important;
}

#apiKeyModal .input-group {
    flex-direction: row;
    align-items: center;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0 15px;
    margin-bottom: 20px;
}

#apiKeyModal .input-group i {
    color: var(--text-muted);
}

#apiKeyModal .input-group input {
    border: none;
    background: transparent;
    padding: 15px 10px;
    flex-grow: 1;
}

#apiKeyModal .input-group input:focus {
    box-shadow: none;
}

/* Results Area */
.result-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    min-height: 400px;
    padding: 20px;
    text-align: center;
}

.idle-state {
    color: var(--text-muted);
}

.idle-state i {
    margin-bottom: 15px;
    color: rgba(148, 163, 184, 0.5);
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state h3 {
    color: var(--primary-color);
}

.loading-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.success-state {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#resultVideo {
    width: 100%;
    max-height: 500px;
    border-radius: 10px;
    background: #000;
}

.action-buttons {
    display: flex;
    justify-content: center;
}

.error-state {
    color: var(--danger-color);
}

.error-state i {
    margin-bottom: 15px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 20px;
}
