/* ═══════════════════════════════════════════
   UNION OF ARAB CLANS — GLASSMORPHISM THEME
   Dark Gold Design System v2.0
   ═══════════════════════════════════════════ */
:root {
    /* Core Colors */
    --bg-color: #07090f;
    --container-bg: rgba(12, 16, 26, 0.95);
    --header-bg: rgba(10, 14, 22, 0.85);
    --text-color: #ede8d8;
    --text-secondary: #8a8070;
    --border-color: rgba(212, 175, 55, 0.15);
    --input-bg: rgba(255, 255, 255, 0.06);
    --chat-bg: #070b14;
    --sidebar-bg: rgba(10, 14, 22, 0.9);

    /* Gold Palette */
    --primary-color: #D4AF37;
    --primary-hover: #f0d060;
    --primary-dark: #8C6222;
    --gold-glow: rgba(212, 175, 55, 0.35);
    --gold-subtle: rgba(212, 175, 55, 0.10);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-blur: blur(18px);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

/* Dynamic Logo Background Removed */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(212, 175, 55, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 80%, rgba(140, 98, 34, 0.05) 0%, transparent 50%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}

/* Admin page — full width, no flex centering */
/* =========================================================
   GLOBAL TOUCH & Z-INDEX FIX 
   Guarantees the main containers are not blocked by pseudo-elements
   ========================================================= */
#app-container, .admin-container, #auth-container {
    pointer-events: auto !important;
    z-index: 100 !important;
}
body::before, body::after, #splash-screen {
    pointer-events: none !important;
}

body.admin-body {
    display: block;
    overflow-y: auto;
}

/* Chat page — full width, no flex centering */
body.chat-body {
    display: block;
    overflow: hidden;
    background-image:
        radial-gradient(ellipse at 20% 10%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(140, 98, 34, 0.04) 0%, transparent 45%);
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--container-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.logo-container {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    animation: zoomBounce 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.splash-title {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
    opacity: 0;
    animation: slideUpFade 1s ease forwards;
    animation-delay: 0.4s;
}

@keyframes zoomBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideUpFade {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ── Auth / Login Container ── */
#auth-container {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(212, 175, 55, 0.22);
    border-radius: 24px;
    box-shadow: var(--glass-shadow), 0 0 0 1px rgba(212, 175, 55, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    padding: 2.2rem 2rem;
    text-align: center;
    width: 90%;
    max-width: 420px;
    margin: auto;
    animation: fadeInScale 0.4s ease-out;
}

#auth-container h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.4rem;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    margin-top: 15px;
    gap: 10px;
}

#country-code {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

#auth-container input[type="tel"],
#auth-container input[type="text"] {
    flex: 1;
    border: none;
    font-size: 16px;
    direction: ltr;
    text-align: right;
    background-color: transparent;
    color: var(--text-color);
    width: 100%;
    min-width: 0;
    outline: none;
}

#auth-container button {
    width: 100%;
    margin-top: 20px;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #0a0a0a;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 18px var(--gold-glow);
    transition: all 0.25s ease;
}

#auth-container button:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
    box-shadow: 0 6px 24px rgba(212, 175, 55, 0.55);
    transform: translateY(-1px);
}

#auth-container button:active {
    transform: translateY(0);
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 15px;
    line-height: 1.5;
}

#recaptcha-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

/* ── App Container ── */
#app-container {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Dynamic viewport height */
    max-height: 100dvh;
    background: var(--container-bg);
    box-shadow: -4px 0 40px rgba(0, 0, 0, 0.6), 4px 0 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 175, 55, 0.08);
    position: relative;
    overflow: hidden;
    /* Main container hides overflow, inner views will scroll */
    display: flex;
    flex-direction: column;
}

/* Base View adjustments for mobile scrolling */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--container-bg);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
    overflow-y: auto;
    /* Allow views to scroll if content is too long */
    overflow-x: hidden;
}

.view.active {
    transform: translateX(0);
}

