/* ActiveCampaign Cost Optimizer - Styles */

:root {
    --primary: #1a2332;
    --primary-light: #243044;
    --accent: #356ae6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-blue: #356ae6;
    --accent-purple: #8b5cf6;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-logo { width: 24px; height: 24px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
}

.nav-links a:hover { color: white; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.account-name {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* Main Content */
.main-content { flex: 1; }

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

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1e3a5f 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-icon svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: #cbd5e1;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.hero-stat { display: flex; flex-direction: column; }

.stat-number { font-size: 2rem; font-weight: 800; }

.stat-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.feature svg { width: 20px; height: 20px; }

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary { background: var(--accent-blue); color: white; }
.btn-primary:hover { background: #2556c4; }

.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

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

.btn-danger { background: var(--accent-red); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 18px; height: 18px; }

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 { font-size: 1.25rem; margin-bottom: 0.75rem; }

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

.card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.page-header h1 { font-size: 1.75rem; }

.subtitle { color: var(--text-secondary); font-size: 0.9rem; }

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

.header-meta { text-align: right; }

.team-info { margin-bottom: 0.25rem; }
.team-info .label { color: var(--text-secondary); font-size: 0.8rem; }
.team-info .value { font-weight: 600; font-size: 0.9rem; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-secondary { margin-bottom: 1.5rem; }

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

.stat-card.stat-small { padding: 1rem; }
.stat-card.stat-warning { border-left: 3px solid var(--accent-yellow); }
.stat-card.stat-info { border-left: 3px solid var(--accent-blue); }

.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); }
.stat-small .stat-value { font-size: 1.5rem; }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Savings */
.savings-highlight {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.savings-banner {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.savings-banner .savings-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.savings-icon svg { width: 32px; height: 32px; color: var(--accent-green); }

.savings-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.savings-amount { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.savings-green { color: var(--accent-green); }
.savings-arrow svg { color: var(--accent-green); }
.savings-optimized { color: var(--accent-green); }
.savings-annual .savings-amount { font-size: 1.25rem; }
.savings-badge { margin-left: auto; }

.tier-comparison {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.tier-current { color: var(--text-secondary); }
.tier-optimized { color: var(--accent-green); font-weight: 600; }
.savings-cell { color: var(--accent-green); font-weight: 600; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr:hover { background: #f8fafc; }
.pricing-table-wrapper { max-width: 700px; margin: 0 auto; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-demo { background: #fef3c7; color: #92400e; }
.badge-plan { background: #e0e7ff; color: #3730a3; margin-left: 0.5rem; }
.badge-type { background: #e0e7ff; color: #3730a3; }
.badge-risk-high { background: #fef2f2; color: #991b1b; }
.badge-risk-medium { background: #fffbeb; color: #92400e; }
.badge-risk-low { background: #f0fdf4; color: #166534; }

/* Findings */
.findings-section { margin-top: 2rem; }
.findings-section h2 { font-size: 1.25rem; margin-bottom: 1rem; }

.finding-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.finding-card.finding-high { border-left: 4px solid var(--accent-red); }
.finding-card.finding-medium { border-left: 4px solid var(--accent-yellow); }
.finding-card.finding-low { border-left: 4px solid var(--accent-green); }

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.finding-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.finding-title-row h3 { font-size: 1rem; margin: 0; }
.finding-savings .savings-amount { font-size: 1.25rem; color: var(--accent-green); }
.finding-description { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.75rem; }
.finding-meta { margin-bottom: 0.75rem; }

.affected-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.finding-recommendation {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.finding-details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.detail-list { margin-bottom: 0.5rem; font-size: 0.875rem; }

.detail-tag {
    display: inline-block;
    background: #e2e8f0;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin: 0.15rem;
}

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(53, 106, 230, 0.1);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

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

.analysis-form { margin-top: 1rem; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 2rem; }
.empty-icon svg { width: 48px; height: 48px; color: #94a3b8; margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1rem; }

/* Success state */
.success-state { text-align: center; padding: 3rem 2rem; }
.success-icon svg { width: 48px; height: 48px; color: var(--accent-green); margin-bottom: 1rem; }

/* Connect page */
.connect-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 950px;
    margin: 2rem auto;
}

.connect-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.connect-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }

.connect-form { margin-top: 1.5rem; }

.demo-divider {
    text-align: center;
    margin: 1.25rem 0;
    position: relative;
}

.demo-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.demo-divider span {
    background: var(--card-bg);
    padding: 0 1rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.demo-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

.connect-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.connect-sidebar h3 { font-size: 1.1rem; margin-bottom: 1.5rem; }

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setup-step { display: flex; gap: 1rem; }

.step-num {
    width: 28px;
    height: 28px;
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.setup-step strong { font-size: 0.9rem; display: block; margin-bottom: 0.25rem; }
.setup-step p { font-size: 0.8rem; color: var(--text-secondary); }

.setup-step code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.security-callout {
    margin-top: 2rem;
    padding: 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
}

.security-callout h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #166534;
}

.security-callout ul {
    list-style: none;
    padding: 0;
}

.security-callout li {
    padding: 0.2rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.8rem;
    color: #166534;
}

.security-callout li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    font-weight: 700;
}

/* Info sections */
.info-section { margin: 3rem 0; }

.info-section h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
}

.step { text-align: center; padding: 1.5rem; }

.step-number {
    width: 40px;
    height: 40px;
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step h3 { margin-bottom: 0.5rem; }
.step p { font-size: 0.9rem; color: var(--text-secondary); }

.analysis-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.analysis-type {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    padding-left: 1.5rem;
}

.type-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: var(--radius) 0 0 var(--radius);
}

.analysis-type h4 { margin-bottom: 0.35rem; font-size: 0.95rem; }
.analysis-type p { font-size: 0.8rem; color: var(--text-secondary); }

/* Footer */
.footer {
    background: var(--primary);
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    margin-top: auto;
}

.timestamp { font-size: 0.8rem; color: var(--text-secondary); }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .hero-stats { gap: 1.5rem; }
    .hero-features { flex-direction: column; gap: 0.75rem; }
    .steps { grid-template-columns: 1fr; }
    .connect-page { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .savings-highlight { flex-direction: column; text-align: center; }
    .finding-header { flex-direction: column; gap: 0.5rem; }
    .form-row { flex-direction: column; }
}
