/* PUBG MARKET | ULTIMATE CHAT STYLES 
    Theme: Battleground Gold & Military Blue
    Developer: Gemini AI
*/

:root {
    --pubg-gold: #ffc107;
    --pubg-gold-hover: #e0a800;
    --bg-dark: #0b0e11;
    --header-bg: #1c2127;
    --chat-bg: #12171d;
    --my-msg: #ffc107;
    --other-msg: #232a33;
    --text-main: #ffffff;
    --text-muted: #9ba3af;
    --danger: #ff4d4d;
    --glass: rgba(255, 255, 255, 0.05);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Oswald', 'Segoe UI', sans-serif; /* PUBG uslubidagi shrift */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* --- MAIN CONTAINER --- */
/* Telefon ekraniga moslash (Fix) */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Ekran o'ynab ketmasligi uchun */
}

.chat-app-container {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Eski telefonlar uchun */
    height: 100dvh; /* Yangi telefonlar (Safari) uchun - aynan shu bo'shliqni yo'qotadi */
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    background: #0b0e11;
}

.chat-main {
    flex: 1; /* O'rtadagi joyni hamma bo'shliqni egallashga majbur qiladi */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    /* Xabarlar va input orasida masofa qolmasligi uchun */
    margin-bottom: 0; 
}

.chat-footer {
    background: #1c2127;
    padding: 10px 15px 25px 15px; /* Pastki qismni telefon "chizig'idan" biroz ko'taramiz */
    border-top: 1px solid rgba(255,255,255,0.05);
    width: 100%;
}

/* Skrinshootingdagi input dizayni */
.input-container {
    display: flex;
    align-items: center;
    background: #242f3d;
    border-radius: 25px;
    padding: 5px 15px;
    gap: 10px;
}

/* --- HEADER: PREMIUM LOOK --- */
.chat-header {
    height: 70px;
    background: var(--header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 2px solid var(--pubg-gold);
    box-shadow: var(--shadow);
    z-index: 100;
}

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

.back-btn {
    color: var(--text-main);
    font-size: 20px;
    text-decoration: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.3s;
}

.back-btn:hover { background: var(--glass); }

.chat-meta h1 {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--pubg-gold);
}

.online-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 8px #00ff00;
}

/* --- HEADER ACTIONS (SEARCH & MENU) --- */
.header-actions {
    display: flex;
    gap: 8px;
}

.action-icon {
    width: 42px;
    height: 42px;
    background: var(--glass);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.action-icon:hover {
    border-color: var(--pubg-gold);
    color: var(--pubg-gold);
}

/* --- DROPDOWN MENU --- */
.dropdown { position: relative; }

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 55px;
    background: #1c2127;
    min-width: 150px;
    border-radius: 12px;
    border: 1px solid var(--pubg-gold);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.dropdown-content button {
    width: 100%;
    padding: 12px 15px;
    background: none;
    border: none;
    color: white;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.dropdown-content button:hover {
    background: rgba(255, 193, 7, 0.1);
    color: var(--pubg-gold);
}

/* --- MESSAGES AREA --- */
.chat-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png'); /* PUBG pattern */
    display: flex;
    flex-direction: column;
}

.messages-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* MESSAGE BUBBLES */
.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 15px;
    position: relative;
    animation: msgIn 0.3s ease;
}

.incoming {
    align-self: flex-start;
    background: var(--other-msg);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}

.outgoing {
    align-self: flex-end;
    background: var(--my-msg);
    color: #000; /* Tillarang fonda qora yozuv */
    border-bottom-right-radius: 2px;
}

.sender-name {
    display: block;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: uppercase;
    color: var(--pubg-gold);
}

.outgoing .sender-name { color: rgba(0,0,0,0.6); }

.text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.time {
    display: block;
    font-size: 10px;
    text-align: right;
    margin-top: 5px;
    opacity: 0.7;
}

.chat-img {
    max-width: 100%;
    border-radius: 10px;
    margin-bottom: 5px;
    border: 2px solid rgba(255,255,255,0.1);
}

/* --- FOOTER: INPUT --- */
.chat-footer {
    padding: 15px;
    background: var(--header-bg);
    border-top: 1px solid rgba(255,255,255,0.05);
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 25px;
    border: 1px solid rgba(255,255,255,0.1);
}

.input-wrapper { flex: 1; }

#messageInput {
    width: 100%;
    background: none;
    border: none;
    color: white;
    outline: none;
    font-size: 15px;
    resize: none;
}

.attach-btn, .send-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.send-btn { color: var(--pubg-gold); }
.send-btn:hover { transform: scale(1.1) rotate(-10deg); }

/* --- MODAL (IMAGE PREVIEW) --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: var(--header-bg);
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    border: 2px solid var(--pubg-gold);
    overflow: hidden;
}

.modal-top {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass);
}

.modal-body img { width: 100%; max-height: 300px; object-fit: cover; }

.modal-bottom { padding: 15px; display: flex; gap: 10px; }

#imageCaption {
    flex: 1;
    background: var(--bg-dark);
    border: none;
    padding: 10px;
    border-radius: 10px;
    color: white;
}

.btn-send-img {
    background: var(--pubg-gold);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
}

/* --- CONTEXT MENU --- */
.context-menu {
    position: fixed;
    background: #232a33;
    border: 1px solid var(--danger);
    border-radius: 8px;
    z-index: 3000;
    padding: 5px;
}

#adminDeleteBtn {
    background: none;
    border: none;
    color: var(--danger);
    padding: 8px 15px;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes msgIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--pubg-gold); border-radius: 10px; }
