/* ==============================================
   RANDO CHAT - Elite Dark Theme CSS
   ============================================== */

:root {
    --primary-dark: #1a1a2e;
    --secondary-dark: #16213e;
    --neon-blue: #00d4ff;
    --neon-purple: #a855f7;
    --neon-pink: #ec4899;
    --accent-blue: #0ea5e9;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --bg-page: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --bg-chat: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
    --bg-glass: rgba(26, 26, 46, 0.7);
    --bg-glass-light: rgba(26, 26, 46, 0.5);
    --bg-panel: rgba(26, 26, 46, 0.9);
    --border-color: rgba(0, 212, 255, 0.1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --primary-dark: #f8fafc;
    --secondary-dark: #eef2ff;
    --neon-blue: #0ea5e9;
    --neon-purple: #8b5cf6;
    --neon-pink: #ec4899;
    --accent-blue: #0284c7;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --bg-page: linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #e2e8f0 100%);
    --bg-chat: linear-gradient(135deg, rgba(248, 250, 252, 0.98) 0%, rgba(226, 232, 240, 0.98) 100%);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-glass-light: rgba(255, 255, 255, 0.6);
    --bg-panel: rgba(255, 255, 255, 0.95);
    --border-color: rgba(2, 132, 199, 0.15);
}

/* ==============================================
   Base Styles
   ============================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: rgba(0, 212, 255, 0.35);
    color: #0b1020;
}

::-moz-selection {
    background: rgba(0, 212, 255, 0.35);
    color: #0b1020;
}

[data-theme="light"] ::selection,
[data-theme="light"] ::-moz-selection {
    background: rgba(2, 132, 199, 0.25);
    color: #0b1020;
}

.text-gradient::selection,
.text-gradient::-moz-selection {
    color: #0b1020;
    -webkit-text-fill-color: #0b1020;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', 'Noto Sans Tamil', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    overflow: hidden;
}

body {
    background-attachment: fixed;
    -webkit-user-select: text;
    user-select: text;
}

a {
    color: var(--neon-blue);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--neon-pink);
    text-decoration: underline;
}

/* ==============================================
   Scrollbar Styling
   ============================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-glass);
}

::-webkit-scrollbar-thumb {
    background: var(--neon-blue);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-pink);
}

/* ==============================================
   Utilities
   ============================================== */

.backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.glass-effect {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
}

.glass-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--neon-blue);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.glass-input::placeholder {
    color: var(--text-secondary);
}

.text-gradient {
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-neon {
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.btn-neon {
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--accent-blue) 100%);
    border: none;
    color: #000;
    font-weight: 600;
    border-radius: 10px;
    transition: var(--transition-smooth);
    text-shadow: none;
}

.btn-neon:hover {
    background: linear-gradient(135deg, var(--neon-pink) 0%, var(--neon-blue) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
    color: #000;
}

.btn-neon:active {
    transform: translateY(0);
}

.btn-outline-neon {
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

.btn-outline-neon:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--neon-blue);
    border-color: var(--neon-blue);
}

.glow-on-hover {
    position: relative;
}

.glow-on-hover:hover {
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4), inset 0 0 20px rgba(0, 212, 255, 0.1);
}