/* ── App Header — Glassmorphism ── */
.app-header {
    background: var(--header-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(212, 175, 55, 0.18);
    color: var(--text-color);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: rgba(212, 175, 55, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
    color: var(--primary-color);
    background: rgba(212, 175, 55, 0.10);
}

/* Three Dots Menu */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background-color: var(--glass-bg);

    /* From Uiverse.io by alexruix */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 250px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeInScale 0.2s ease-out forwards;
    transform-origin: top left;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dropdown-menu ul {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.dropdown-menu li {
    padding: 14px 20px;
    font-size: 15px;
    color: var(--text-color);
    cursor: pointer;
    text-align: right;
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-menu li:hover {
    background-color: rgba(212, 175, 55, 0.15);
    /* Gold hover tint */
    color: var(--primary-color);
}

/* Chat Header Specific */
.chat-header {
    justify-content: flex-start;
    gap: 15px;
    padding: 10px 15px;
}

.chat-title-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.header-profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
    padding: 2px;
}

/* ── Chats & Contacts Area ── */
.content-area {
    flex: 1;
    overflow-y: auto;
    background: transparent;
}

#groups,
#contacts-list {
    list-style: none;
}

#groups li,
#contacts-list li {
    display: flex;
    padding: 10px 14px;
    cursor: pointer;
    align-items: center;
    gap: 13px;
    margin: 5px 10px;
    border-radius: 16px;
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

#groups li:hover,
#contacts-list li:hover {
    background: rgba(212, 175, 55, 0.07);
    border-color: rgba(212, 175, 55, 0.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.chat-card-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(212, 175, 55, 0.25);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.05);
}

.chat-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
}

.chat-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-card-time {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.chat-card-msg-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-card-msg {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.chat-card-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #0a0a0a;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px var(--gold-glow);
    flex-shrink: 0;
}

/* ── Floating Action Button ── */
.fab {
    position: absolute;
    bottom: 85px;
    right: 20px;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #111;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    box-shadow: 0 4px 20px var(--gold-glow), 0 0 0 1px rgba(212, 175, 55, 0.2);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.fab:hover {
    transform: scale(1.12) rotate(8deg);
    box-shadow: 0 8px 28px rgba(212, 175, 55, 0.65);
}

/* ── Bottom Navigation — Floating Glass ── */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    background: rgba(6, 9, 16, 0.88);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    padding: 10px 8px 18px;
    z-index: 10;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
    gap: 3px;
    flex: 1;
    transition: color 0.25s;
}

