:root {
    --primary: #00f2fe;
    --primary-alt: #4facfe;
    --accent: #ff007c;
    --bg-dark: #0a0b10;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-heavy: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.5);
    --safe-area: env(safe-area-inset-bottom);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 20%, 1) 0, transparent 55%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 20%, 1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    line-height: 1.5;
}

.glass-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 0;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.logo span {
    background: linear-gradient(90deg, var(--primary), var(--primary-alt));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-badge {
    display: flex;
    align-items: center;
    background: var(--glass-heavy);
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
}

.dot {
    width: 8px;
    height: 8px;
    background: #444;
    border-radius: 50%;
    margin-right: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dot.online {
    background: #00ffaa;
    box-shadow: 0 0 12px #00ffaa;
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.config-panel {
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.input-group>div {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

input[type="text"],
textarea {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px 18px;
    color: white;
    width: 100%;
    outline: none;
    font-size: 1rem;
    transition: all 0.3s;
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
}

.workspace {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.controls h2,
.live-logs h2,
.result-header h2 {
    font-size: 1.1rem;
    margin-bottom: 18px;
    font-family: 'Outfit';
    display: flex;
    align-items: center;
    gap: 10px;
}

.drop-zone {
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    aspect-ratio: 16/9;
    height: auto;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(0, 242, 254, 0.03);
}

.drop-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.placeholder {
    text-align: center;
    color: var(--text-dim);
}

.placeholder i {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 12px;
}

.slider-group {
    margin-top: 24px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-dim);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.generate-btn {
    width: 100%;
    margin-top: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    border: none;
    padding: 18px;
    border-radius: 16px;
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 242, 254, 0.25);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0, 242, 254, 0.4);
}

.generate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    background: #444;
    color: #888;
    box-shadow: none;
}

.log-area {
    background: rgba(0, 0, 0, 0.5);
    height: 400px;
    border-radius: 18px;
    padding: 16px;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.log-entry {
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: break-all;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry.system {
    color: var(--text-dim);
}

.log-entry:not(.system) {
    color: #00ffbb;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    background: var(--glass-heavy);
    border: 1px solid var(--glass-border);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--glass-border);
}

.pulse-icon {
    color: var(--accent);
    filter: drop-shadow(0 0 5px var(--accent));
    animation: glow-pulse 2s infinite;
}

@keyframes glow-pulse {
    0% {
        opacity: 0.3;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.3;
        transform: scale(0.9);
    }
}

.result-panel {
    margin-top: 24px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-display {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
}

#result-image {
    max-width: 100%;
    height: auto;
}

.loader {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid transparent;
    border-top: 3px solid var(--primary);
    border-right: 3px solid var(--primary-alt);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Optimizations */
@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .log-area {
        height: 250px;
    }
}

@media (max-width: 600px) {
    .glass-container {
        padding: 15px;
    }

    header {
        margin-bottom: 20px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .glass-card {
        padding: 20px;
        border-radius: 20px;
    }

    .primary-btn {
        width: 100%;
    }

    .input-group>div {
        min-width: 100%;
    }

    .section-header h2 {
        font-size: 1rem;
    }

    /* Log hide/show logic for mobile */
    .live-logs.collapsed .log-area {
        display: none;
    }

    .live-logs.collapsed {
        padding: 12px 20px;
    }
}

.hidden {
    display: none !important;
}