/* ==============================================
   Loading Spinner
   ============================================== */

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 212, 255, 0.1);
    border-top-color: var(--neon-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==============================================
   Animations
   ============================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes blink {
    0%, 19%, 21%, 100% { opacity: 1; }
    20% { opacity: 0; }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-delay {
    animation: fadeIn 0.6s ease-out 0.2s forwards;
    opacity: 0;
}

.animate-slide-in {
    animation: slideInLeft 0.5s ease-out forwards;
}

.animate-slide-in-delay-1 {
    animation: slideInLeft 0.5s ease-out 0.1s forwards;
    opacity: 0;
}

.animate-slide-in-delay-2 {
    animation: slideInLeft 0.5s ease-out 0.2s forwards;
    opacity: 0;
}

.animate-slide-in-delay-3 {
    animation: slideInLeft 0.5s ease-out 0.3s forwards;
    opacity: 0;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-float-delay {
    animation: float 3s ease-in-out 0.5s infinite;
}

.animate-float-delay-2 {
    animation: float 3s ease-in-out 1s infinite;
}

/* ==============================================
   Landing Page
   ============================================== */

.landing-page {
    background: var(--bg-page);
    min-height: 100vh;
}

.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.hero-text-container {
    padding: 20px;
}

.hero-section h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.features-list {
    display: flex;
    flex-direction: column;
}

.feature-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.feature-item:hover {
    transform: translateX(10px);
}

.chat-preview-container {
    position: relative;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 15px;
    margin-bottom: 12px;
    max-width: 70%;
    word-wrap: break-word;
    animation: fadeIn 0.5s ease-out;
}

.chat-bubble-left {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.chat-bubble-right {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 15px;
    width: fit-content;
    max-width: 70%;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-blue);
    animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    40% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Animated Background */
.animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: blobMove 8s infinite ease-in-out;
}

.blob-1 {
    width: 300px;
    height: 300px;
    background: rgba(0, 212, 255, 0.5);
    top: -50px;
    left: -50px;
}

.blob-2 {
    width: 250px;
    height: 250px;
    background: rgba(168, 85, 247, 0.5);
    bottom: 50px;
    right: -50px;
    animation-delay: 2s;
}

.blob-3 {
    width: 200px;
    height: 200px;
    background: rgba(236, 72, 153, 0.5);
    bottom: 200px;
    left: 50%;
    animation-delay: 4s;
}

@keyframes blobMove {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(30px, -30px);
    }
    50% {
        transform: translate(-30px, 30px);
    }
    75% {
        transform: translate(20px, 20px);
    }
}

/* Stats Section */
.stat-card {
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--bg-panel);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    background: rgba(0, 212, 255, 0.05);
    border-color: var(--neon-blue);
    transform: translateY(-5px);
}

.button-group {
    flex-wrap: wrap;
    align-items: center;
}

.button-group .btn {
    min-width: 200px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Modal Styles */
.modal-content {
    border: 1px solid var(--border-color);
    border-radius: 15px;
}

.modal-header {
    border-color: var(--border-color) !important;
}

.modal-footer {
    border-color: var(--border-color) !important;
}

.btn-close-white {
    filter: invert(1);
}

/* ==============================================
   Chat Page
   ============================================== */

.chat-page {
    min-height: 100vh;
    overflow: auto;
}

.chat-wrapper {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 0;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    padding: 0;
    margin: 0;
}

.chat-sidebar {
    width: 320px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    transition: var(--transition-smooth);
    height: 100vh;
    max-height: 100vh;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Sidebar Toggle Button (hidden by default, shown on mobile) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 999;
    background: var(--neon-blue);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sidebar-toggle:hover {
    background: var(--neon-pink);
    transform: scale(1.1);
}

.sidebar-toggle i {
    font-size: 18px;
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.user-info-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-pink) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
}

.user-name {
    color: var(--text-primary);
    font-weight: 600;
}

.user-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
    background: #ef4444;
    animation: none;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.chat-history {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.chat-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.chat-history-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.1);
    background: rgba(0, 212, 255, 0.05);
    color: var(--text-primary);
    text-align: left;
    transition: var(--transition-smooth);
}

.chat-history-item:hover {
    border-color: var(--neon-blue);
    background: rgba(0, 212, 255, 0.1);
}

.chat-history-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-history-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-history-empty {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 2px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-blue);
    margin: 0;
}

.chat-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
    max-height: 100vh;
}

.chat-status-bar {
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel);
    flex-shrink: 0;
}

