/* ============================================================
   HUSHLY — style.css
   ============================================================ */

:root {
    --bg: #F1F5F9;
    --text-main: #0F172A;
    --primary: #4F46E5;
    --white: #ffffff;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    margin: 0;
    padding-bottom: 0;
    overscroll-behavior-y: none;
}

/* ============================================================
   1. HEADER
   ============================================================ */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #E2E8F0;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* allows text truncation inside flex */
    flex: 1;
}

.back-btn {
    font-size: 1.2rem;
    color: #64748B;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: none;
    border: none;
    background: none;
}
.back-btn:active { background: #F1F5F9; }

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
}

.channel-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #1E293B;
    display: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- Buttons ---- */
.btn-sm {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-support  { background: #FEE2E2; color: #DC2626; }
.btn-login    { background: #0F172A; color: white; }
.btn-filter   { background: #EEF2FF; color: #4F46E5; display: none; }
.btn-filter.active { background: #FEF3C7; color: #D97706; }
.btn-admin    { background: #1E293B; color: #F59E0B; display: none; }
.btn-bell     {
    background: #EFF6FF;
    color: #3B82F6;
    font-size: 1rem;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ============================================================
   2. LOBBY
   ============================================================ */
.lobby-container {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 80vh;
    position: relative;
    padding-top: 10px;
}

/* Section Headers */
.section-header {
    font-size: 0.85rem;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
    margin-bottom: 5px;
    padding-left: 5px;
}

/* Profile Card */
.profile-card {
    background: white;
    padding: 15px;
    border-radius: 15px;
    display: none;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.profile-avatar {
    background: #EEF2FF;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.profile-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.profile-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1E293B;
}

/* ============================================================
   3. CHANNEL BLOCKS
   ============================================================ */
.channel-block {
    background: white;
    padding: 22px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 15px;
}
.channel-block:hover  { box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1); }
.channel-block:active { transform: scale(0.98); }

.block-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.block-info h3 { margin: 0; font-size: 1.05rem; color: #1E293B; }
.block-info p  { margin: 3px 0 0; font-size: 0.8rem; color: #64748B; }

/* Zone accent colors */
.c-chat .block-icon { background: #EEF2FF; color: #4F46E5; }
.c-rant .block-icon { background: #FEF2F2; color: #DC2626; }
.c-news .block-icon { background: #ECFDF5; color: #059669; }

/* ============================================================
   4. FEED
   ============================================================ */
.feed-container {
    display: none;
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
    padding-bottom: 140px;
}

/* Message Cards */
.msg-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    position: relative;
    transition: background 0.5s;
    max-width: 85%;
    margin-right: auto;
    margin-left: 0;
}

.msg-card.pinned-card {
    border: 2px solid #F59E0B;
    background: #FFFBEB;
    max-width: 100%;
    margin: 0 0 12px 0;
}

.msg-card.my-msg {
    background: #EEF2FF;
    border: 1px solid #6366F1;
    margin-left: auto;
    margin-right: 0;
    border-bottom-right-radius: 4px;
}

.msg-card.premium {
    background: linear-gradient(135deg, #FFFBEB, #FFFFFF);
    border: 2px solid #FCD34D;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

/* Highlight animation on reply jump */
.highlight-msg { animation: highlightAnim 2s ease; }
@keyframes highlightAnim {
    0%   { background: #EEF2FF; transform: scale(1.02); }
    100% { background: white;   transform: scale(1); }
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.user-id {
    font-weight: 800;
    font-size: 0.95rem;
    color: #1E293B;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Reply preview inside a message */
.reply-preview {
    background: #F1F5F9;
    border-left: 4px solid #6366F1;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
}
.reply-preview:active { opacity: 0.7; }

.msg-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #F1F5F9;
}

.action-btn {
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: #94A3B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}
.action-btn.upvoted { color: #EF4444; }

.gender-box {
    font-size: 0.65rem;
    font-weight: 800;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}
.gender-m { background: #3B82F6; }
.gender-f { background: #EC4899; }
.gender-h { background: #94A3B8; }

.badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}
.badge-admin { background: #DBEAFE; color: #2563EB; }
.badge-gold  { background: #FFD700; color: #451a03; border: 1px solid #B45309; }

.msg-time {
    margin-right: auto;
    font-size: 0.7rem;
    color: #94A3B8;
    font-weight: 500;
}

.msg-text {
    font-size: 1rem;
    line-height: 1.55;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}
.msg-text a {
    color: #4F46E5;
    text-decoration: underline;
    font-weight: 600;
}

/* ============================================================
   5. CHAT BAR
   ============================================================ */
.chat-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 10px 16px;
    border-top: 1px solid #E2E8F0;
    display: none;
    flex-direction: column;
    z-index: 100;
}

#reply-context {
    background: #F1F5F9;
    border-left: 4px solid #6366F1;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 8px;
    border-radius: 4px;
    display: none;
    justify-content: space-between;
    align-items: center;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.input-wrapper {
    flex-grow: 1;
    background: #F1F5F9;
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 0 5px 0 15px;
}

#chat-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.btn-gold {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: #CBD5E1;
    transition: color 0.3s, transform 0.3s;
}
.btn-gold.active {
    color: #F59E0B;
    text-shadow: 0 0 10px #FCD34D;
    transform: scale(1.1);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
    transition: opacity 0.2s;
}

/* ============================================================
   6. ADMIN VIEW
   ============================================================ */
.contest-view, .deals-view, .admin-view {
    display: none;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.admin-stats-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #334155;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.8rem;
}
.admin-table th,
.admin-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}
.admin-table th {
    background: #F1F5F9;
    font-weight: 800;
    color: #475569;
}
.row-red   { background: #FEE2E2 !important; }
.row-green { background: #F0FDF4 !important; }
.tag       { padding: 2px 6px; border-radius: 4px; font-weight: bold; font-size: 0.7rem; }
.tag-dup   { background: #EF4444; color: white; }

/* ============================================================
   7. INSTALL PROMPT
   ============================================================ */
#install-container {
    position: fixed;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: none;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
    padding: 0 20px;
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn-install {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   8. MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal {
    background: white;
    width: 100%;
    max-width: 360px;
    padding: 28px;
    border-radius: 20px;
    text-align: center;
}

.modal h2 { margin: 0 0 8px; color: #1E293B; }

.modal-btn {
    width: 100%;
    padding: 14px;
    background: #0F172A;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}
.modal-btn:hover { opacity: 0.88; }
.modal-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-btn-ghost {
    background: transparent;
    color: #64748B;
    border: 1px solid #E2E8F0;
}
.modal-btn-ghost:hover { background: #F8FAFC; opacity: 1; }

.modal-btn-red { background: #DC2626; }

/* Form Inputs inside Modal */
.modal input[type="text"],
.modal select {
    width: 100%;
    padding: 12px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    margin-bottom: 12px;
    background: #F8FAFC;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1E293B;
    transition: border-color 0.2s;
}
.modal input[type="text"]:focus,
.modal select:focus { border-color: #6366F1; }

/* ============================================================
   9. TOAST
   ============================================================ */
#toast {
    visibility: hidden;
    background: #0F172A;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    white-space: nowrap;
}
#toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 90px;
}

/* ============================================================
   10. FOOTER
   ============================================================ */
.footer-container {
    text-align: center;
    margin-top: 45px;
    padding-top: 30px;
    padding-bottom: 40px;
    border-top: 1px solid #E2E8F0;
}
.dev-credit {
    color: #94A3B8;
    font-size: 0.75rem;
    margin-bottom: 10px;
}
.dev-credit a {
    color: #6366F1;
    text-decoration: none;
    font-weight: bold;
}
.legal-links a {
    color: #64748B;
    text-decoration: none;
    margin: 0 5px;
    font-size: 0.8rem;
}
.legal-links a:hover { color: #4F46E5; }

/* ============================================================
   11. RESPONSIVE
   ============================================================ */

/* Small phones */
@media screen and (max-width: 380px) {
    body { font-size: 14px; }
    .app-header { padding: 10px 12px; }
    .logo { font-size: 1rem; }
    .channel-block { padding: 15px; gap: 10px; }
    .block-icon { width: 40px; height: 40px; font-size: 1.2rem; }
    .block-info h3 { font-size: 0.95rem; }
    .block-info p { font-size: 0.75rem; }
    .btn-sm { padding: 4px 8px; font-size: 0.7rem; }
    .btn-install { padding: 10px 20px; font-size: 0.9rem; }
    .modal { padding: 20px; }
}

/* Chat bar on tiny screens */
@media screen and (max-width: 360px) {
    .chat-bar { padding: 8px; }
    .send-btn { width: 40px; height: 40px; font-size: 1rem; }
    #chat-input { font-size: 0.9rem; }
}

/* Admin table on mobile */
@media screen and (max-width: 600px) {
    .admin-view { padding: 10px; overflow-x: auto; }
    .admin-table th, .admin-table td { padding: 8px 5px; font-size: 0.75rem; }
    .admin-table td:nth-child(3),
    .admin-table td:nth-child(4) {
        max-width: 80px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Landscape / short screens */
@media screen and (max-height: 600px) {
    .feed-container { padding-bottom: 100px; }
    #install-container { bottom: 15px; }
}
