/* Venderonline - Modern Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #64748b;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f97316;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Main Layout Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Stats em linha horizontal */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Bottom grid para breakdown e chart */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-img {
    height: 100px;
    max-height: 100px;
    max-width: 250px;
    object-fit: contain;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
}

/* Platform Selector */
.platform-selector {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.platform-btn {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid transparent;
    background: transparent;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.platform-btn .brand-img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
}

.platform-btn .brand-img.ml {
    width: 30px;
    height: 30px;
    border-radius: 4px;
}

.platform-btn .brand-img.shopee {
    width: 24px;
    height: 24px;
}

.platform-btn .brand-img.tiktok {
    width: 22px;
    height: 22px;
}

.platform-btn .brand-img.shein {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.platform-btn:hover {
    color: var(--text);
    background: var(--bg);
}

.platform-btn.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text);
    border: 2px solid var(--primary);
}


/* ML Toggle */
.ml-premium {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.625rem;
    margin-bottom: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.ml-premium.show { display: flex; }

/* Shein Category Toggle */
.shein-category {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.shein-category.show { display: flex; }

/* Shopee Account Toggle */
.shopee-account {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.shopee-account.show { display: flex; }

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    font-weight: 500;
}

.radio-option input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
}

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

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

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

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

/* Card */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

.card-header {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Inputs */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.input-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.input-field input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.input-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-field input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Toggle */
.mode-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 8px;
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.mode-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Big Input */
.target-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 10px;
}

.target-input label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.target-input input {
    width: 140px;
    padding: 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--primary);
    border-radius: 10px;
    background: var(--card);
    color: var(--primary);
    font-family: inherit;
}

.target-input input:focus {
    outline: none;
}

/* Expand Button */
.expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.625rem;
    margin-top: 0.75rem;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.expand-btn:hover {
    color: var(--primary);
}

