/* === BUILDER PAGE - MODERN PROFESSIONAL THEME === */

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hero Section */
.builder-hero {
    padding-top: calc(var(--header-height) + 48px);
    padding-bottom: 40px;
    background: radial-gradient(circle at center top, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
    position: relative;
    z-index: 1;
}

.builder-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-family: var(--font-h1);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.builder-title i { 
    color: var(--primary-color);
    font-size: 0.9em;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
}

.builder-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-align: center;
    font-family: var(--font-body);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Main Layout */
.builder-main {
    padding: 32px 0 80px;
    background: transparent;
    position: relative;
    z-index: 1;
}

.builder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 1280px) {
    .builder-grid { 
        gap: 32px;
    }
}

@media (max-width: 1200px) {
    .builder-grid { 
        grid-template-columns: 1fr; 
        gap: 32px;
    }
}

/* Form Container */
.builder-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Config Section Cards */
.config-section {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.config-section:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Section Header */
.section-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 18px 24px;
    background: rgba(30, 41, 59, 0.4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-h2);
    margin: 0;
}

.section-heading i {
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.section-heading .section-hint {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 400;
    font-family: var(--font-hint);
    margin-left: auto;
}

/* Section Body */
.section-body {
    padding: 24px;
}

.section-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
    font-family: var(--font-body);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-family: var(--font-button);
}

.form-group .hint {
    font-weight: 400;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-family: var(--font-hint);
}

.form-group .hint a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.form-group .hint a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    font-family: var(--font-input);
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 48px; /* Taller inputs */
}

.form-input:hover {
    border-color: var(--border-strong);
    background: rgba(15, 23, 42, 0.8);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.form-input::placeholder {
    color: var(--text-dim);
}

textarea.form-input {
    height: auto;
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* Form Row - Two columns */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* Toggle Switch */
.form-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.form-toggle:hover {
    background: rgba(255, 255, 255, 0.02);
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
}

.form-toggle label:first-child {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    font-family: var(--font-button);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
    border-radius: 28px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    transition: transform 0.3s, background 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background: #fff;
}

.toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .toggle-grid { grid-template-columns: 1fr; }
}

/* Preview Panel */
.builder-preview {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (min-width: 1201px) {
    .builder-preview {
        position: sticky;
        top: calc(var(--header-height) + 24px);
    }
}

/* Preview Card */
.preview-card {
    background: #0f172a; /* Solid dark background for code readiablity */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.preview-header {
    background: rgba(30, 41, 59, 0.5);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.preview-header .term-dots {
    display: flex;
    gap: 8px;
}

.preview-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.preview-header .dot.red { background: #ef4444; }
.preview-header .dot.yellow { background: #f59e0b; }
.preview-header .dot.green { background: #10b981; }

.preview-title {
    flex: 1;
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.preview-title .path-dim { color: var(--text-dim); }
.preview-title .config-text { 
    color: var(--primary-light); 
    font-weight: 600;
}

.preview-header .copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.preview-header .copy-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.preview-body {
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 0.85rem;
    line-height: 1.7;
}

.preview-body pre {
    margin: 0;
    font-family: var(--font-code);
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
}

/* Syntax Highlighting */
.preview-body .syntax-comment { color: #64748b; font-style: italic; }
.preview-body .syntax-keyword { color: #818cf8; font-weight: 600; } /* Indigo 400 */
.preview-body .syntax-const { color: #c084fc; } /* Purple 400 */
.preview-body .syntax-configname { color: #38bdf8; font-weight: 600; } /* Sky 400 */
.preview-body .syntax-string { color: #a5b4fc; } /* Indigo 300 */
.preview-body .syntax-number { color: #facc15; } /* Yellow 400 */
.preview-body .syntax-boolean { color: #4ade80; font-weight: 600; } /* Green 400 */

.preview-body::-webkit-scrollbar { width: 8px; }
.preview-body::-webkit-scrollbar-track { background: transparent; }
.preview-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; border: 2px solid #0f172a; }
.preview-body::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Assets Card */
.assets-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.assets-card .section-heading {
    margin: 0;
}

.assets-body {
    padding: 24px;
}

.assets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .assets-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Asset Items */
.asset-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.asset-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.asset-thumb {
    width: 100%;
    aspect-ratio: 16/9; /* Widescreen aspect ratio for better view */
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}

.asset-item:hover .asset-thumb {
    transform: scale(1.05);
}

.asset-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid var(--border-color);
}

.asset-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.asset-upload {
    cursor: pointer;
    flex-shrink: 0;
}

.asset-upload input { display: none; }

.asset-upload span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    font-size: 0.8rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.asset-upload span:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Media Sections */
.asset-media {
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

.asset-media:hover {
    border-color: var(--border-strong);
}

.media-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-button);
}

.media-label i { color: var(--secondary-color); font-size: 1.1em; }

.asset-media audio,
.asset-media video {
    width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: #000;
}

.asset-media video {
    max-height: 200px;
}

.asset-upload-btn {
    cursor: pointer;
    display: inline-block;
}

.asset-upload-btn input { display: none; }

.asset-upload-btn span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-button);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.asset-upload-btn span:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Preset Actions */
.preset-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.preset-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-button);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.preset-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--border-strong);
    color: var(--text-main);
    transform: translateY(-2px);
}

#savePreset { border-color: rgba(34, 197, 94, 0.2); color: var(--success-color); }
#savePreset:hover { background: rgba(34, 197, 94, 0.1); border-color: var(--success-color); }

#loadPreset { border-color: rgba(99, 102, 241, 0.2); color: var(--primary-color); }
#loadPreset:hover { background: rgba(99, 102, 241, 0.1); border-color: var(--primary-color); }

#resetPreset { border-color: rgba(239, 68, 68, 0.2); color: #ef4444; }
#resetPreset:hover { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }

/* Download Button */
.download-btn {
    position: relative;
    width: 100%;
    padding: 20px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-button);
    color: #fff;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
}

.download-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* Section Divider */
.section-divider {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 20px 0 12px;
    font-weight: 600;
    font-family: var(--font-hint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .builder-hero {
        padding-top: calc(var(--header-height) + 32px);
        padding-bottom: 24px;
    }
    
    .builder-title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .builder-subtitle {
        font-size: 1rem;
        padding: 0 16px;
    }
    
    .builder-main {
        padding: 20px 0 60px;
    }
    
    .section-heading {
        font-size: 1rem;
        padding: 16px;
    }
    
    .section-body {
        padding: 16px;
    }
    
    .form-input {
        padding: 11px 14px;
        font-size: 0.9rem;
    }
    
    .preset-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .preset-btn {
        flex: none;
        width: 100%;
    }

    .asset-thumb {
        aspect-ratio: 1; /* Back to square on mobile */
    }
}

/* Toast Notifications */
.builder-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
}

.builder-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.builder-toast.toast-success { border-left: 4px solid var(--success-color); }
.builder-toast.toast-success i { color: var(--success-color); }

.builder-toast.toast-error { border-left: 4px solid var(--danger-color); }
.builder-toast.toast-error i { color: var(--danger-color); }

.builder-toast.toast-warning { border-left: 4px solid var(--warning-color); }
.builder-toast.toast-warning i { color: var(--warning-color); }

.builder-toast.toast-info { border-left: 4px solid var(--primary-color); }
.builder-toast.toast-info i { color: var(--primary-color); }

/* Pulse Success Animation */
.pulse-success {
    animation: pulseGreen 0.6s ease;
}

@keyframes pulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    100% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}