.connection-status {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.offline {
    background: #ef4444;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.messages-container {
    flex: 1 1 auto;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    max-height: 100%;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.empty-state-content {
    text-align: center;
    opacity: 0.8;
}

.empty-state-content i {
    font-size: 3rem;
    color: var(--neon-blue);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-content h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.message-bubble {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    align-self: flex-start;
    margin-bottom: 12px;
    animation: slideInLeft 0.3s ease-out;
}

.message-bubble.own-message {
    justify-content: flex-end;
    align-items: flex-end;
    align-self: flex-end;
    animation: slideInRight 0.3s ease-out;
}

.message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 1rem;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.message-bubble.other-message .message-content {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-bottom-left-radius: 3px;
    color: var(--text-primary);
}

.message-bubble.own-message .message-content {
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--accent-blue) 100%);
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 3px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 10px;
}

.typing-indicator-container {
    padding: 0 20px;
    min-height: 40px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-blue);
    animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-indicator span:nth-child(4) {
    font-size: 0.85rem;
    color: var(--text-secondary);
    animation: none;
    background: none;
    margin-left: 5px;
}

.message-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-panel);
    flex-shrink: 0;
    width: 100%;
    min-height: auto;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

[data-theme="light"] .glass-input {
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-primary);
}

[data-theme="light"] .glass-input::placeholder {
    color: var(--text-secondary);
}

.input-group-lg {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.input-group-lg .form-control {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 10px 14px;
    font-size: 0.95rem;
}

.input-group-lg .btn {
    flex-shrink: 0;
    height: 44px;
    padding: 0 16px;
    min-width: 44px;
}

/* ==============================================
   Mobile Responsive
   ============================================== */

@media (max-width: 992px) {
    .chat-wrapper {
        grid-template-columns: 1fr;
        height: 100vh;
        padding: 0;
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
        border-right: 1px solid var(--border-color);
        transition: left 0.3s ease;
    }
    
    .chat-sidebar.show {
        left: 0;
    }
    
    .chat-main {
        width: 100%;
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block !important;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 999;
        background: var(--neon-blue);
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }

    .chat-preview-container {
        height: 300px;
        margin-top: 20px;
    }

    .message-content {
        max-width: 85%;
    }

    .row {
        flex-direction: column;
    }

    .col-lg-6 {
        width: 100%;
        margin-bottom: 30px;
    }

    .stat-card {
        padding: 20px;
    }

    .chat-bubble {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 14px;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .hero-text-container {
        padding: 10px;
    }

    .chat-status-bar {
        padding: 10px 60px 10px 15px;
    }

    .messages-container {
        padding: 10px;
        height: calc(100vh - 180px);
    }

    .message-input-area {
        padding: 12px;
    }
    
    .input-group-lg {
        flex-wrap: nowrap;
    }
    
    .input-group-lg .form-control {
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    
    .input-group-lg .btn {
        flex: 1;
        min-width: 48px;
        height: 48px;
    }

    .message-content {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 15px;
    }

    .user-info-card {
        padding: 12px;
        gap: 10px;
    }

    .sidebar-header {
        font-size: 0.9rem;
    }

    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .message-bubble {
        margin-bottom: 8px;
    }

    .input-group-lg .form-control,
    .input-group-lg .btn {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .modal-dialog {
        margin: 10px;
    }

    small kbd {
        font-size: 0.7rem;
    }
}

/* ==============================================
   Dark Mode - Additional Enhancements
   ============================================== */

.navbar-dark {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .navbar-dark {
    background-color: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .navbar-dark .navbar-brand,
[data-theme="light"] .navbar-dark .navbar-brand i {
    color: var(--text-primary) !important;
}

[data-theme="light"] .bg-dark {
    background-color: rgba(255, 255, 255, 0.65) !important;
}

[data-theme="light"] .text-muted {
    color: var(--text-secondary) !important;
}

.navbar-brand {
    font-size: 1.3rem;
    transition: var(--transition-smooth);
}

.navbar-brand:hover {
    color: var(--neon-blue) !important;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

footer {
    border-top: 1px solid var(--border-color);
}

/* Form Validation */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.05);
}

.invalid-feedback {
    color: #fca5a5;
}

.valid-feedback {
    color: #86efac;
}

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: 1px solid;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #86efac;
}

.alert-info {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--neon-blue);
}

/* Badge Styles */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge-primary {
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--accent-blue) 100%);
    color: #000;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #86efac;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

/* ==============================================
   Print Styles
   ============================================== */

@media print {
    body {
        background: white;
    }

    .chat-sidebar,
    .chat-status-bar,
    .message-input-area,
    .btn,
    footer {
        display: none;
    }

    .messages-container {
        background: white;
        color: black;
        border: none;
    }
}

/* ==============================================
   High Contrast Mode Support
   ============================================== */

@media (prefers-contrast: more) {
    :root {
        --neon-blue: #00ffff;
        --neon-pink: #ff00ff;
        --border-color: rgba(0, 255, 255, 0.2);
    }
}

/* ==============================================
   Reduced Motion Support
   ============================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* ==============================================
   Language Switcher
   ============================================== */

.language-switcher {
    display: flex;
    gap: 8px;
}

.language-switcher .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 6px 12px;
}

/* ==============================================
   Emoji Picker
   ============================================== */

.emoji-picker {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 280px;
    max-height: 300px;
    padding: 15px;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.emoji-item {
    font-size: 1.8rem;
    cursor: pointer;
    padding: 8px;
    text-align: center;
    border-radius: 8px;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.05);
}

.emoji-item:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: scale(1.2);
}

