/* ===========================================
   CHIRPED WEBSITE - STYLES
   Dark theme matching the Chrome extension
   =========================================== */

/* CSS Variables */
:root {
    /* Colors - matching extension palette */
    --bg-dark: #1a1d21;
    --bg-card: #212529;
    --bg-surface: #343a40;
    --bg-input: #495057;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;

    /* Brand Colors */
    --accent: #0f766e;
    /* Deep Teal - Buttons, UI elements */
    --accent-light: #2dd4bf;
    /* Bright Teal - Text, Icons, Links */
    --accent-hover: #115e59;
    /* Darker Teal for hover */
    --accent-glow: rgba(45, 212, 191, 0.15);

    --border: #444c53;

    /* Spacing */
    --container-width: 1200px;
    --section-padding: 100px;

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Effects */
    --glass: rgba(33, 37, 41, 0.8);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-lg: 20px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-light);
}

/* ===========================================
   NAVIGATION
   =========================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 0;
    background: rgba(26, 29, 33, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.4rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-img {
    height: 40px;
    width: auto;
}

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

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
}

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

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-nav {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.btn-nav:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
    color: white;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-icon {
    font-size: 1.2rem;
}

/* ===========================================
   HERO SECTION
   =========================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 80px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at top, rgba(45, 212, 191, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(108, 117, 125, 0.15) 0%, transparent 50%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.highlight {
    color: var(--accent-light);
    position: relative;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
    line-height: 1.7;
}

/* ===========================================
   SEARCH BAR
   =========================================== */
.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
    padding: 0 16px;
    font-size: 1.3rem;
    opacity: 0.6;
}

.search-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: var(--font-main);
    padding: 12px 0;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-btn:hover {
    background: var(--accent-hover);
}

.search-hint {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===========================================
   FEATURES SECTION
   =========================================== */
.features {
    padding: var(--section-padding) 24px;
    background: var(--bg-card);
}

.features-container {
    max-width: var(--container-width);
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 24px;
}

.feature-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===========================================
   STATS SECTION
   =========================================== */
.stats {
    padding: 60px 24px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stats-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-light);
    line-height: 1;
    margin-bottom: 8px;
}

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

.stat-divider {
    width: 1px;
    height: 60px;
    background: var(--border);
}

/* ===========================================
   CTA SECTION
   =========================================== */
.cta {
    padding: var(--section-padding) 24px;
    text-align: center;
}

.cta-container {
    max-width: 600px;
    margin: 0 auto;
}

.cta-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.cta-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.cta-note {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===========================================
   FOOTER
   =========================================== */
.footer {
    padding: 40px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.footer-links {
    display: flex;
    gap: 32px;
}

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

.footer-copy {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
    .nav-links a:not(.btn) {
        display: none;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }

    .search-icon {
        display: none;
    }

    .search-input {
        width: 100%;
        text-align: center;
    }

    .search-btn {
        width: 100%;
    }

    .stats-container {
        gap: 40px;
    }

    .stat-divider {
        display: none;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-input);
}

/* ===========================================
   AUTH PAGES (Login/Register)
   =========================================== */
.auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 80px;
}

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

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group .optional {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-google {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-google:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

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

.auth-footer a {
    color: var(--accent-light);
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.error-message {
    background: rgba(255, 82, 82, 0.15);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: #ff6b6b;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.success-message {
    background: rgba(52, 168, 83, 0.15);
    border: 1px solid rgba(52, 168, 83, 0.3);
    color: #34a853;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===========================================
   RESULTS PAGE LAYOUT
   =========================================== */
.results-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    max-width: var(--container-width);
    margin: 100px auto 40px;
    padding: 0 24px;
    min-height: calc(100vh - 140px);
}

.results-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    height: fit-content;
}

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

.search-header {
    margin-bottom: 24px;
}

/* Compact search box */
.search-box.compact {
    padding: 4px 8px;
}

.search-box.compact .search-input {
    font-size: 0.95rem;
    padding: 8px 0;
}

.search-box.compact .search-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.results-list-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Interactive Result Item */
.result-item {
    padding: 12px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-bottom: 8px;
}

.result-item:hover {
    background: var(--bg-surface);
}

.result-item.active {
    background: var(--bg-surface);
    border-color: var(--accent);
}

.result-url {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .results-layout {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   SEARCH DROPDOWN
   =========================================== */
.search-container {
    position: relative;
    /* Ensure relative positioning for absolute dropdown */
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

.search-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: var(--bg-surface);
}

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

.item-url {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.item-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

/* ===========================================
   RESOURCE COMMENTS SECTION
   =========================================== */
.resource-comments {
    padding: 60px 24px;
    background: var(--bg-dark);
    /* border-bottom: 1px solid var(--border); */
}

.comments-container {
    max-width: 800px;
    margin: 0 auto;
}

.resource-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.resource-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.comment-count {
    color: var(--text-secondary);
    font-size: 1rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Individual Comment Card */
.web-comment {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s ease;
}

.web-comment:hover {
    border-color: var(--text-muted);
}

.web-comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.web-comment-author {
    font-weight: 600;
    color: var(--accent-light);
}

.web-comment-date {
    color: var(--text-muted);
}

.web-comment-body {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.web-comment-footer {
    display: flex;
    justify-content: flex-end;
}

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

/* Comment Threads & Replies */
.web-comment-thread {
    margin-bottom: 16px;
}

.web-replies {
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

.web-reply {
    background: var(--bg-card);
    margin-top: 8px;
}

.web-reply-indicator {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 8px;
}

/* Loading / Empty States */
.loading-state,
.no-comments,
.error-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.error-state {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
}

/* Comment Input Area */
.comment-input-area {
    margin-bottom: 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.comment-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 12px;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.logged-out-view {
    text-align: center;
    color: var(--text-secondary);
}

.logged-out-view a {
    color: var(--accent-light);
    text-decoration: underline;
}

/* ===========================================
   ACTIVITY FEED SECTION
   =========================================== */
.activity-section {
    padding: var(--section-padding) 24px;
    background: var(--bg-dark);
}

.activity-container {
    max-width: 1000px;
    margin: 0 auto;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.activity-header .section-title {
    margin-bottom: 0;
    font-size: 2rem;
    text-align: left;
}

.activity-tabs {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.activity-tab {
    padding: 8px 16px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.activity-tab:hover {
    color: var(--text-primary);
}

.activity-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.activity-feed {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .activity-feed {
        grid-template-columns: 1fr;
    }
}

.activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.activity-card:hover {
    background: var(--bg-surface);
    border-color: var(--border);
    /* Subtle highlight */
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.activity-card-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.activity-author {
    font-weight: 600;
    color: var(--text-primary);
}

.activity-domain {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.activity-card-body {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 1rem;
    overflow-wrap: break-word;
}

.activity-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.activity-likes {
    display: flex;
    align-items: center;
    gap: 6px;
}

.no-activity {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

.loading-state,
.error-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.error-tooltip {
    position: absolute;
    background: #fff3cd;
    /* Soft yellow */
    color: #664d03;
    /* Deep amber/brown text */
    border: 1px solid #ffe69c;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1000;
    bottom: calc(100% + 10px);
    left: 0;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;

    /* Initial state for fade */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.error-tooltip.show {
    opacity: 1;
}

.error-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 15px;
    border-width: 6px;
    border-style: solid;
    border-color: #fff3cd transparent transparent transparent;
}