/* ==========================================================================
   ChronoChat - Ephemeral Real-Time Chat CSS
   Theme: Futuristic Dark Glassmorphism with Neon Accents & Bangla Font Rules
   ========================================================================== */

:root {
    --bg-main: #0B0E14;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(26, 35, 55, 0.85);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --accent: #06B6D4;
    --accent-glow: rgba(6, 182, 212, 0.4);
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;

    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --bubble-self: linear-gradient(135deg, #4F46E5 0%, #3B82F6 100%);
    --bubble-other: rgba(30, 41, 59, 0.85);
    
    --font-main: 'Inter', 'Hind Siliguri', 'Noto Sans Bengali', sans-serif;
    --font-heading: 'Outfit', 'Hind Siliguri', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    max-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Glowing Orbs */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

.bg-glow-1 {
    width: 450px;
    height: 450px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation: floatOrb 12s infinite alternate ease-in-out;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation: floatOrb 15s infinite alternate-reverse ease-in-out;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.15); }
}

/* App Container */
#app-container {
    width: 100%;
    max-width: 1000px;
    height: 92vh;
    padding: 12px;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Glassmorphism Panel Helper */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.view-section {
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.view-section.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ================= AUTH / LANDING CARD ================= */
.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 32px 28px;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid var(--border-glow);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.logo-icon i {
    font-size: 30px;
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
}

.brand-header h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #FFF 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Tabs */
.auth-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-glass);
}

.tab-btn {
    flex: 1;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Forms */
.auth-form {
    display: none;
    text-align: left;
}

.auth-form.active {
    display: block;
}

.input-group {
    margin-bottom: 16px;
}

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

.input-group label i {
    margin-right: 4px;
    color: var(--accent);
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-with-action {
    display: flex;
    gap: 8px;
}

.input-with-action input {
    flex: 1;
}

.btn-input-action {
    padding: 0 14px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-input-action:hover {
    background: var(--primary);
    color: #FFF;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #FFF;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.btn-accent:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.auth-footer-notice {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: left;
}

.auth-footer-notice i {
    color: var(--warning);
    font-size: 14px;
}


/* ================= CHAT ROOM VIEW ================= */
.chat-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.room-details h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.room-subtext {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-code {
    background: rgba(99, 102, 241, 0.2);
    color: #A5B4FC;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-timer {
    background: rgba(245, 158, 11, 0.15);
    color: #FCD34D;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--primary);
    color: #FFF;
    border-color: var(--primary);
}

.icon-btn.btn-danger:hover {
    background: var(--danger);
    color: #FFF;
    border-color: var(--danger);
}

/* Chat Feed */
.chat-feed {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-feed::-webkit-scrollbar {
    width: 6px;
}
.chat-feed::-webkit-scrollbar-track {
    background: transparent;
}
.chat-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.chat-feed::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.feed-placeholder {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 48px;
    color: var(--border-glow);
    margin-bottom: 12px;
}

.sub-placeholder {
    display: block;
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.7;
}

/* Chat Bubbles */
.chat-bubble-row {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    animation: popIn 0.3s ease-out;
    position: relative;
    transition: all 0.5s ease-out;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.95) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Expiry Fade Keyframe */
.chat-bubble-row.expiring-out {
    opacity: 0;
    transform: scale(0.9);
    filter: blur(4px);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.chat-bubble-row.self {
    align-self: flex-end;
}

.chat-bubble-row.other {
    align-self: flex-start;
}

.chat-bubble-row.system {
    align-self: center;
    max-width: 90%;
    margin: 8px 0;
}

.system-message-card {
    background: rgba(99, 102, 241, 0.1);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: #A5B4FC;
    text-align: center;
}

.bubble-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11.5px;
    padding: 0 4px;
}

.sender-name {
    font-weight: 600;
    color: var(--accent);
}

.msg-time {
    color: var(--text-muted);
    font-size: 10.5px;
}

.timer-countdown {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.bubble-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.self .bubble-content {
    background: var(--bubble-self);
    color: #FFF;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.other .bubble-content {
    background: var(--bubble-other);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    border-bottom-left-radius: 4px;
}

/* Media Elements inside Chat Bubbles */
.chat-media-attachment {
    margin-top: 6px;
    border-radius: 10px;
    overflow: hidden;
    max-width: 320px;
}

.chat-media-attachment img {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
}

.chat-media-attachment img:hover {
    transform: scale(1.02);
}

.chat-media-attachment video {
    width: 100%;
    max-height: 260px;
    border-radius: 10px;
    background: #000;
    outline: none;
}

.chat-media-attachment audio {
    width: 100%;
    min-width: 240px;
    margin-top: 4px;
    border-radius: 30px;
}

/* Media Preview Drawer */
.media-preview-drawer {
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.preview-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

#preview-render-element img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

#preview-render-element video, #preview-render-element audio {
    max-width: 100px;
    max-height: 48px;
}

.preview-meta {
    display: flex;
    flex-direction: column;
    font-size: 12px;
}

#preview-filename {
    font-weight: 500;
    color: var(--text-primary);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#preview-filesize {
    color: var(--text-muted);
    font-size: 11px;
}

.btn-close-preview {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: var(--danger);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Input Bar */
.chat-input-bar {
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid var(--border-glass);
    position: relative;
}

.chat-input-bar form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-upload-btn input {
    display: none;
}

.action-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(30, 41, 59, 0.7);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--primary);
    color: #FFF;
}

.textarea-wrapper {
    flex: 1;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
}

.textarea-wrapper textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14.5px;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
}

.textarea-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #FFF;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* Emoji Picker Popup */
.emoji-picker-popup {
    position: absolute;
    bottom: 75px;
    left: 18px;
    background: rgba(18, 24, 38, 0.95);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    z-index: 10;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.emoji-grid span {
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    text-align: center;
    transition: background 0.15s ease;
}

.emoji-grid span:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

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

.modal-header h3 {
    font-size: 17px;
    color: var(--text-primary);
}

.btn-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.share-info-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.share-field {
    margin-bottom: 14px;
}

.share-field label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.share-copy-row {
    display: flex;
    gap: 8px;
}

.share-copy-row input {
    flex: 1;
    padding: 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--accent);
    font-family: monospace;
    font-size: 13px;
}

.btn-copy {
    padding: 0 14px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #FFF;
    font-size: 13px;
    cursor: pointer;
}

/* Lightbox Modal */
.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.lightbox-content img, .lightbox-content video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.btn-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #FFF;
    font-size: 22px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 18px;
    background: rgba(18, 24, 38, 0.95);
    border: 1px solid var(--border-glow);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 13.5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* Responsive adjustments */
@media (max-width: 600px) {
    #app-container {
        padding: 0;
        height: 100vh;
    }
    .glass-panel {
        border-radius: 0;
    }
    .chat-bubble-row {
        max-width: 88%;
    }
}

/* Quick Join Banner & Direct Invite Link Styling */
.quick-join-banner {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid var(--accent);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
}

.quick-join-banner i {
    font-size: 18px;
    color: #F59E0B;
    flex-shrink: 0;
}

.btn-copy-accent {
    background: var(--accent) !important;
    color: #0B0E14 !important;
    font-weight: 600;
}

.btn-copy-accent:hover {
    background: #22d3ee !important;
}

.text-accent {
    color: var(--accent);
}

.share-hint {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.3;
}
