:root {
    --primary-blue: #4A90E2;
    --primary-blue-dark: #357ABD;
    --primary-blue-light: #E3F2FD;
    --secondary-purple: #6C5CE7;
    --light-gray: #F8FAFC;
    --border-gray: #E2E8F0;
    --text-dark: #1A202C;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    --background-light: #FFFFFF;
    --stranger-bubble: #F1F5F9;
    --success-green: #10B981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-purple) 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-blue-dark);
}

/* Container utility */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---== Homepage Styles ==--- */
body.homepage {
    background: var(--light-gray);
}

/* Hero Header */
.hero-header {
    min-height: 100vh;
    background: var(--gradient-primary);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hero-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Navigation */
.nav-container {
    position: relative;
    z-index: 10;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
}

.nav-logo {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* Hero Content */
.hero-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 5;
    gap: 4rem;
}

.hero-text {
    flex: 1;
    max-width: 500px;
    color: white;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: 1.25rem;
    line-height: 1.7;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Chat Card */
.chat-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-header {
    text-align: center;
    margin-bottom: 2rem;
}

.card-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.card-header p {
    color: var(--text-light);
    font-size: 1rem;
}

/* Interest Section */
.interest-section {
    margin-bottom: 2rem;
}

.interest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    min-height: 32px;
    padding: 0.5rem 0;
}

.interest-chip {
    display: inline-flex;
    align-items: center;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.interest-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.interest-chip .chip-text {
    margin-right: 0.5rem;
}

.interest-chip .remove-chip {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    opacity: 0.8;
}

.interest-chip .remove-chip:hover {
    background-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.interest-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

#interest-input {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    background: white;
    transition: all 0.2s ease;
    outline: none;
}

#interest-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

#interest-input::placeholder {
    color: var(--text-muted);
}

#add-interest-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

#add-interest-btn:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.interest-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

/* Start Chat Button */
.start-chat-btn {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
}

.start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.start-chat-btn:active {
    transform: translateY(0);
}

.btn-icon {
    transition: transform 0.2s ease;
}

.start-chat-btn:hover .btn-icon {
    transform: translateX(2px);
}

/* Features Section */
.features-section {
    padding: 5rem 0;
    background: white;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--border-gray);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-blue-light);
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-blue-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--primary-blue);
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.feature-card p {
    color: var(--text-light);
    line-height: 1.6;
}

/* ---== Header (Shared) ==--- */
#header {
    background-color: var(--background-light);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
}
#header #logo img {
    height: 50px;
    width: auto;
    display: block;
}
#header #online-count {
    font-weight: bold;
    color: var(--text-dark);
}
#header #online-count span {
    color: var(--primary-blue);
}

/* ---== Chat Page Styles ==--- */
body.chat-page {
    background-color: var(--light-gray);
    height: 100vh;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: white;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-gray);
    z-index: 100;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

.logo-section .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo {
    height: 40px;
    width: auto;
}

.status-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.online-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-blue-light);
    border-radius: 50px;
    color: var(--primary-blue);
    font-size: 0.875rem;
    font-weight: 500;
}

.counter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-text {
    white-space: nowrap;
}

#online-count {
    font-weight: 600;
    color: var(--primary-blue-dark);
}

/* Chat Main - Full viewport usage */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100vh - 72px); /* Subtract header height */
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    min-height: 0;
}

/* Messages Section */
.messages-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.messages-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-gray);
    background: var(--light-gray);
    flex-shrink: 0;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
}

.status-indicator.connecting {
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-indicator.searching {
    background: #FFA500;
    animation: pulse 1.5s infinite;
}

.status-indicator.connected {
    background: var(--success-green);
}

.status-indicator.disconnected {
    background: #EF4444;
}

.status-indicator.error {
    background: #DC2626;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    min-height: 0;
    background: white;
}

.messages-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Message Styles */
.message-container {
    display: flex;
    max-width: 70%;
    word-wrap: break-word;
}

.message-container.user {
    align-self: flex-end;
    justify-content: flex-end;
}

.message-container.stranger {
    align-self: flex-start;
    justify-content: flex-start;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.message-bubble.user {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-bubble.stranger {
    background: var(--stranger-bubble);
    color: var(--text-dark);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-gray);
}

/* Typing Animation */
.message-container.typing {
    align-self: flex-start;
}

.typing-bubble {
    background: var(--stranger-bubble) !important;
    border: 1px solid var(--border-gray);
    padding: 1rem !important;
}

.typing-animation {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Status Messages */
.message-status {
    align-self: center;
    margin: 1rem 0;
}

.status-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    background: var(--light-gray);
    border-radius: 20px;
    border: 1px solid var(--border-gray);
}

.new-chat-button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.new-chat-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Input Section */
.input-section {
    border-top: 1px solid var(--border-gray);
    background: white;
    padding: 1.5rem 2rem;
    flex-shrink: 0;
}

.input-section.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.input-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.skip-btn {
    background: var(--stranger-bubble);
    color: var(--text-dark);
    border: 1px solid var(--border-gray);
}

.skip-btn:hover:not(:disabled) {
    background: #E2E8F0;
    transform: translateY(-1px);
}

.skip-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-input-container {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.message-input {
    flex: 1;
    border: 2px solid var(--border-gray);
    border-radius: 24px;
    padding: 0.875rem 4rem 0.875rem 1.25rem;
    font-size: 1rem;
    background: white;
    transition: all 0.2s ease;
    outline: none;
}

.message-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.message-input:disabled {
    background: var(--light-gray);
    color: var(--text-muted);
    cursor: not-allowed;
}

.send-btn {
    position: absolute;
    right: 0.375rem;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-blue-dark);
    transform: scale(1.05);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* ---== About Section ==--- */
.about-section {
    padding: 4rem 0;
    background: white;
    border-top: 1px solid var(--border-gray);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2rem;
    text-align: center;
}

.about-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 2rem 0 1rem 0;
    text-align: left;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    text-align: left;
}

.about-content ul {
    text-align: left;
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.about-content li {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.about-content li strong {
    color: var(--primary-blue);
    font-weight: 600;
}

/* ---== Footer ==--- */
.site-footer {
    background: var(--text-dark);
    color: white;
    padding: 2rem 0;
    margin-top: auto;
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-footer p {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.8;
}

.site-footer nav {
    display: flex;
    gap: 2rem;
}

.site-footer nav a {
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.site-footer nav a:hover {
    opacity: 1;
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive improvements for SEO content */
@media (max-width: 768px) {
    .about-content h2 {
        font-size: 2rem;
    }

    .about-content {
        padding: 0 1rem;
    }

    .site-footer .container {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .site-footer nav {
        gap: 1.5rem;
    }
}

/* Animation utilities */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.interest-chip {
    animation: fadeInUp 0.3s ease;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