.nav-item .icon-container {
    position: relative;
    padding: 6px 18px;
    border-radius: 20px;
    transition: background-color 0.25s, box-shadow 0.25s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-item.active .icon-container {
    background: rgba(212, 175, 55, 0.18);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active .nav-text {
    font-weight: 600;
}

.nav-item:hover:not(.active) {
    color: rgba(212, 175, 55, 0.6);
}

.nav-item .icon {
    font-size: 22px;
}

.nav-item .nav-text {
    font-size: 11px;
    font-weight: 500;
}

.badge {
    position: absolute;
    top: -3px;
    right: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #0a0a0a;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 4px;
    border: 2px solid var(--bg-color);
    box-shadow: 0 2px 6px var(--gold-glow);
}

/* ── Chat Background ── */
.chat-bg {
    background-color: var(--chat-bg);
    background-image:
        radial-gradient(ellipse at 15% 25%, rgba(212, 175, 55, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 75%, rgba(140, 98, 34, 0.03) 0%, transparent 45%);
}

#messages-container {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Input Area ── */
#chat-input-area {
    padding: 8px 12px 12px;
    background: rgba(6, 9, 16, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(212, 175, 55, 0.12);
    display: flex;
    align-items: center;
    gap: 8px;
}

#chat-input-area .icon-btn {
    color: rgba(212, 175, 55, 0.7);
    font-size: 22px;
}

.input-pill {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 26px;
    padding: 4px 14px;
    min-height: 46px;
    gap: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-pill:focus-within {
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

#message-input {
    flex: 1;
    padding: 8px 6px;
    border: none;
    background: transparent;
    color: var(--text-color);
    outline: none;
    font-size: 15px;
    font-family: inherit;
}

#message-input::placeholder {
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════
   DISCORD-STYLE MESSAGE LAYOUT
   ══════════════════════════════════════════════════════ */

/* Remove old bubble wrapper classes */
.msg-wrapper {
    display: flex;
    flex-direction: row-reverse;
    /* RTL: avatar on right */
    align-items: flex-start;
    gap: 12px;
    padding: 6px 16px;
    transition: background 0.15s;
    position: relative;
}

.msg-wrapper:hover {
    background: rgba(255, 255, 255, 0.025);
    border-radius: 6px;
}



/* ── Avatar Column ── */
.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(212, 175, 55, 0.15);
    border: 1.5px solid rgba(212, 175, 55, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-color);
    overflow: hidden;
    margin-top: 1px;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ── Message Body (right-side block) ── */
.msg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: right;
    min-width: 0;
}

/* ── Header: username + timestamp ── */
.msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.msg-sender-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Sent user name — lighter gold */
.msg-wrapper.is-mine .msg-sender-name {
    color: #f0d060;
}

.msg-time {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── Content area (same for all types) ── */
.message {
    background: transparent;
    /* no bubble */
    color: var(--text-color);
    font-size: 14.5px;
    line-height: 1.55;
    word-break: break-word;
    animation: msgIn 0.2s ease-out;
    max-width: 100%;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Text Messages ── */
.msg-text {
    display: block;
    color: #e8e2d0;
    line-height: 1.55;
}

/* ── Images ── */
.msg-image {
    max-width: min(320px, 72vw);
    max-height: 260px;
    width: auto;
    height: auto;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
    object-fit: cover;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Videos ── */
.msg-video {
    max-width: min(320px, 72vw);
    max-height: 220px;
    width: auto;
    border-radius: 8px;
    display: block;
    background: #000;
    margin-top: 4px;
}

/* ── Deleted ── */
.msg-deleted {
    font-style: italic;
    opacity: 0.4;
    font-size: 13px;
}

/* ── Ticks: always inline after time ── */
.msg-status {
    font-size: 13px;
    line-height: 1;
    margin-right: 2px;
}

.msg-info {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ══════════════════════════════════
   CUSTOM AUDIO PLAYER (Waveform)
   ══════════════════════════════════ */
.audio-player {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(212, 175, 55, 0.07);
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 22px;
    padding: 8px 14px;
    max-width: 280px;
    margin-top: 4px;
    transition: background 0.2s;
}

.audio-player:hover {
    background: rgba(212, 175, 55, 0.12);
}

.audio-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #8C6222);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
}

.audio-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.55);
}

.audio-play-btn svg {
    pointer-events: none;
}

/* Waveform bars */
.waveform {
    display: flex;
    align-items: center;
    gap: 2.5px;
    height: 28px;
    flex: 1;
    cursor: pointer;
}

.waveform-bar {
    flex: 1;
    border-radius: 2px;
    background: rgba(212, 175, 55, 0.35);
    transition: background 0.2s;
    min-width: 2.5px;
}

.waveform-bar.played {
    background: rgba(212, 175, 55, 0.85);
}

.waveform-bar.active {
    animation: barPulse 0.5s ease-in-out infinite alternate;
}

@keyframes barPulse {
    from {
        opacity: 0.5;
    }

    to {
        opacity: 1;
        transform: scaleY(1.15);
    }
}

.audio-timer {
    font-size: 11px;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    min-width: 30px;
    text-align: left;
}

/* ══════════════════════════════════
   DELETE CONTEXT MENU
   ══════════════════════════════════ */
.msg-delete-menu {
    position: absolute;
    z-index: 9999;
    background: #0d111c;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 175, 55, 0.08);
    backdrop-filter: blur(12px);
    left: 0;
    top: calc(100% + 6px);
    animation: menuIn 0.15s ease-out;
}

@keyframes menuIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.del-btn {
    display: block;
    width: 100%;
    text-align: right;
    background: none;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13.5px;
    transition: background 0.15s;
}

.del-danger {
    color: #ff5f5f;
}

.del-danger:hover {
    background: rgba(255, 77, 77, 0.14);
}

.del-muted {
    color: rgba(255, 255, 255, 0.5);
}

.del-muted:hover {
    background: rgba(255, 255, 255, 0.07);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.25);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}


/* ========================================= */
/* OTP VERIFICATION 6-DIGITS CSS BY USER */
/* ========================================= */
.password {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    direction: ltr;
    /* Ensure numbers flow left-to-right visually */
}

.password input {
    width: 35px;
    height: 45px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-bottom: solid 2px #D4AF37;
    /* Gold */
    font-size: 20px;
    color: white;
    outline: none;
    transition: 0.3s;
    border-radius: 4px;
}

.password input:focus {
    border-bottom: solid 2px #FFF;
    transform: translateY(-2px);
}



/* ========================================= */
/* ADMIN LOGIN FORM (used in index.html)     */
/* ========================================= */
.admin-form-container {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    margin: auto;
    width: 100%;
    max-width: 400px;
    padding: 20px 0;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1em;
}

.input-container {
    filter: drop-shadow(46px 36px 24px #D4AF37) drop-shadow(-55px -40px 25px #8C6222);
    animation: blinkShadowsFilter 8s ease-in infinite;
}

.input-content {
    display: grid;
    align-content: center;
    justify-items: center;
    align-items: center;
    text-align: center;
    padding-inline: 1em;
    position: relative;
}

.input-content::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    filter: blur(40px);
    -webkit-clip-path: polygon(26% 0, 66% 0, 92% 0, 100% 8%, 100% 89%, 91% 100%, 7% 100%, 0 92%, 0 0);
    clip-path: polygon(26% 0, 66% 0, 92% 0, 100% 8%, 100% 89%, 91% 100%, 7% 100%, 0 92%, 0 0);
    background: rgba(212, 175, 55, 0.55);
    transition: all 1s ease-in-out;
}

.input-content::after {
    content: "";
    position: absolute;
    width: 98%;
    height: 98%;
    box-shadow: inset 0px 0px 20px 20px #212121;
    background: repeating-linear-gradient(to bottom, transparent 0%, rgba(212, 175, 55, 0.6) 1px, rgb(0, 0, 0) 3px, hsl(43, 60%, 12%) 5px, #443515 4px, transparent 0.5%), repeating-linear-gradient(to left, hsl(43, 60%, 12%) 100%, hsla(43, 60%, 12%, 0.99) 100%);
    -webkit-clip-path: polygon(26% 0, 31% 5%, 61% 5%, 66% 0, 92% 0, 100% 8%, 100% 89%, 91% 100%, 7% 100%, 0 92%, 0 0);
    clip-path: polygon(26% 0, 31% 5%, 61% 5%, 66% 0, 92% 0, 100% 8%, 100% 89%, 91% 100%, 7% 100%, 0 92%, 0 0);
    animation: backglitch 50ms linear infinite;
}

.input-dist {
    z-index: 80;
    display: grid;
    align-items: center;
    text-align: center;
    width: 100%;
    padding-inline: 1em;
    padding-block: 1.2em;
    grid-template-columns: 1fr;
}

.input-type {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    gap: 1em;
    font-size: 1.1rem;
    background-color: transparent;
    width: 100%;
    border: none;
}

.input-is {
    color: #fff;
    font-size: 0.9rem;
    background-color: transparent;
    width: 100%;
    box-sizing: border-box;
    padding-inline: 0.5em;
    padding-block: 0.7em;
    border: none;
    transition: all 1s ease-in-out;
    border-bottom: 1px solid hsl(43, 26%, 43%);
    outline: none;
}

.input-is:hover {
    background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.2) 27%, rgba(212, 175, 55, 0.2) 63%, transparent 100%);
}

.input-is:-webkit-autofill,
.input-is:-webkit-autofill:hover,
.input-is:-webkit-autofill:focus,
.input-is:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1e252b inset !important;
    -webkit-text-fill-color: #fff !important;
}

