/* --- Wizard Steps --- */
.wizard-form {
    border-left: 2px solid var(--border-soft);
    margin-left: 8px;
    padding-left: 25px;
}
@media (max-width: 900px) {
    .wizard-form { border-left: none; padding-left: 0; margin-left: 0; }
}

.wizard-step {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.2rem;
    position: relative;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s, box-shadow 0.2s;
}
.wizard-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* --- FIX: Wizard Step Stacking for Dropdowns --- */
/* Ensures earlier steps stack ON TOP of later steps so dropdowns aren't hidden */
.wizard-step:nth-child(1) { z-index: 10; }
.wizard-step:nth-child(2) { z-index: 9; }
.wizard-step:nth-child(3) { z-index: 8; }
.wizard-step:nth-child(4) { z-index: 7; }

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.step-badge {
    position: absolute;
    left: -55px; /* Aligned with border line */
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 2px solid var(--border-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 2;
}
@media (max-width: 900px) {
    .step-badge { display: none; }
}

.step-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    color: var(--text-muted);
}

/* --- Content Type Pills (Compact Capsule Style) --- */
.content-grid-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Slightly tighter gap */
    padding-right: 5px;
}

.type-pill {
    background: var(--bg-app);
    border: 1px solid var(--border-soft);
    border-radius: 50px; 
    padding: 8px 18px; /* Reduced padding */
    display: flex;
    flex-direction: row; 
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: max-content;
    height: 40px; /* Reduced height from 48px */
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem; /* Slightly smaller font */
}

.type-pill:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    color: var(--primary);
    background: #e0e7ff; 
}

.type-pill.active {
    background: var(--primary); 
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    font-weight: 600;
}

.pill-text { display: flex; flex-direction: column; align-items: center; }
.pill-text .title { font-weight: inherit; font-size: inherit; }

/* 2. Tom Select Override */
.ts-control {
    border-color: var(--border-soft) !important;
    border-radius: var(--radius-lg) !important;
    padding: 14px !important;
    background-color: var(--bg-app) !important;
    color: var(--text-main) !important;
}
.ts-dropdown {
    border-radius: var(--radius-lg) !important;
    border-color: var(--border-soft) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
    z-index: 1000 !important; /* Ensure dropdown is high */
}

/* 3. Segmented Control */
.segmented-control {
    display: flex;
    background: var(--bg-app);
    padding: 4px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
}

.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.segment-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-weight: 600;
}

.seg-label { display: block; font-size: 0.9rem; }
.seg-sub { display: block; font-size: 0.7rem; opacity: 0.7; }

.helper-text {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 4. Toggles */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 0; /* Border separation */
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-app);
    cursor: pointer;
}
.toggle-row:last-child { border-bottom: none; }

