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

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
}

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

.container-fluid {
    max-width: 100%;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text);
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-link {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: none;
    font-size: 1rem;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: #1d4ed8;
}

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-link:hover {
    background: var(--surface);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.subhead {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.features-list {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.feature-item {
    color: var(--text-muted);
}

/* Sections */
section {
    padding: 4rem 0;
}

section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.social-proof {
    background: var(--surface);
    text-align: center;
}

.pricing-teaser {
    background: var(--surface);
    text-align: center;
}

.pricing-teaser p {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.cta {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    text-align: center;
}

.cta h2 {
    color: white;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Pricing */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.plan-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    position: relative;
}

.plan-card.featured {
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.1);
}

.plan-card .badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
}

.price {
    font-size: 3rem;
    font-weight: bold;
    margin: 1rem 0;
}

.price .period {
    font-size: 1rem;
    color: var(--text-muted);
}

.plan-card ul {
    list-style: none;
    margin: 2rem 0;
}

.plan-card li {
    padding: 0.5rem 0;
}

.pricing-note {
    text-align: center;
    color: var(--text-muted);
    margin-top: 2rem;
}

/* Sign In */
.signin-page {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signin-box {
    background: white;
    padding: 3rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    max-width: 450px;
    width: 100%;
}

.signin-box h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.form-group {
    margin: 1.5rem 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.success-message {
    background: #d1fae5;
    border: 1px solid #10b981;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
    color: #065f46;
}

.error-message {
    background: #fee2e2;
    border: 1px solid #ef4444;
    padding: 1rem;
    border-radius: 0.375rem;
    margin: 1rem 0;
    color: #991b1b;
}

.signin-note {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 2rem;
}

/* App Page */
.app-container {
    min-height: calc(100vh - 200px);
}

.success-banner {
    background: var(--success-color);
    color: white;
    padding: 1rem;
    text-align: center;
}

.upgrade-bar {
    background: #fef3c7;
    border-bottom: 1px solid #f59e0b;
    padding: 1rem;
}

.upgrade-bar.sticky {
    position: sticky;
    top: 60px;
    z-index: 99;
}

.upgrade-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem 0;
}

.inputs-panel, .outputs-panel {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.quota-badge {
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.quota-badge.unlimited {
    background: #d1fae5;
    color: #065f46;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.btn-preset {
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

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

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.loading-overlay.htmx-indicator {
    display: none;
}

.htmx-request .loading-overlay.htmx-indicator {
    display: flex !important;
}

#quote-form.htmx-request #loading {
    display: flex !important;
}

.loading-popup {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

.loading-popup h3 {
    margin: 1.5rem 0 0.5rem 0;
    color: #1e40af;
    font-size: 1.5rem;
}

.loading-popup p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e0e7ff;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.output-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.output-content {
    padding: 1rem;
    background: var(--surface);
    border-radius: 0.375rem;
    min-height: 300px;
}

.output-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.inline-upsell {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: var(--text);
}

.upgrade-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.upgrade-option {
    border: 2px solid var(--border);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

.upgrade-option.featured {
    border-color: var(--primary-color);
}

/* Account Page */
.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.account-section {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.plan-badge {
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
}

.plan-badge.free {
    background: #e2e8f0;
}

.plan-badge.starter {
    background: #dbeafe;
    color: #1e40af;
}

.plan-badge.pro {
    background: #fef3c7;
    color: #92400e;
}

.usage-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.upgrade-section, .billing-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: 0.5rem;
    margin-top: 2rem;
}

.upgrade-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Legal Pages */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.legal-page h1 {
    margin-bottom: 0.5rem;
}

.legal-page h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-align: left;
}

.legal-page ul {
    margin-left: 2rem;
}

.last-updated {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    background: var(--surface);
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-section {
    display: flex;
    gap: 1.5rem;
}

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

.footer-section a:hover {
    color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .subhead {
        font-size: 1.25rem;
    }
    
    .features-list {
        flex-direction: column;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .upgrade-options {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Quotes page styles */
.subtitle {
    color: #6b7280;
    margin: -10px 0 30px 0;
    font-size: 16px;
}

.quote-card {
    transition: box-shadow 0.2s;
}

.quote-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-secondary {
    background-color: white;
    color: #2563eb;
    border: 1px solid #2563eb;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #eff6ff;
}
