/* 
   THEME: Digivise Clean Professional
   Vibe: Light, Modern, Purple Accent
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Inter:wght@300;400;600;700&display=swap');

:root {
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f3ff;
    --glass-border: rgba(124, 58, 237, 0.12);
    --primary: #7C3AED;
    --primary-light: #8B5CF6;
    --primary-gradient: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 100%);
    --accent-glow: #7C3AED;
    --text-main: #1a1a1a;
    --text-muted: #64748b;
    --danger: #EF4444;
    --success: #10B981;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.04), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.03), transparent 25%);
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 0;
    overflow-x: hidden;
}

/* --- Studio Layout (80% Center) --- */
.studio-container {
    width: 80%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-area {
    margin-bottom: 30px;
}

.logo-area h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -2px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* --- Control Panel (Card) --- */
.control-panel {
    background: var(--bg-card);
    backdrop-filter: none;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 50px;
    box-shadow: 0 2px 20px rgba(124, 58, 237, 0.08);
    position: relative;
    overflow: visible;
}

/* Background Blob */
.control-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.02) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.control-panel>* {
    position: relative;
    z-index: 1;
}

.options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.control-block {
    background: rgba(124, 58, 237, 0.02);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.toggle-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: rgba(124, 58, 237, 0.04);
    padding: 10px 16px;
    border-radius: 50px;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.toggle-wrapper:hover {
    border-color: rgba(124, 58, 237, 0.2);
    background: rgba(124, 58, 237, 0.06);
}

/* --- Results Panel --- */
.results-panel {
    flex: 1;
    width: 100%;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.panel-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

/* --- Task Grid --- */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
    opacity: 0.6;
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 800px) {
    .studio-container {
        width: 95%;
    }

    .options-row {
        grid-template-columns: 1fr;
    }
}

/* --- Form Groups --- */
.input-group {
    margin-bottom: 25px;
}

.input-label {
    display: block;
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.text-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 20px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Custom Checkbox/Radio Styling */
.radio-group {
    display: flex;
    background: rgba(124, 58, 237, 0.04);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.radio-group label {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s;
}

.radio-group input[type="radio"] {
    display: none;
}

.radio-group input[type="radio"]:checked+label {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.radio-group-mini {
    display: flex;
    gap: 10px;
}

.radio-group-mini label {
    cursor: pointer;
    padding: 6px 12px;
    background: rgba(124, 58, 237, 0.06);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: 0.3s;
}

.radio-group-mini input {
    display: none;
}

.radio-group-mini input:checked+span {
    color: var(--primary);
    font-weight: 600;
}

.radio-group-mini label:hover {
    background: rgba(124, 58, 237, 0.1);
}

/* Toggle Switch */
.toggle-switch {
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

input[type="checkbox"] {
    display: none;
}

input[type="checkbox"]:checked+.toggle-wrapper .toggle-switch {
    background: var(--success);
}

input[type="checkbox"]:checked+.toggle-wrapper .toggle-switch::after {
    transform: translateX(20px);
}

/* --- Primary Button --- */
.magic-button {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 16px;
    background: var(--primary-gradient);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 30px rgba(5, 117, 230, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.magic-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
}

.magic-button:active {
    transform: translateY(1px);
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Loader */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* --- Task List Section --- */
.task-item {
    background: var(--bg-card);
    backdrop-filter: none;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    animation: slideUp 0.4s ease-out;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-info {
    flex: 1;
}

.task-id {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.task-status {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.status-loading {
    color: #FFE082;
}

.status-completed {
    color: var(--success);
    font-weight: 600;
}

.status-error {
    color: var(--danger);
}

.status-awaiting {
    color: var(--primary);
}

.task-actions {
    display: flex;
    gap: 10px;
}

/* Mini Buttons inside task */
.btn-primary-mini,
.download-btn-mini {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-transform: uppercase;
}

.btn-primary-mini {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary);
    border-color: rgba(124, 58, 237, 0.2);
}

.btn-primary-mini:hover {
    background: rgba(124, 58, 237, 0.12);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.download-btn-mini {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.download-btn-mini:hover {
    background: rgba(16, 185, 129, 0.12);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.btn-cancel-mini {
    background: rgba(255, 75, 75, 0.1);
    color: #ff4b4b;
    border-color: rgba(255, 75, 75, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-transform: uppercase;
}

.btn-cancel-mini:hover {
    background: rgba(255, 75, 75, 0.2);
    box-shadow: 0 0 15px rgba(255, 75, 75, 0.3);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 999;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header h2 {
    font-family: var(--font-heading);
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 1.8rem;
}

.title-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.title-opt {
    padding: 14px;
    background: rgba(124, 58, 237, 0.04);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.title-opt:hover {
    background: rgba(124, 58, 237, 0.08);
}

.title-opt.active {
    background: rgba(124, 58, 237, 0.12);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-secondary {
    flex: 1;
    padding: 14px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary:hover {
    background: rgba(124, 58, 237, 0.06);
    color: var(--primary);
}

.btn-confirm {
    flex: 1;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.btn-confirm:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}

/* Status Toast */
.status-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: 12px;
    backdrop-filter: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    font-weight: 500;
}

.status-toast:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
}