html, body {
    height: 100%;
    margin: 0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #1e133c, #0a0614);
    color: #fff;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* =========================================
   1. LOGİN EKRANI
   ========================================= */
.login-screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; 
    left: 0;
    z-index: 9999;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    padding: 40px 30px;
    border-radius: 24px;
    text-align: center;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

.login-box .logo-icon {
    font-size: 50px;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(212,175,55,0.5);
}

.login-box h2 {
    color: #d4af37;
    margin-bottom: 5px;
    font-size: 24px;
}

.login-box p {
    color: #a0a0a0;
    font-size: 13px;
    margin-bottom: 25px;
}

.login-box input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #444;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.login-box input:focus {
    border-color: #d4af37;
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #d4af37, #aa8529);
    color: #000;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(212,175,55,0.3);
}

.login-btn:active {
    transform: scale(0.98);
}

.error-msg {
    color: #ff4d4d;
    font-size: 13px;
    margin-top: 15px;
    display: none;
}

/* =========================================
   2. ƏSAS APP KONTEYNERİ (SİYAHI)
   ========================================= */
.app-container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    background: transparent;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.view-list {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.app-header h2 {
    font-size: 20px;
    color: #d4af37;
}

.logout-btn {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border: 1px solid #ff4d4d;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #ff4d4d;
    color: #fff;
}

/* -- SİYAHI (CHATS) -- */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:hover, .chat-item:active {
    background-color: rgba(255,255,255,0.05);
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #d4af37, #aa8529);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    margin-right: 15px;
    color: #000;
}

.chat-item.blocked .chat-item-avatar {
    background: linear-gradient(135deg, #cc0000, #8b0000);
}
.chat-item.blocked .chat-item-name {
    color: #ff6666;
}

.chat-item-content {
    flex: 1;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-item-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.chat-item-name {
    font-size: 16px;
    color: #e9edef;
    font-weight: 500;
}

.chat-item-time {
    font-size: 12px;
    color: #a0a0a0;
}

.chat-item-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-msg {
    font-size: 14px;
    color: #a0a0a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.unread-badge {
    background-color: #d4af37;
    color: #000;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 6px;
    display: none;
}

.chat-item.has-unread .unread-badge {
    display: flex;
}
.chat-item.has-unread .chat-item-time {
    color: #d4af37;
}

/* -- ALT MENYU -- */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #8696a0;
    font-size: 12px;
    cursor: pointer;
    flex: 1;
}

.nav-item.active {
    color: #d4af37;
}

.nav-item .icon {
    font-size: 20px;
    margin-bottom: 3px;
}

/* =========================================
   3. ÇAT İÇİ (Daxili Səhifə)
   ========================================= */
.view-chat {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0b141a;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10;
}

.view-chat.active {
    transform: translateX(0);
}

.chat-header {
    background-color: #202c33;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn {
    background: transparent;
    border: none;
    color: #d4af37;
    font-size: 24px;
    margin-right: 10px;
    cursor: pointer;
}

.chat-header-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #d4af37;
    color: #000;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    margin-right: 12px;
}

.user-details h3 {
    font-size: 16px;
    color: #e9edef;
    margin: 0 0 2px 0;
}

.user-details .status {
    font-size: 12px;
    color: #8696a0;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.action-btn {
    background: transparent;
    border: none;
    color: #d4af37;
    font-size: 20px;
    cursor: pointer;
}
.action-btn.block {
    color: #ff4d4d;
}

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #0b141a;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-blend-mode: color-burn;
    background-size: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mesaj Bloku */
.msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    color: #e9edef;
    word-wrap: break-word;
    transition: transform 0.2s ease-out; /* Sürüşdürmə effekti üçün */
}

.msg.customer {
    background: #202c33;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.msg.admin {
    background: #005c4b;
    align-self: flex-end;
    border-top-right-radius: 0;
}

/* Şəkil və Sitat stili */
.msg img {
    max-width: 100%;
    border-radius: 6px;
    display: block;
    margin-top: 5px;
}

.msg-quoted {
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #d4af37;
    padding: 5px 10px;
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 13.5px;
}
.msg-quoted strong {
    color: #d4af37;
    display: block;
    margin-bottom: 2px;
}