.expand-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.expand-content {
    display: none;
    padding-top: 0.875rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.expand-content.show {
    display: block;
}

/* Results Card */
.results-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.result-highlight {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border-radius: 12px;
    padding: 1.75rem;
    text-align: center;
    color: white;
    margin-bottom: 1.25rem;
}

.result-label {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-value {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.result-diff {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

/* Stats Grid Inside Card */
.stats-grid-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.stat-item .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.stat-item .stat-value.green { color: var(--green); }
.stat-item .stat-value.red { color: var(--red); }
.stat-item .stat-value.orange { color: var(--orange); }

.stat-item .stat-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Alert */
.alert {
    display: none;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.alert.show { display: block; }

.alert.warning {
    background: #fef3c7;
    color: #92400e;
}

.alert.danger {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .alert.warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .alert.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.orange { color: var(--orange); }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Stats Row para 4 colunas */
.stats-row .stat-card {
    padding: 1.5rem 1rem;
}

/* Breakdown */
.breakdown {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.breakdown-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border);
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-row.total {
    background: var(--bg);
    font-weight: 700;
    font-size: 1rem;
}

.breakdown-row span:last-child {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.breakdown-row.negative span:last-child {
    color: var(--red);
}

/* Chart */
.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.chart-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.chart-card canvas {
    max-height: 250px;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--red);
    color: var(--red);
}

.btn-outline-success {
    background: var(--card);
    color: var(--green);
    border: 1px solid var(--green);
}

.btn-outline-success:hover {
    background: var(--green);
    color: white;
}

.btn-success {
    background: var(--green);
    color: white;
    border: 1px solid var(--green);
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: var(--red);
    color: white;
    border: 1px solid var(--red);
}

.btn-danger:hover {
    background: #dc2626;
}

.text-white {
    color: white !important;
}

/* Text colors for comparison */
.text-success {
    color: var(--green) !important;
}

.text-danger {
    color: var(--red) !important;
}

/* Box Margin States */
.box-margin {
    transition: all 0.3s;
}

.box-margin.danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.box-margin.danger .stat-value {
    color: var(--red) !important;
}

.box-margin.warning {
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.box-margin.warning .stat-value {
    color: var(--orange) !important;
}

.box-margin.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.box-margin.success .stat-value {
    color: var(--green) !important;
}

/* ROAS/CPA Row */
.roas-cpa-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.roas-cpa-row strong {
    color: var(--text);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Utilities */
.hidden { display: none !important; }

/* ===== MOBILE RESPONSIVENESS ===== */

/* Tablets e telas médias */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    .header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .logo-img {
        height: 48px;
    }

    /* Platform selector - 2x2 grid em tablets */
    .platform-selector {
        flex-wrap: wrap;
        padding: 0.375rem;
        gap: 0.5rem;
    }

    .platform-btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    .card {
        padding: 1.25rem;
    }

    .result-value {
        font-size: 2.25rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    .header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .logo {
        font-size: 1.125rem;
        gap: 0.5rem;
    }

    .logo-img {
        height: 40px;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    /* Platform selector - vertical em mobile pequeno */
    .platform-selector {
        flex-direction: column;
        padding: 0.375rem;
        gap: 0.375rem;
        margin-bottom: 1rem;
    }

    .platform-btn {
        flex: none;
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
        justify-content: flex-start;
        gap: 0.75rem;
    }

    .platform-btn .brand-img {
        width: 20px;
        height: 20px;
    }

    .platform-btn .brand-img.ml {
        width: 26px;
        height: 26px;
    }

    /* ML Toggle */
    .ml-premium {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
        border-radius: 12px;
    }

    .card-header {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }

    /* Input grid - single column em mobile */
    .input-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    /* Override para taxas - manter 3 colunas mas mais compacto */
    .expand-content .input-grid {
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 0.5rem;
    }

    .input-field label {
        font-size: 0.6875rem;
    }

    .input-field input {
        padding: 0.5rem 0.625rem;
        font-size: 0.875rem;
    }

    /* Target input */
    .target-input {
        padding: 0.75rem;
    }

    .target-input input {
        width: 120px;
        padding: 0.625rem;
        font-size: 1.5rem;
    }

    .target-input label {
        font-size: 0.6875rem;
    }

    /* Mode toggle */
    .mode-toggle {
        margin-bottom: 0.75rem;
    }

    .mode-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    /* Expand button */
    .expand-btn {
        padding: 0.5rem;
        margin-top: 0.5rem;
        font-size: 0.6875rem;
    }

    .expand-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Results */
    .result-highlight {
        padding: 1.25rem 1rem;
        border-radius: 10px;
        margin-bottom: 1rem;
    }

    .result-label {
        font-size: 0.6875rem;
    }

    .result-value {
        font-size: 2rem;
    }

    .result-diff {
        font-size: 0.75rem;
    }

    /* Stats grid */
    .stats-grid-inner {
        gap: 0.625rem;
    }

    .stat-item {
        padding: 0.75rem 0.5rem;
        border-radius: 8px;
    }

    .stat-item .stat-value {
        font-size: 1rem;
    }

    .stat-item .stat-label {
        font-size: 0.5625rem;
    }

    /* Alert */
    .alert {
        padding: 0.625rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    /* ROAS/CPA */
    .roas-cpa-row {
        padding: 0.75rem;
        margin-top: 0.75rem;
        font-size: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    /* Breakdown */
    .breakdown {
        border-radius: 12px;
    }

    .breakdown-title {
        font-size: 0.75rem;
        padding: 1rem 1rem 0.625rem;
    }

    .breakdown-row {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }

    .breakdown-row.total {
        font-size: 0.875rem;
    }

    /* Chart */
    .chart-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .chart-title {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }

    .chart-card canvas {
        max-height: 200px;
    }

    /* Buttons */
    .btn-group {
        margin-bottom: 1.5rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        border-radius: 10px;
    }

    .btn svg {
        width: 18px;
        height: 18px;
    }

    /* Footer */
    .footer {
        padding: 1.5rem 0;
        font-size: 0.75rem;
    }

    /* Bottom grid - stack em mobile */
    .bottom-grid {
        gap: 1rem;
        margin-bottom: 1rem;
    }

    /* Main grid gap */
    .main-grid {
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .left-column, .right-column {
        gap: 0.75rem;
    }
}

/* Extra small phones (iPhone SE, etc) */
@media (max-width: 375px) {
    .container {
        padding: 0.25rem;
    }

    .logo {
        font-size: 1rem;
    }

    .logo-img {
        height: 34px;
    }

    .platform-btn {
        padding: 0.625rem;
        font-size: 0.8125rem;
    }

    .result-value {
        font-size: 1.75rem;
    }

    .stat-item .stat-value {
        font-size: 0.9375rem;
    }

    .stat-item .stat-label {
        font-size: 0.5rem;
    }

    /* Taxas em 1 coluna para telas muito pequenas */
    .expand-content .input-grid {
        grid-template-columns: 1fr !important;
    }

    .target-input input {
        width: 100px;
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
}
