:root {
    --bg-color: #F7F9FC;
    --card-bg: #FFFFFF;
    --primary: #18181B; /* Zingy black */
    --primary-hover: #27272A;
    --success: #3B82F6; /* Vibrant blue */
    --success-hover: #2563EB;
    --text-main: #09090B;
    --text-muted: #71717A;
    --border-color: #E4E4E7;
    --border-hover: #D4D4D8;
    --sidebar-w: 480px;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden; /* layout takes full bounds */
}

/* Base Split Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar-config {
    width: var(--sidebar-w);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
}

.main-dashboard {
    flex: 1;
    background: var(--bg-color);
    padding: 2.5rem;
    overflow-y: auto;
}

header {
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--primary);
}

header h1 span {
    color: var(--success);
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Stepper UI */
.stepper-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F4F4F5;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.step.active {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.step.done {
    background: var(--success);
    color: #FFF;
}

.step-line {
    flex: 1;
    height: 2px;
    background: #E4E4E7;
    margin: 0 10px;
    border-radius: 2px;
}

/* Wizard Content */
.wizard-content {
    flex: 1;
    position: relative;
}

.wizard-step {
    display: none;
    animation: slideIn 0.3s ease forwards;
}

.wizard-step.active {
    display: block;
}

.wizard-step h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Forms */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

input[type="url"],
input[type="number"],
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #FAFAFA;
    transition: all 0.2s ease;
}

textarea {
    resize: vertical;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--success);
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* UI Boxes */
.ai-box {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #FFF;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.checkbox-group label {
    font-weight: 400;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Toggles */
.toggle-control {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
}
.toggle-control input { display: none; }
.control-indicator {
    width: 44px; height: 24px;
    background: #E4E4E7;
    border-radius: 20px;
    position: relative;
    transition: background 0.3s ease;
}
.control-indicator::after {
    content: ''; position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: #FFF;
    border-radius: 50%;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-control input:checked + .control-indicator { background: var(--success); }
.toggle-control input:checked + .control-indicator::after { left: 22px; }

/* Buttons */
.wizard-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn.primary { background: var(--primary); color: #FFF; }
.btn.primary:hover { background: #000; box-shadow: 0 6px 16px rgba(0,0,0,0.15); transform: translateY(-1px); }

.btn.secondary { background: #FFF; color: var(--primary); border-color: var(--border-color); }
.btn.secondary:hover { background: #F4F4F5; }

.btn.ghost { background: transparent; color: var(--text-muted); padding: 0.75rem 0.5rem; }
.btn.ghost:hover { color: var(--primary); }

.btn.full-width { width: 100%; }

/* Alerts & Previews */
.success-alert {
    background: #ECFDF5;
    color: #059669;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #A7F3D0;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.question-preview-scroll {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    background: #FAFAFA;
}

.question-preview-scroll > div {
    background: #FFF;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.question-preview-scroll > div:last-child { border: none; }

/* Dashboard Right Panel */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-badge.live { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }

.campaign-grid {
    display: grid;
    gap: 1.5rem;
}

/* Campaign Card modern UI */
.camp-card {
    background: #FFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -2px rgba(0,0,0,0.02);
    overflow: hidden;
}

.camp-head {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.camp-id { font-weight: 700; font-family: monospace; color: var(--primary); }

.camp-body {
    padding: 1.5rem;
}

/* Progress bar inside body */
.progress-container {
    margin-bottom: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-track {
    height: 8px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.5s ease-out;
}

.eta { color: var(--text-muted); font-weight: normal; }

.camp-logs {
    background: #0F172A;
    color: #38BDF8;
    padding: 1rem;
    border-radius: 8px;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    height: 140px;
    overflow-y: auto;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.camp-logs div { margin-bottom: 4px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    border: 2px dashed var(--border-hover);
    border-radius: 12px;
    color: var(--text-muted);
}

.empty-state svg { margin-bottom: 1rem; }
.empty-state p { font-weight: 500; }
.empty-state p.sub { font-size: 0.85rem; font-weight: normal; margin-top: 0.5rem; }

.preview-header {
    max-width: 760px;
    margin: 0 auto 2rem auto;
    padding: 2rem;
    background: #FFF;
    border-radius: 12px;
    border-top: 10px solid #673AB7; /* Classic Google Form Purple */
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.preview-header h3 { font-size: 1.8rem; color: var(--primary); margin-bottom: 0.5rem; }
.preview-header p { color: var(--text-muted); font-size: 1rem; }

.analysis-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 5rem;
}

.q-card {
    background: #FFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 760px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: transform 0.2s ease;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.q-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.q-type-badge {
    position: absolute;
    top: 1.5rem; right: 2rem;
    padding: 4px 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    background: #F8FAFC;
    color: #64748B;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.q-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.5;
    margin-right: 8rem; /* Space for badge */
}

.q-id {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #FAFAFA;
    padding: 4px 8px;
    border-radius: 4px;
    width: fit-content;
    border: 1px dashed var(--border-color);
}

.q-opts {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.q-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

.q-opt::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #DADCE0;
    border-radius: 50%;
    flex-shrink: 0;
}

.q-check .q-opt::before {
    border-radius: 4px;
}

.q-card.q-text { border-left: 4px solid #94A3B8; }
.q-card.q-radio { border-left: 4px solid #3B82F6; }
.q-card.q-check { border-left: 4px solid #8B5CF6; }

.hidden { display: none !important; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D4D4D8; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #A1A1AA; }

/* Dashboard Timeline */
.dash-timeline { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 6px; 
    margin: 1rem 0; 
    padding: 1rem; 
    background: #f8fafc; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0;
    max-height: 120px; 
    overflow-y: auto; 
}

.t-badge { 
    font-size: 0.75rem; 
    font-weight: 600; 
    padding: 3px 8px; 
    border-radius: 6px; 
    background: #dcfce7; 
    color: #166534; 
    border: 1px solid #bbf7d0; 
    transition: all 0.3s;
}

.t-badge.done { 
    opacity: 0.4; 
    background: #e2e8f0; 
    color: #64748b; 
    border-color: #cbd5e1; 
    text-decoration: line-through; 
}

.data-table-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    background: #FFF;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    overflow: auto;
    max-height: 60vh;
}

#data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#data-table th {
    background: #F8FAFC;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

#data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#data-table tr:hover td {
    background: #F1F5F9;
}

#data-table td[contenteditable="true"]:focus {
    outline: 2px solid var(--success);
    background: #FFF;
    box-shadow: inset 0 0 0 1px var(--success);
}

.data-table-wrapper::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.data-table-wrapper::-webkit-scrollbar-thumb {
    background: #CBD5E1;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #10B981;
    color: #FFF;
}