/* =========================================
   4. ALT HİSSƏ (FOOTER & INPUTS)
   ========================================= */

/* Sitat Qutusu (Reply Preview) */
.reply-preview {
    background-color: #202c33;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #111b21;
}

.reply-content {
    background-color: #111b21;
    border-left: 4px solid #d4af37;
    border-radius: 8px;
    padding: 8px 12px;
    flex: 1;
    margin-right: 15px;
}

.reply-name {
    color: #d4af37;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 3px;
}

.reply-text {
    color: #a0a0a0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.close-reply {
    background: transparent;
    color: #8696a0;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

/* Çat Yazışma Hissəsi (Düymə qaçmasın deyə ölçülər daraldıldı) */
.chat-footer {
    width: 100%;
    max-width: 100vw; /* Ekrandan daşmasının qarşısını alır */
    box-sizing: border-box;
    padding: 8px 10px; /* Boşluqlar azaldıldı */
    background-color: #202c33;
    display: flex;
    align-items: center;
    gap: 6px; /* Elementlər arası məsafə kiçildildi */
    position: relative;
    z-index: 10;
}

.input-wrapper {
    flex: 1;
    min-width: 0; /* Inputun düyməni əzməsinin qarşısını alan ƏSAS kod */
    display: flex;
    align-items: center;
    background-color: #2a3942;
    border-radius: 25px;
    padding: 4px 8px 4px 12px;
}

.chat-input {
    flex: 1;
    min-width: 0; /* Mətn qutusunun ekranı daşırmasına icazə vermir */
    background: transparent;
    border: none;
    padding: 10px 5px 10px 0;
    color: #fff;
    font-size: 15px;
    outline: none;
}

.icon-btn {
    background: transparent;
    color: #8696a0;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 5px;
}

.icon-btn:hover {
    color: #d4af37;
}

/* Göndər Düyməsi (Bir az kiçildildi və tam bərkidildi) */
.send-btn {
    background-color: #d4af37;
    color: #000;
    border: none;
    width: 42px; /* 48-dən 42-yə salındı */
    height: 42px;
    min-width: 42px; 
    min-height: 42px;
    border-radius: 50%;
    font-size: 18px; /* İkon bir az kiçildildi */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Əzilməməsi üçün vacib */
}

.send-btn:active {
    transform: scale(0.95);
}


.blocked-footer {
    padding: 15px;
    background-color: #2a1111;
    color: #ff6666;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid #441111;
}

/* =========================================
   5. SMAYLİK PANELİ VƏ SİLMƏ MODALI
   ========================================= */

/* Smaylik Paneli */
.emoji-picker-container {
    position: absolute; 
    bottom: calc(100% + 5px); 
    left: 10px; 
    right: 60px; 
    background: #2a3942; 
    border: 1px solid #111b21; 
    border-radius: 15px; 
    padding: 10px; 
    display: none; 
    grid-template-columns: repeat(auto-fill, minmax(35px, 1fr)); 
    gap: 8px; 
    max-height: 200px; 
    overflow-y: auto; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.6); 
    z-index: 100;
}
.emoji-picker-container.active { display: grid; }
.emoji-picker-container::-webkit-scrollbar { width: 5px; }
.emoji-picker-container::-webkit-scrollbar-thumb { background: #8696a0; border-radius: 10px; }
.emoji-item { font-size: 24px; text-align: center; cursor: pointer; padding: 5px; border-radius: 8px; user-select: none; }
.emoji-item:hover { background: #202c33; transform: scale(1.1); }

/* Silmə Pəncərəsi (Modal) */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-modal {
    background: #111b21;
    border: 1px solid #2d2d35;
    border-radius: 16px;
    padding: 24px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    transform: scale(0.9);
    animation: modalPop 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    to { transform: scale(1); }
}

.custom-modal h3 {
    color: #d4af37;
    margin-bottom: 10px;
    font-size: 20px;
}

.custom-modal p {
    color: #a0a0a0;
    font-size: 15px;
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-btn.cancel {
    background: #202c33;
    color: #e9edef;
}

.modal-btn.cancel:hover {
    background: #2a3942;
}

.modal-btn.confirm {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border: 1px solid #ff4d4d;
}

.modal-btn.confirm:hover {
    background: #ff4d4d;
    color: #fff;
}
