/* =============================================
   Solari Systems — Main Stylesheet
   solarisystems.net
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #080c1a;
    --bg-secondary: #0b1024;
    --bg-card: #0f1530;
    --bg-card-hover: #141c3a;
    --bg-input: #0b1024;
    --border: #1a254a;
    --border-focus: #5ce0d6;
    --cyan: #5ce0d6;
    --cyan-dim: rgba(92, 224, 214, 0.10);
    --cyan-glow: rgba(92, 224, 214, 0.20);
    --purple: #9b6dff;
    --purple-dim: rgba(155, 109, 255, 0.10);
    --purple-glow: rgba(155, 109, 255, 0.20);
    --text-primary: #e4e8f4;
    --text-secondary: #7e8db0;
    --text-muted: #3d4a6a;
    --accent-green: #4ce6a0;
    --accent-red: #f85149;
    --accent-orange: #e6a835;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);
    --transition: 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--cyan);
    text-decoration: none;
    transition: opacity var(--transition);
}
a:hover {
    opacity: 0.85;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.mono {
    font-family: var(--font-mono);
}

/* --- Layout --- */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--cyan);
    color: #080b12;
    font-weight: 600;
}
.btn-primary:hover {
    background: #33ddff;
    box-shadow: var(--shadow-glow);
    opacity: 1;
    transform: translateY(-1px);
}

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

.btn-oauth {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    gap: 12px;
    justify-content: center;
}
.btn-oauth:hover {
    border-color: var(--text-muted);
    background: var(--bg-card-hover);
    opacity: 1;
}
.btn-oauth svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px var(--cyan-dim);
}
.form-input::placeholder {
    color: var(--text-muted);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.card-elevated {
    box-shadow: var(--shadow-lg);
}

/* --- Auth Card --- */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.auth-logo .dot {
    color: var(--cyan);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}
.auth-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--cyan);
}
.auth-tab:hover:not(.active) {
    color: var(--text-primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--accent-red);
    margin-bottom: 16px;
    display: none;
}
.auth-error.visible {
    display: block;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* --- Toast --- */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 360px;
}
.toast.visible {
    transform: translateX(0);
}
.toast.toast-info {
    border-color: var(--cyan);
}

/* --- Site Nav (global sticky bar) --- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: rgba(8, 11, 18, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 212, 255, 0.08);
    z-index: 1000;
}
.site-nav a {
    text-decoration: none;
    color: #00d4ff;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.5px;
}
.site-nav a .dot { color: #ffa726; }

/* --- Nav --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 0;
    background: rgba(8, 11, 18, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-brand {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.nav-brand .dot {
    color: var(--cyan);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color var(--transition);
}
.nav-link:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* --- Hero --- */
.hero {
    padding: 160px 0 100px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--cyan-dim);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cyan);
    margin-bottom: 28px;
    font-family: var(--font-mono);
}

.hero h1 {
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 700;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
    line-height: 1.1;
}
.hero h1 .gradient {
    background: linear-gradient(135deg, var(--cyan), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Stats --- */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 64px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan);
    letter-spacing: -1px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* --- Feature sections --- */
.section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 56px;
}

.section-header h2 {
    font-size: 32px;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

.section-header p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* --- Feature Grid --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition);
}
.feature-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    width: 44px;
    height: 44px;
    background: var(--cyan-dim);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- Confidence section --- */
.confidence-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.confidence-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
}

.confidence-text h2 {
    font-size: 28px;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.confidence-text p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.confidence-demo {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
}

.demo-line {
    padding: 4px 0;
}
.demo-prompt {
    color: var(--text-secondary);
}
.demo-response {
    color: var(--cyan);
}
.demo-meta {
    color: var(--text-muted);
    font-size: 11px;
}

/* --- CTA --- */
.cta-section {
    text-align: center;
    padding: 100px 0 120px;
}

.cta-section h2 {
    font-size: 36px;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.cta-section p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Footer --- */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    font-size: 13px;
    color: var(--text-muted);
}

/* --- Subscription Page --- */
.subscribe-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.plan-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.plan-header h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 42px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan);
    letter-spacing: -2px;
}
.plan-price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0;
}