.row-title { font-weight: 500; font-size: 0.95rem; }
.row-badge { 
    font-size: 0.7rem; 
    font-weight: 700; 
    background: #e0e7ff; 
    color: var(--primary); 
    padding: 2px 6px; 
    border-radius: 4px; 
    margin-left: 8px; 
}
.row-badge.premium { background: #fef3c7; color: #d97706; }

/* Switch CSS */
.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-soft);
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .slider { background-color: var(--text-main); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- Right Panel: Results --- */
.quote-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-float);
    text-align: center;
    /* Top Gradient Border */
    border-top: 6px solid var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.live-tag { color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.pulse { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; animation: pulse 2s infinite; }
.verified-tag { color: var(--primary); background: #eff6ff; padding: 4px 8px; border-radius: 4px; }

.price-section { margin-bottom: 2rem; }
.price-label { text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 700; margin-bottom: 0.5rem; }
.price-value { font-size: 3.5rem; font-weight: 800; color: var(--text-main); line-height: 1; letter-spacing: -0.03em; }
.currency { font-size: 0.5em; vertical-align: top; color: var(--text-muted); }
.separator { font-weight: 300; color: var(--border-soft); }
.price-context { margin-top: 1rem; font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

.platform-icons { margin-bottom: 2rem; color: var(--text-muted); opacity: 0.7; display: flex; justify-content: center; gap: 15px; font-size: 1.2rem; }
.platform-text { font-size: 0.8rem; display: flex; align-items: center; }

/* Buttons */
.btn-pitch {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}
.btn-pitch:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.btn-download {
    width: 100%;
    background: transparent;
    color: var(--text-main);
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-download:hover { background: var(--bg-app); border-color: var(--text-main); }

/* Pitch Panel Slide Up */
.pitch-container {
    margin-top: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    animation: slideUp 0.3s ease-out;
}
.hidden { display: none; }
.pitch-head { display: flex; justify-content: space-between; margin-bottom: 15px; font-weight: 700; color: var(--text-main); }
.close-pitch { background: none; border: none; cursor: pointer; color: var(--text-muted); }

#pitchText { 
    width: 100%; 
    height: 150px; 
    border: 1px solid var(--border-soft); 
    border-radius: 8px; 
    padding: 12px; 
    font-size: 0.9rem; 
    background: var(--bg-app); 
    resize: none; 
    color: var(--text-main); 
    line-height: 1.5;
    font-family: var(--font-sans);
}
.btn-copy { width: 100%; margin-top: 12px; padding: 10px; background: var(--border-soft); border: none; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--text-main); transition: background 0.2s; }
.btn-copy:hover { background: #94a3b8; color: white; }

/* --- PITCH PANEL CONTROLS --- */
.pitch-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch; /* Ensure same height */
}

/* Customizing Semantic UI components within pitch panel to match theme */
.pitch-controls .ui.selection.dropdown {
    flex: 0 0 150px; /* Fixed width for dropdown */
    min-height: 40px;
    padding: 11px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background-color: var(--bg-app);
    color: var(--text-main);
    display: flex;
    align-items: center;
}
.pitch-controls .ui.selection.dropdown .menu {
    border-radius: 8px;
    border-color: var(--border-soft);
    background-color: var(--bg-card);
}
.pitch-controls .ui.selection.dropdown .menu .item {
    color: var(--text-main);
    padding: 10px 14px;
}
.pitch-controls .ui.selection.dropdown .menu .item:hover {
    background-color: var(--bg-app);
}

.pitch-controls .ui.button {
    flex: 1; /* Take remaining space */
    margin: 0 !important; /* Semantic UI overrides */
    border-radius: 8px;
    border: 1px solid var(--border-soft) !important;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pitch-controls .ui.button:hover {
    background: var(--bg-app) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* Breakdown Gating */
.breakdown-container-wrapper {
    position: relative;
    margin: 20px 0;
    text-align: left;
    background: var(--bg-app);
    border-radius: 12px;
    overflow: hidden;
}

.breakdown-content {
    padding: 20px;
    font-size: 0.9rem;
    transition: filter 0.3s ease;
}

.blur-content {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

.unlock-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
body.dark-mode .unlock-overlay { background: rgba(15, 23, 42, 0.4); }

.blur-content + .unlock-overlay {
    opacity: 1;
    pointer-events: all;
}

.lock-icon { font-size: 1.5rem; color: var(--text-main); margin-bottom: 10px; }
.btn-unlock {
    background: var(--text-main); color: white; border: none;
    padding: 10px 20px; border-radius: 50px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    margin-top: 10px;
}
.btn-unlock:hover { transform: scale(1.05); }

/* Breakdown Rows */
.breakdown-row { display: flex; justify-content: space-between; padding: 3px 0; }
.breakdown-row.sub { color: var(--text-muted); font-size: 0.85rem; padding-left: 10px; }
.breakdown-row.total { font-weight: 700; border-top: 2px solid var(--border-soft); margin-top: 10px; padding-top: 10px; font-size: 1.1rem; }
.divider-dashed { border-bottom: 1px dashed var(--border-soft); margin: 8px 0; }

/* Modal */
.modal-body { text-align: center; padding: 20px; }
.modal-icon { width: 60px; height: 60px; background: #e0e7ff; color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin: 0 auto 15px auto; }
.modal-trust { font-size: 0.8rem; color: var(--text-muted); margin-top: 15px; }


/* --- Mobile Footer --- */
.mobile-footer {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-soft);
    padding: 12px 20px;
    z-index: 10000; /* Ensure very high */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    justify-content: space-between;
    align-items: center;
}

.footer-info { display: flex; flex-direction: column; }
.footer-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; }
.footer-val { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }
.footer-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Dark Mode fixes for Generate Pitch Button */
body.dark-mode .btn-pitch {
    background: var(--primary); /* Keep it primary/bright */
    color: white;
}
body.dark-mode .btn-pitch:hover {
    background: var(--primary-dark);
}

/* Dark Mode fixes for Usage Card text */
body.dark-mode .usage-card .row-title {
    color: var(--text-main);
}
body.dark-mode .usage-card.active .row-title {
    color: white; /* Contrast active state */
}

body.dark-mode .modal-body {
    color: #0f172a;
}

/* Tooltip Z-Index Fix */
.ui.popup {
    z-index: 9999 !important; /* Force on top */
}

/* Mobile Footer Button */
.mobile-footer .footer-btn.secondary {
    display: flex; 
    align-items: center; 
    justify-content: center;
}

/* Mobile Responsive Override */
@media (max-width: 900px) {
    .mobile-footer {
        display: flex !important;
    }
}

/* --- Item Card Styling (Redesigned Wizard) --- */
.items-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: var(--primary);
}

.item-card-header {
    background: #f8fafc; /* Subtle header bg */
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
}
body.dark-mode .item-card-header { background: #1e293b; }

.item-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.item-content {
    font-weight: 600;
    color: var(--text-main);
    border: none;
    background: transparent;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
}
.item-content:focus { outline: none; }

.btn-remove-item {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: color 0.2s;
}
.btn-remove-item:hover { color: #ef4444; }

.item-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.item-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr 80px;
    gap: 12px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.field-group select, 
.field-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
.field-group select:focus,
.field-group input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Hook Section */
.hook-section {
    background: #f0fdf4; /* Light green tint for hooks */
    border: 1px dashed #86efac;
    border-radius: 8px;
    padding: 10px;
}
body.dark-mode .hook-section { background: rgba(22, 163, 74, 0.1); border-color: #166534; }

.hook-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hook-label {
    font-size: 0.85rem;
    color: #15803d;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
body.dark-mode .hook-label { color: #4ade80; }

.item-hooks {
    width: 70px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    text-align: center;
}

/* Extras Toggles */
.item-extras-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
}

.toggle-pill {
    position: relative;
}
.toggle-pill input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.toggle-pill label {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-app);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.toggle-pill input:checked ~ label {
    background: #e0e7ff;
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}
body.dark-mode .toggle-pill input:checked ~ label {
    background: var(--primary);
    color: white;
}

.rate-override {
    margin-left: auto; /* Push to right */
}
.rate-override input {
    padding: 6px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    width: 150px;
    font-size: 0.85rem;
    text-align: right;
    background: transparent;
    color: var(--text-main);
}

/* Expense Card Specifics */
.expense-card {
    border-left: 4px solid #f59e0b;
}
.expense-header {
    background: #fffbeb;
}
body.dark-mode .expense-header { background: rgba(245, 158, 11, 0.1); }

.expense-label {
    color: #d97706;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex; 
    align-items: center; 
    gap: 8px;
}

.expense-grid {
    grid-template-columns: 2fr 1fr 80px;
}
.expense-note {
    font-size: 0.8rem;
    color: #d97706;
    font-style: italic;
    margin-top: -8px;
}

/* Mobile Adjustments for Item Card */
@media (max-width: 600px) {
    .item-grid-row {
        grid-template-columns: 1fr 1fr; /* Stack Qty */
    }
    .field-group.small {
        grid-column: span 2;
    }
    .item-extras-toggles {
        flex-direction: column;
        align-items: stretch;
    }
    .rate-override {
        margin-left: 0;
        width: 100%;
    }
    .rate-override input {
        width: 100%;
    }
    .expense-grid {
        grid-template-columns: 1fr;
    }
}