/* ==========================================================================
   SELLCRAFT AI — DESIGN SYSTEM & TOKENS
   ========================================================================== */

:root {
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- DARK THEME (DEFAULT) --- */
body.theme-dark {
    --bg-page: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1c2128;
    --bg-subtle: #21262d;
    --bg-input: #0d1117;
    --border-color: #30363d;
    --border-highlight: #484f58;

    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --accent: #f59e0b;           /* Warm Amber / Gold */
    --accent-hover: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --accent-subtle: rgba(245, 158, 11, 0.1);

    --success: #10b981;
    --success-subtle: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* --- LIGHT THEME --- */
body.theme-light {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-subtle: #f1f5f9;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-highlight: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent: #d97706;
    --accent-hover: #b45309;
    --accent-glow: rgba(217, 119, 6, 0.15);
    --accent-subtle: rgba(217, 119, 6, 0.08);

    --success: #059669;
    --success-subtle: rgba(5, 150, 105, 0.1);
    --warning: #d97706;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   GLOBAL RESET & BASE
   ========================================================================== */

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

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    transition: var(--transition);
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
}

.brand-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-accent {
    color: var(--accent);
}

.badge-hf {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: #e97b77;
    color: #10201d;
    letter-spacing: 0.02em;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-subtle);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.theme-toggle {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: rotate(15deg);
}

/* ==========================================================================
   HERO STRIP
   ========================================================================== */

.hero-strip {
    padding: 2.5rem 1.5rem 1.5rem;
    text-align: center;
}

.hero-inner {
    max-width: 860px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--accent);
    margin-bottom: 1rem;
    letter-spacing: 0.03em;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 740px;
    margin: 0 auto;
}

/* ==========================================================================
   STUDIO GRID LAYOUT
   ========================================================================== */

.main-content {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    flex: 1;
}

.studio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 990px) {
    .studio-grid {
        grid-template-columns: 1fr 1.2fr;
    }
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.4rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pill-tag {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */

.studio-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.flex-1 {
    flex: 1;
}

.form-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-label-sm {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    padding: 0.75rem 0.9rem;
    transition: var(--transition);
}

.form-input-sm {
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Image Dropzone */
.image-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg-subtle);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.image-dropzone:hover, .image-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.file-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.dropzone-icon {
    font-size: 1.6rem;
}

.dropzone-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.dropzone-text strong {
    color: var(--accent);
}

.dropzone-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropzone-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-height: 140px;
}

.dropzone-preview img {
    max-height: 130px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.btn-remove-img {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Tone Chips */
.tone-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tone-chip {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 13px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tone-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.tone-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #10201d;
    font-weight: 600;
}

/* Financials Simulator Box */
.financials-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
}

.financials-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.financials-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.financials-badge {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--success-subtle);
    color: var(--success);
}

.financials-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

/* Primary Generate Button */
.btn-primary {
    background: var(--accent);
    color: #10201d;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.95rem 1.4rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 4px 14px var(--accent-glow);
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

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

.btn-primary.loading {
    opacity: 0.75;
    pointer-events: none;
}

/* ==========================================================================
   RESULTS WORKBENCH (RIGHT COLUMN)
   ========================================================================== */

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Profit Summary Card */
.profit-summary-card {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.4rem;
}

.profit-stat {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.profit-stat.highlight {
    background: var(--success-subtle);
    border: 1px solid var(--success);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 3px 0;
}

.profit-value {
    color: var(--success);
}

.fee-value {
    color: var(--text-secondary);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Output Result Boxes */
.output-sections {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.result-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.result-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.char-count, .tag-helper {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-content-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}

.result-text {
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.55;
    flex: 1;
}

.result-text.pre-wrap {
    white-space: pre-wrap;
    font-size: 0.9rem;
}

.btn-copy-sub {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.btn-copy-sub:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Tags Container */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.4rem;
}

.tag-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}

.tag-pill:hover {
    background: var(--accent);
    color: #10201d;
    border-color: var(--accent);
}

.tag-placeholder {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Bullets List */
.bullets-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.3rem;
}

.bullets-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.2rem;
    line-height: 1.45;
}

.bullets-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 800;
}

.bullets-list li.bullet-placeholder {
    font-style: italic;
    color: var(--text-muted);
}
.bullets-list li.bullet-placeholder::before {
    content: "•";
    color: var(--text-muted);
}

/* ==========================================================================
   SAVED HISTORY SECTION
   ========================================================================== */

.history-section {
    margin-top: 2rem;
}

.history-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

@media (min-width: 768px) {
    .history-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.history-item {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.history-item-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.history-empty {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem 0;
}

/* ==========================================================================
   OPEN INNOVATION VALUE STRIP
   ========================================================================== */

.open-innovation-strip {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-color);
}

.open-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .open-inner {
        grid-template-columns: repeat(3, 1fr);
    }
}

.open-col {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: var(--transition);
}

.open-col:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-sm);
}

.open-icon {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    display: inline-block;
}

.open-col h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.open-col p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-primary);
    color: var(--bg-page);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}