/* ==============================================
   Improved Chat Messages
   ============================================== */

.message.sent {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.1));
    border-left: 3px solid var(--neon-purple);
    animation: slideInRight 0.3s ease-out;
}

.message.received {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 212, 255, 0.1));
    border-left: 3px solid var(--neon-blue);
    animation: slideInLeft 0.3s ease-out;
}

.message-sender {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    opacity: 0.9;
}

.message.sent .message-sender {
    color: var(--neon-purple);
}

.message.received .message-sender {
    color: var(--neon-blue);
}

.message-text {
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* ==============================================
   Better Status Indicators
   ============================================== */

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-indicator.online::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #10b981;
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.status-indicator.offline {
    background: #6b7280;
}

.status-indicator.searching {
    background: #f59e0b;
    animation: pulse 2s ease-in-out infinite;
}

/* ==============================================
   Enhanced Buttons
   ============================================== */

.btn-neon {
    position: relative;
    overflow: hidden;
}

.btn-neon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-neon:hover::before {
    width: 300px;
    height: 300px;
}

/* ==============================================
   Sidebar Improvements
   ============================================== */

.user-info-card {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.user-info-card:hover {
    background: rgba(0, 212, 255, 0.05);
    transform: translateX(5px);
}

.user-avatar {
    font-size: 2.5rem;
    color: var(--neon-blue);
}

.user-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s ease-in-out infinite;
}

/* ==============================================
   Stats Container
   ============================================== */

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    padding: 15px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 10px;
    text-align: center;
    transition: var(--transition-smooth);
}

.stat-item:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--neon-blue);
    transform: translateY(-3px);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-blue);
    margin: 0;
}

/* ==============================================
   Desktop/Laptop Optimizations (1200px+)
   ============================================== */

@media (min-width: 1200px) {
    .chat-wrapper {
        grid-template-columns: 350px 1fr;
        gap: 0;
        padding: 0;
    }
    
    .chat-sidebar {
        width: 350px;
        height: 100vh;
    }
    
    .chat-main {
        height: 100vh;
        overflow: hidden;
    }
    
    .messages-container {
        padding: 30px;
        min-height: 0;
    }
    
    .message-content {
        max-width: 600px;
        font-size: 16px;
    }
}

/* ==============================================
   Mobile Optimizations - Tablet (992px-768px)
   ============================================== */