.input-is:focus {
    border-bottom: 1px solid hsl(43, 100%, 50%);
    color: hsl(43, 100%, 70%);
    background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.2) 27%, rgba(212, 175, 55, 0.2) 63%, transparent 100%);
}

.input-is::placeholder {
    color: hsla(43, 100%, 70%, 0.806);
}

.input-content:focus-within::before {
    background: hsla(0, 0%, 100%, 0.814);
}

.submit-button {
    width: 50%;
    border: none;
    color: hsla(43, 100%, 70%, 0.806);
    background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.2) 27%, rgba(212, 175, 55, 0.2) 63%, transparent 100%);
    clip-path: polygon(0 0, 85% 0%, 100% 0, 100% 15%, 100% 90%, 91% 100%, 0 100%);
    padding: 0.5em;
    animation: blinkShadowsFilter 0.5s ease-in infinite;
    transition: all 500ms;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}

.submit-button:hover {
    color: hsl(0, 0%, 100%);
    font-size: medium;
    font-weight: bold;
}

@keyframes backglitch {
    0% {
        box-shadow: inset 0px 20px 20px 30px #212121;
    }

    50% {
        box-shadow: inset 0px -20px 20px 30px hsl(43, 42%, 10%);
    }

    100% {
        box-shadow: inset 0px 20px 20px 30px #212121;
    }
}