.plan-features {
    list-style: none;
    margin-top: 16px;
}
.plan-features li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.plan-features li::before {
    content: '';
    width: 16px;
    height: 16px;
    background: var(--cyan-dim);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2300d4ff'%3E%3Cpath d='M6.5 11.5L3 8l1-1 2.5 2.5L11 5l1 1z'/%3E%3C/svg%3E");
    background-size: 16px;
    background-repeat: no-repeat;
    background-position: center;
}

#payment-element {
    margin-bottom: 24px;
}

#payment-message {
    font-size: 13px;
    margin-top: 12px;
    display: none;
}
#payment-message.error {
    color: var(--accent-red);
    display: block;
}
#payment-message.success {
    color: var(--accent-green);
    display: block;
}

/* --- Chat --- */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
}

.chat-header {
    padding: 14px 24px;
    background: rgba(8, 11, 18, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.chat-header-title {
    font-size: 15px;
    font-weight: 600;
}

.chat-header-sub {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.message {
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-user {
    align-self: flex-end;
}

.message-solari {
    align-self: flex-start;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-user .message-bubble {
    background: #1c2533;
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.message-solari .message-bubble {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    gap: 16px;
    padding: 0 4px;
}

.message-meta .grounded {
    color: var(--accent-green);
}

.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-input-wrapper {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 160px;
    outline: none;
    transition: border-color var(--transition);
}
.chat-input:focus {
    border-color: var(--cyan);
}
.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    width: 44px;
    height: 44px;
    background: var(--cyan);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.chat-send:hover {
    background: #33ddff;
    box-shadow: var(--shadow-glow);
}
.chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.chat-send svg {
    width: 18px;
    height: 18px;
}

/* --- Loading animation --- */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    animation: dot-pulse 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes dot-pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--cyan);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Spinner --- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Welcome message --- */
.welcome-message {
    text-align: center;
    padding: 60px 24px;
    max-width: 480px;
    margin: auto;
}

.welcome-message h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.welcome-message p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- Nav Logo (image + text) --- */
.nav-logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.nav-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}
.nav-logo-text {
    color: #5ce0d6;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.5px;
}
.hero-logo-img {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    margin-bottom: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero {
        padding: 100px 16px 40px;
    }
    .hero h1 {
        font-size: 28px;
    }
    .hero-sub {
        font-size: 15px;
        padding: 0 8px;
    }
    .stats-row {
        gap: 16px;
    }
    .confidence-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .auth-card, .subscribe-card {
        padding: 24px 16px;
        margin: 0 12px;
        max-width: calc(100vw - 24px);
    }
    .page-center {
        padding: 60px 0 20px;
    }
    .nav-links {
        gap: 12px;
    }
    .chat-input-wrapper {
        padding: 0;
    }
    .site-nav {
        padding: 10px 12px;
    }
    .container {
        padding: 0 12px;
    }
    .plan-features {
        padding-left: 16px;
    }
    .plan-features li {
        font-size: 13px;
    }
    .plan-price {
        font-size: 36px;
    }
    input[type="text"], input[type="email"], input[type="password"] {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .page-center {
        padding: 20px 10px;
        min-height: 100dvh;
    }
    .auth-card, .subscribe-card {
        padding: 24px 16px;
        max-width: 100%;
        margin: 0;
        border-radius: 12px;
    }
    .site-nav {
        padding: 0 10px;
        height: 48px;
    }
    .auth-logo img {
        width: 36px !important;
        height: 36px !important;
    }
    .auth-tabs {
        gap: 0;
    }
    .auth-tab {
        font-size: 13px;
        padding: 8px 12px;
    }
    .oauth-buttons .btn {
        font-size: 13px;
        padding: 10px 12px;
    }
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    .stats-row {
        flex-direction: column;
        gap: 20px;
    }
}
