/**
 * MonPlan.io - Minimal Elegant Styles
 * Clean, subtle design with Tailwind as the primary styling system
 */

/* ===== CSS Custom Properties ===== */
:root {
    --color-bg: #FAFAFA;
    --color-card: #FFFFFF;
    --color-text: #1A1A2E;
    --color-text-muted: #6B7280;
    --color-pain: #DC2626;
    --color-gain: #059669;
    --color-accent: #1E3A5F;
    --color-border: #E5E7EB;
}

/* ===== Base ===== */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* Prevent text selection on interactive elements */
button,
.chip,
.toggle-option,
.progress-step {
    -webkit-user-select: none;
    user-select: none;
}

/* ===== Typography ===== */
.font-headline {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ===== Utility Colors ===== */
.pain {
    color: var(--color-pain);
}

.gain {
    color: var(--color-gain);
}

.bg-gain {
    background-color: var(--color-gain);
}

/* ===== Card ===== */
.card {
    background: var(--color-card);
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.card-simulator {
    background: var(--color-card);
}

/* ===== Chip ===== */
.chip {
    display: inline-flex;
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    border: 1px solid var(--color-border);
    background: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
    -webkit-tap-highlight-color: transparent;
}

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

.chip:active {
    transform: scale(0.96);
}

.chip.active {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25);
}

/* ===== Toggle ===== */
.toggle-container {
    display: flex;
    background: var(--color-bg);
    border-radius: 9999px;
    padding: 4px;
    gap: 4px;
}

.toggle-option {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    transition: all 0.2s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.toggle-option:active {
    transform: scale(0.98);
}

.toggle-option.active {
    background: white;
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== Input ===== */
.input-field {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    background: white;
    transition: all 0.2s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* ===== Range Slider ===== */
.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: var(--color-border);
    outline: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.range-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(30, 58, 95, 0.4);
}

.range-slider::-moz-range-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    border: none;
    gap: 0.375rem;
    transition: all 0.2s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(30, 58, 95, 0.2);
}

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

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

.btn-secondary:active {
    transform: scale(0.98);
}

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

/* Bank buttons */
.btn-bourso {
    background: #FF6B35;
    color: white;
}

.btn-fortuneo {
    background: #6B4BA3;
    color: white;
}

/* Share button */
.btn-share {
    background: var(--color-gain);
    color: white;
}

.share-card {
    background: linear-gradient(135deg, #F0FDF4 0%, #ECFDF5 100%);
    border: 1px solid #BBF7D0;
    border-radius: 12px;
}

/* ===== Progress Indicator ===== */
.progress-step {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.progress-step.completed {
    background: var(--color-gain);
    color: white;
}

.progress-step.active {
    background: var(--color-accent);
    color: white;
}

.progress-step.pending {
    background: var(--color-border);
    color: var(--color-text-muted);
}

.progress-line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
}

.progress-line.completed {
    background: var(--color-gain);
}

/* ===== Screen Transitions ===== */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ===== Chart ===== */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ===== Safety Gauge ===== */
.gauge-container {
    width: 100%;
    height: 20px;
    background: var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s;
}

.gauge-target {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    background: var(--color-text);
    opacity: 0.3;
}

/* ===== Target Callout ===== */
.target-callout {
    background: linear-gradient(135deg, #1E3A5F 0%, #2A4A6F 100%);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(30, 58, 95, 0.2);
}

/* ===== Assumptions Drawer ===== */
.assumptions-drawer {
    border-top: 1px solid var(--color-border);
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.assumptions-drawer summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    list-style: none;
}

.assumptions-drawer summary::-webkit-details-marker {
    display: none;
}

.assumptions-drawer summary::before {
    content: '▶';
    font-size: 0.625rem;
    margin-right: 0.5rem;
    transition: transform 0.2s;
    display: inline-block;
}

.assumptions-drawer[open] summary::before {
    transform: rotate(90deg);
}

.assumptions-content {
    padding-top: 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-text);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    opacity: 0;
    transition: all 0.2s;
    z-index: 1000;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Journey Steps (Screen 3) ===== */
.journey-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.journey-step {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
}

.step-badge {
    width: 1.75rem;
    height: 1.75rem;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.step-content {
    flex: 1;
}

.journey-step:last-child .step-content {
    border-bottom: none;
}

.step-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 0.25rem;
}

.step-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.step-body {
    font-size: 0.9375rem;
    color: var(--color-text);
    line-height: 1.6;
}

.step-body p {
    margin-bottom: 0.5rem;
}

/* ===== Example & Highlight Boxes ===== */
.example-box {
    background: var(--color-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.example-box .example-label {
    font-weight: 600;
    color: var(--color-accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.highlight-box {
    background: #F0FDF4;
    border-left: 3px solid var(--color-gain);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
}

.highlight-box.warning {
    background: #FEF2F2;
    border-color: var(--color-pain);
}

/* ===== Company Tags ===== */
.company-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.company-tag {
    background: white;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    border: 1px solid var(--color-border);
}

/* ===== PEA Callout ===== */
.pea-callout {
    background: #F0FDF4;
    border-left: 4px solid var(--color-gain);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.pea-callout .callout-title {
    font-weight: 600;
    color: var(--color-gain);
    margin-bottom: 0.25rem;
}

/* ===== Simulator Section ===== */
.simulator-section {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
}

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

.stats-grid>div {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    transition: transform 0.2s ease-out;
}

.stats-grid>div:active {
    transform: scale(0.98);
}

/* ===== Screen Hero ===== */
.screen-hero {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #1E3A5F 0%, #2A4A6F 100%);
    border-radius: 16px;
    position: relative;
    box-shadow: 0 4px 20px rgba(30, 58, 95, 0.15);
}

.screen-hero::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-gain), #34D399);
    border-radius: 4px 4px 0 0;
}

.screen-hero h1 {
    font-size: 1.875rem;
    color: white;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.screen-hero p {
    color: rgba(255, 255, 255, 0.85);
    max-width: 32rem;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== Result Boxes ===== */
.result-box {
    border-radius: 8px;
    border-left: 4px solid;
}

.result-warning {
    background: #FFFBEB;
    border-color: #F59E0B;
}

.result-success {
    background: #F0FDF4;
    border-color: var(--color-gain);
}

.result-danger {
    background: #FEF2F2;
    border-color: var(--color-pain);
}

/* ===== Action Steps (Screen 4) ===== */
.action-step {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.action-badge {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ===== Info Callout ===== */
.info-callout {
    background: #F0FDF4;
    border-left: 4px solid var(--color-gain);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .chart-container {
        height: 220px;
    }

    .step-badge {
        width: 1.75rem;
        height: 1.75rem;
        min-width: 1.75rem;
        font-size: 0.75rem;
    }

    .step-title {
        font-size: 1rem;
    }

    .screen-hero h1 {
        font-size: 1.5rem;
    }
}