@keyframes blinkShadowsFilter {
    0% {
        filter: drop-shadow(46px 36px 28px rgba(212, 175, 55, 0.34)) drop-shadow(-55px -40px 28px #8C6222);
    }

    25% {
        filter: drop-shadow(46px -36px 24px rgba(212, 175, 55, 0.89)) drop-shadow(-55px 40px 24px #8C6222);
    }

    50% {
        filter: drop-shadow(46px 36px 30px rgba(212, 175, 55, 0.89)) drop-shadow(-55px 40px 30px rgba(140, 98, 34, 0.29));
    }

    75% {
        filter: drop-shadow(20px -18px 25px rgba(212, 175, 55, 0.89)) drop-shadow(-20px 20px 25px rgba(140, 98, 34, 0.29));
    }

    100% {
        filter: drop-shadow(46px 36px 28px rgba(212, 175, 55, 0.34)) drop-shadow(-55px -40px 28px #8C6222);
    }
}

/* ── Feature 3: Gold Glowing Upload Button ── */
.input-div {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.45), inset 0 0 6px rgba(212, 175, 55, 0.2);
    animation: goldFlicker 3s ease-in-out infinite;
    flex-shrink: 0;
    cursor: pointer;
    background: rgba(212, 175, 55, 0.06);
}

.input-div .icon {
    color: var(--primary-color);
    animation: goldIconFlicker 3s ease-in-out infinite;
    pointer-events: none;
}

.input-div .input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer !important;
}

@keyframes goldFlicker {

    0%,
    100% {
        border-color: rgba(212, 175, 55, 0.8);
        box-shadow: 0 0 12px rgba(212, 175, 55, 0.5), inset 0 0 6px rgba(212, 175, 55, 0.2);
    }

    40% {
        border-color: rgba(212, 175, 55, 0.3);
        box-shadow: 0 0 4px rgba(212, 175, 55, 0.2);
    }

    60% {
        border-color: rgba(212, 175, 55, 0.9);
        box-shadow: 0 0 18px rgba(212, 175, 55, 0.7), inset 0 0 8px rgba(212, 175, 55, 0.3);
    }
}

@keyframes goldIconFlicker {

    0%,
    60%,
    100% {
        opacity: 1;
    }

    40% {
        opacity: 0.5;
    }
}


.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #0a0a0a;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 3px 14px var(--gold-glow);
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.6);
    transform: scale(1.06);
}

.send-btn:active {
    transform: scale(0.94);
}

