/* ============================================================================
   ChatSorter Unified Styles
   Works with: index.html, auth.html, dashboard.html, plans.html
   ============================================================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111;
    --bg-tertiary: #1e1e1e;
    --bg-input: #0a0a0a;
    
    --border-light: #222;
    --border-medium: #333;
    --border-dark: #555;
    
    --text-primary: #fff;
    --text-secondary: #aaa;
    --text-tertiary: #888;
    --text-muted: #666;
    
    --accent-primary: #00ff88;
    --accent-secondary: #00cc66;
    --accent-blue: #0070f3;
    --accent-blue-hover: #0051cc;
    
    --error: #ff4444;
    --success: #00ff88;
    --warning: #ffaa00;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

a:hover {
    color: var(--accent-primary);
}

/* ============================================================================
   LAYOUT CONTAINERS
   ============================================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */

nav {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    display: inline-block;
    text-align: center;
    width: auto;
}

/* Full width buttons for auth page */
body.auth-page .btn,
.auth-container .btn {
    width: 100%;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: scale(1.02);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-tertiary);
}

.btn-secondary:hover {
    border-color: var(--border-dark);
    color: var(--text-secondary);
}

.btn-blue {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.btn-blue:hover {
    background: var(--accent-blue-hover);
}

.btn-oauth {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.btn-oauth:hover {
    border-color: var(--accent-blue);
    background: rgba(0, 112, 243, 0.05);
}

.btn:disabled {
    background: var(--border-medium);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

/* ============================================================================
   HERO SECTION (Landing Page)
   ============================================================================ */

.hero {
    text-align: center;
    padding: 6rem 0 3rem;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.highlight {
    color: var(--accent-primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 4rem;
}

/* ============================================================================
   STATS (Landing Page)
   ============================================================================ */

.stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 3rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    color: var(--text-tertiary);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ============================================================================
   FEATURES GRID (Landing Page)
   ============================================================================ */

.features {
    padding: 6rem 0;
}

.section-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.section-subtitle {
    color: var(--text-tertiary);
    font-size: 1.2rem;
    margin-bottom: 4rem;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 2.5rem;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-description {
    color: var(--text-tertiary);
    line-height: 1.6;
}


/* ============================================================================
   TABS (Auth Page)
   ============================================================================ */

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-input);
    padding: 0.25rem;
    border-radius: 8px;
}

.tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
}

.tab.active {
    background: var(--accent-blue);
    color: var(--text-primary);
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-section {
    display: none;
}

.form-section.active {
    display: block;
}

.input-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 0;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}

input[type="number"] {
    -moz-appearance: textfield;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================================================
   DIVIDER
   ============================================================================ */

.divider {
    text-align: center;
    color: var(--text-muted);
    margin: 1.5rem 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border-medium);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: none;
    font-size: 0.9rem;
}

.alert.show {
    display: block;
}

.alert.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert.warning {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.loading {
    display: none;
    text-align: center;
    padding: 2rem 0;
}

.loading.show {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-medium);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================================
   DASHBOARD LAYOUT
   ============================================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--bg-tertiary);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 24px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar a {
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar a:hover {
    background-color: var(--border-medium);
}

.sidebar a.active {
    background-color: var(--accent-blue);
    color: var(--text-primary);
}

.main {
    margin-left: 250px;
    padding: 30px;
    min-height: 100vh;
}

/* ============================================================================
   DASHBOARD TOP NAV
   ============================================================================ */

.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.topnav h1 {
    font-size: 28px;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card,
.info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.cards .card {
    padding: 20px;
    transition: transform 0.2s;
    margin-bottom: 0;
}

.cards .card:hover {
    transform: translateY(-5px);
}

.card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card p {
    font-size: 28px;
    color: var(--text-primary);
    font-weight: 700;
}

.card small {
    color: var(--text-muted);
    font-size: 12px;
    display: block;
    margin-top: 8px;
}

.info-card h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--accent-blue);
    text-transform: none;
}

/* ============================================================================
   INFO GRID
   ============================================================================ */

.info-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
    color: var(--text-tertiary);
}

.info-grid strong {
    color: var(--text-primary);
}

/* ============================================================================
   CODE BLOCK
   ============================================================================ */

.code-block {
    background-color: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    position: relative;
    word-break: break-all;
    white-space: pre-wrap;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.copy-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* ============================================================================
   CONTENT SECTIONS
   ============================================================================ */

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* ============================================================================
   ERROR STATES
   ============================================================================ */

.error-state {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.error-state.show {
    display: block;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

/* ============================================================================
   ACTIVITY LOG
   ============================================================================ */

.activity-item {
    background-color: var(--bg-input);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--accent-blue);
}

.activity-time {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.activity-event {
    font-weight: 600;
    margin-bottom: 5px;
}

.activity-details {
    color: var(--text-tertiary);
    font-size: 13px;
    font-family: monospace;
}

/* ============================================================================
   PLANS PAGE
   ============================================================================ */

body.plans-page {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    min-height: 100vh;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header .logo {
    font-size: 3rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.title {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.plan-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.plan-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

.plan-card.selected {
    border-color: var(--accent-primary);
    background: rgba(0, 255, 136, 0.05);
}

.plan-card.featured {
    border-color: var(--accent-primary);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

.plan-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.plan-name {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 1.5rem 0;
}

.plan-price small {
    font-size: 1rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.plan-features {
    list-style: none;
    margin: 1.5rem 0;
}

.plan-features li {
    padding: 0.5rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.plan-features li:before {
    content: "✓";
    color: var(--accent-primary);
    font-weight: bold;
    flex-shrink: 0;
}

.select-checkmark {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-medium);
    border-radius: 50%;
    display: none;
}

.plan-card.selected .select-checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.plan-card.selected .select-checkmark:after {
    content: "✓";
    color: var(--bg-primary);
    font-weight: bold;
    font-size: 14px;
}

.continue-btn {
    width: 100%;
    max-width: 400px;
    margin: 2rem auto;
    display: block;
}

.demo-link,
.back-link {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.demo-link a,
.back-link a {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.demo-link a:hover,
.back-link a:hover {
    color: var(--accent-blue);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

footer {
    border-top: 1px solid var(--border-light);
    padding: 4rem 0 2rem;
    margin-top: 6rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand p {
    color: var(--text-tertiary);
    margin-top: 1rem;
}

.footer-section h4 {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-tertiary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1024px) {
    .hero h1 {
        font-size: 3rem;
    }

    .section-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .stats {
        flex-direction: column;
        gap: 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }

    /* Dashboard mobile */
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main {
        margin-left: 0;
        padding: 20px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .topnav {
        flex-direction: column;
        align-items: flex-start;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .auth-container {
        padding: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }
}