@media (max-width: 992px) {
    :root {
        --font-size-base: 15px;
    }

    .chat-wrapper {
        grid-template-columns: 1fr;
        height: 100vh;
        padding: 8px;
        gap: 8px;
    }

    .chat-sidebar {
        width: 100%;
        height: auto;
        max-height: 25vh;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 12px;
    }

    .chat-main {
        height: calc(100vh - 25vh - 40px);
    }

    .messages-container {
        padding: 12px;
    }

    .message-content {
        max-width: 80%;
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .message-sender {
        font-size: 0.8rem;
    }

    .message-time {
        font-size: 0.75rem;
    }

    .user-info-card {
        padding: 10px;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .quick-actions .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .input-group-lg .form-control,
    .input-group-lg .btn {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* ==============================================
   Mobile Optimizations - Phone (768px-480px)
   ============================================== */

@media (max-width: 768px) {
    :root {
        --font-size-base: 14px;
    }

    .chat-wrapper {
        grid-template-columns: 1fr;
        height: 100vh;
        padding: 6px;
        gap: 6px;
    }

    .chat-sidebar {
        max-height: 30vh;
        padding: 10px;
    }

    .chat-main {
        height: calc(100vh - 30vh - 30px);
    }

    .messages-container {
        padding: 10px;
    }

    .message-content {
        max-width: 85%;
        padding: 8px 10px;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .message-bubble {
        margin-bottom: 8px;
    }

    .message-sender {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }

    .message-time {
        font-size: 0.7rem;
        margin-top: 3px;
    }

    .user-name {
        font-size: 0.95rem;
    }

    .user-status {
        font-size: 0.75rem;
    }

    .quick-actions .btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .input-group-lg .form-control,
    .input-group-lg .btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .emoji-picker {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .language-switcher {
        flex-direction: row;
    }
}

/* ==============================================
   Mobile Optimizations - Small Phone (<480px)
   ============================================== */

@media (max-width: 480px) {
    :root {
        --font-size-base: 13px;
    }

    .chat-wrapper {
        height: 100vh;
        padding: 4px;
        gap: 4px;
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        max-height: 35vh;
        padding: 8px;
        overflow-y: auto;
    }

    .chat-main {
        height: calc(100vh - 35vh - 25px);
        padding: 0;
    }

    .messages-container {
        padding: 8px;
        gap: 6px;
    }

    .message-content {
        max-width: 90%;
        padding: 6px 8px;
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .message-bubble {
        margin-bottom: 6px;
    }

    .message-sender {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .message-time {
        font-size: 0.65rem;
        margin-top: 2px;
    }

    .message-bubble.own-message .message-content {
        max-width: 85%;
    }

    .message-bubble.other-message .message-content {
        max-width: 85%;
    }

    .user-info-card {
        padding: 8px;
        gap: 8px;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .user-name {
        font-size: 0.9rem;
        word-break: break-word;
    }

    .user-status {
        font-size: 0.7rem;
    }

    .quick-actions {
        gap: 6px;
    }

    .quick-actions .btn {
        padding: 6px 8px;
        font-size: 0.7rem;
        flex: 1;
    }

    .stat-item {
        padding: 8px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .message-input-area {
        padding: 8px;
        gap: 6px;
    }

    .input-group-lg .form-control {
        padding: 6px 8px;
        font-size: 0.8rem;
        height: auto;
        min-height: 36px;
    }

    .input-group-lg .btn {
        padding: 6px 8px;
        font-size: 0.8rem;
        height: 36px;
    }

    .chat-status-bar {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .connection-status {
        font-size: 0.75rem;
    }

    .empty-state-content {
        padding: 20px;
    }

    .empty-state-content i {
        font-size: 2rem;
    }

    .empty-state-content h4 {
        font-size: 1rem;
        margin-top: 10px;
    }

    .empty-state-content p {
        font-size: 0.85rem;
    }

    .language-switcher {
        gap: 4px;
    }

    .language-switcher .btn {
        padding: 4px 6px;
        font-size: 0.7rem;
    }

    .emoji-picker {
        right: 5px;
        bottom: 50px;
        left: 5px;
        width: auto;
        max-width: calc(100vw - 10px);
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
    }

    .emoji-item {
        font-size: 1.5rem;
        padding: 6px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
}