/* ── Theme Toggle Switch — Gold ── */
.switch {
    font-size: 15px;
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 3.2em;
    height: 1.8em;
    cursor: pointer;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.06);
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.2em;
    width: 1.2em;
    left: 0.2em;
    bottom: 0.16em;
    background: var(--text-secondary);
    border-radius: inherit;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.switch input:checked+.slider {
    border-color: rgba(212, 175, 55, 0.7);
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.switch input:checked+.slider:before {
    transform: translateX(1.4em);
    background: var(--primary-color);
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 3-Tier: Phone / iPad / PC
   ══════════════════════════════════════════════════════ */

/* ── Phone (< 768px) ── */
@media (max-width: 767px) {
    #app-container {
        max-width: 100%;
        height: 100dvh;
    }

    .message {
        max-width: 85%;
        font-size: 14px;
    }

    .msg-image {
        max-width: min(240px, 70vw);
        max-height: 200px;
    }

    #chat-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* ── iPad / Tablet (768px – 1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    body {
        align-items: center;
        justify-content: center;
        background:
            radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.08) 0%, #0b1014 60%);
    }

    #app-container {
        max-width: 580px;
        width: 580px;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 175, 55, 0.12);
    }

    #auth-container {
        max-width: 500px;
        margin: auto;
    }

    #back-btn,
    .bottom-nav {
        display: none !important;
    }

    /* 2-panel layout on tablet: sticky sidebar */
    #main-view {
        width: 38% !important;
        border-left: 1px solid var(--border-color);
        display: flex !important;
        transform: none !important;
        position: relative !important;
    }

    #chat-view {
        width: 62% !important;
        display: flex !important;
        transform: none !important;
        position: relative !important;
    }

    .message {
        max-width: 70%;
        font-size: 14.5px;
    }

    .msg-image {
        max-width: 280px;
        max-height: 240px;
    }
}

/* ── PC / Laptop (1024px+) ── */
@media (min-width: 1024px) {

    /* Login/splash pages — scrollable on PC */
    body {
        background:
            radial-gradient(ellipse at 20% 50%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(140, 98, 34, 0.05) 0%, transparent 50%),
            linear-gradient(135deg, #080d10 0%, #0b1014 40%, #0b0f1a 100%);
        align-items: center;
        justify-content: center;
        overflow-x: hidden;
        overflow-y: auto;
        /* allow scroll on login/register pages */
        min-height: 100vh;
    }

    /* Chat page — keep locked (no background scroll) */
    body.chat-body {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }

    /* Subtle grid backdrop */
    body::before {
        content: '';
        position: fixed;
        inset: 0;
        background-image:
            repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.012) 0px, rgba(212, 175, 55, 0.012) 1px, transparent 1px, transparent 60px),
            repeating-linear-gradient(-45deg, rgba(212, 175, 55, 0.012) 0px, rgba(212, 175, 55, 0.012) 1px, transparent 1px, transparent 60px);
        pointer-events: none;
        z-index: 0;
    }

    /* Splash screen — base CSS already handles full-screen (position:fixed, width:100%) */
    /* No PC override needed */

    /* Auth / login box — centered nicely on PC dark background */
    #auth-container {
        position: relative;
        z-index: 1;
        max-width: 460px;
        width: 90%;
        margin: 60px auto;
    }

    #admin-email-auth-section {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        box-sizing: border-box;
    }

    /* Chat app container — fixed phone-frame */
    body.chat-body #app-container {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1;
        width: 460px;
        max-width: 460px;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow:
            -24px 0 80px rgba(0, 0, 0, 0.65),
            24px 0 80px rgba(0, 0, 0, 0.65),
            0 0 0 1px rgba(212, 175, 55, 0.12);
    }

    /* Hide bottom nav and back btn on PC */
    #back-btn,
    .bottom-nav {
        display: none !important;
    }

    /* 2-panel layout inside chat app */
    #main-view {
        width: 35% !important;
        border-left: 1px solid var(--border-color);
        display: flex !important;
        transform: none !important;
        position: relative !important;
    }

    #chat-view {
        width: 65% !important;
        display: flex !important;
        transform: none !important;
        position: relative !important;
    }

    .app-header {
        padding: 14px 20px;
    }

    .message {
        max-width: 65%;
        font-size: 15px;
    }

    .msg-image {
        max-width: 320px;
        max-height: 280px;
    }

    .msg-video {
        max-width: 380px;
        max-height: 280px;
    }
}
/* =========================================================================
   MOBILE RESPONSIVENESS (Fixing Mobile App Cut-offs)
   ========================================================================= */
@media (max-width: 600px) {
    #app-container {
        max-width: 100% !important;
        width: 100vw !important;
        width: 100dvw !important;
        height: 100vh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
    }

    .admin-body #app-container,
    .chat-body #app-container {
        position: absolute !important;
        height: 100vh !important;
        height: 100dvh !important;
    }
}
