html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* --- 1. STRICT SCROLL LOCK & BODY --- */
html, body { height: 100vh; width: 100vw; margin: 0; padding: 0; overflow: hidden !important; background-color: #f0f4f8; font-family: 'Inter', system-ui, sans-serif; }

/* --- 2. FIXED LAYOUT WRAPPERS --- */
#wrapper { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* Sidebar (Left, Fixed) */
#sidebar-wrapper {
    width: 260px; min-width: 260px; flex-shrink: 0;
    background-color: #1a1d21 !important; height: 100vh; overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0,0,0,0.08); z-index: 100;
    display: flex; flex-direction: column;
}
#sidebar-wrapper .sidebar-heading { padding: 1.5rem; font-size: 1.25rem; font-weight: 800; color: #ffffff; border-bottom: 1px solid rgba(255,255,255,0.05); }
#sidebar-wrapper .nav-link { color: #9ca3af !important; padding: 12px 20px; margin: 4px 16px; border-radius: 8px; font-weight: 500; transition: 0.2s; display: flex; align-items: center; }
#sidebar-wrapper .nav-link i { margin-right: 10px; font-size: 1.1rem; }
#sidebar-wrapper .nav-link:hover, #sidebar-wrapper .nav-link.active { background: rgba(253, 126, 20, 0.15) !important; color: #fd7e14 !important; border-left: 4px solid #fd7e14; }

/* Right Content Area */
#page-content-wrapper { flex-grow: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; background-color: #f0f4f8; }

/* Top Navbar (Top, Fixed) */
.topbar-premium {
    background: linear-gradient(135deg, #fd7e14, #e85d04) !important;
    min-height: 70px; flex-shrink: 0; /* Prevents shrinking */
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 2rem; box-shadow: 0 4px 15px rgba(253,126,20,0.2); z-index: 50;
}
.topbar-premium h4, .topbar-premium span { color: #ffffff !important; }
.topbar-premium .btn-logout { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.4); font-weight: 600; }
.topbar-premium .btn-logout:hover { background: white; color: #fd7e14; }

/* Scrollable Inner Content */
.main-scroll-area { flex-grow: 1; overflow-y: auto; padding: 2rem; }

/* --- 3. PREMIUM RICH CARDS --- */
.premium-card {
    background: #ffffff; border-radius: 12px; border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.05); margin-bottom: 1.5rem;
    border-top: 4px solid #fd7e14; /* Beautiful Orange Accent */
}

/* --- ENHANCED SUPPORT CHAT UI --- */

/* --- 1. OVERALL CONTAINER LOCK --- */
.support-desk-container { 
    height: calc(100vh - 130px) !important; /* Strictly lock height */
    min-height: 500px;
    display: flex; 
    overflow: hidden !important; 
}
.chat-list-wrapper, .chat-box-wrapper { 
    height: 100% !important; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden !important; /* Prevent parent from expanding */
    background: #ffffff; 
    border-radius: 16px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.chat-list-header { padding: 24px 20px; border-bottom: 1px solid #edf2f7; background: #ffffff; }
.search-chat-input { background: #f4f7f6; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 16px; width: 100%; font-size: 0.95rem; transition: all 0.3s ease; }
.search-chat-input:focus { border-color: #fd7e14; outline: none; box-shadow: 0 0 0 4px rgba(253,126,20,0.1); background: #ffffff; }
.chat-list { overflow-y: auto; padding: 12px; flex-grow: 1; background-color: #fcfcfc; }

/* Chat List Items & Stunning Active State */
.chat-item { padding: 14px 16px; border-radius: 14px; margin-bottom: 8px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; gap: 14px; border: 1px solid transparent; }
.chat-item:hover { background-color: #ffffff; border-color: #edf2f7; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transform: translateY(-1px); }

/* --- 3. REFINED ACTIVE CHAT STATE (SOFTER DARK) --- */
.chat-item.active { 
    background: #2b3035 !important; /* Softer, premium charcoal */
    border-left: 4px solid #fd7e14 !important; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    border-radius: 12px;
}
.chat-item.active .chat-item-name { color: #fd7e14 !important; font-weight: 700; }
.chat-item.active small.text-muted { color: #adb5bd !important; }
.chat-item.active .chat-item-avatar { background: rgba(253, 126, 20, 0.15); color: #fd7e14; border: 1px solid rgba(253, 126, 20, 0.3); }

/* Avatars */
.chat-item-avatar-container { position: relative; flex-shrink: 0; }
.chat-item-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: rgba(253, 126, 20, 0.1); color: #fd7e14; font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
.chat-online-dot { position: absolute; bottom: 2px; right: 2px; width: 14px; height: 14px; background: #10b981; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.chat-item.active .chat-online-dot { border-color: #1e2125; }

/* Striking Dark Header */
.chat-header {
    background: #2b3035 !important;
    border-left: 4px solid #fd7e14 !important;
    border-radius: 12px !important;
    margin: 16px 16px 0 16px !important;
    padding: 14px 18px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header .chat-item-avatar {
    background: rgba(253, 126, 20, 0.15) !important;
    color: #fd7e14 !important;
    border: 1px solid rgba(253, 126, 20, 0.3);
    font-weight: 700;
}

.chat-header h6 {
    color: #ffffff !important;
    font-size: 1.05rem;
    letter-spacing: 0.3px;
}

.chat-header small.text-muted, .chat-header #chatUserStatus small {
    color: #adb5bd !important;
}

/* --- 2. INTERNAL MESSAGE SCROLLING (WHATSAPP STYLE) --- */
.chat-messages { 
    flex-grow: 1 !important; /* Take remaining space */
    overflow-y: auto !important; /* Scroll internally */
    padding: 24px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    background-color: #f4f7f9; 
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px); 
    background-size: 20px 20px; 
}

/* Chat Bubbles */
.msg-left-container, .msg-right-container { display: flex; align-items: flex-end; gap: 10px; max-width: 80%; }
.msg-left-container { align-self: flex-start; }
.msg-right-container { align-self: flex-end; flex-direction: row-reverse; }

.msg-left { background: #ffffff; color: #2b3440; padding: 14px 20px; border-radius: 20px 20px 20px 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #edf2f7; font-size: 0.95rem; line-height: 1.5; }
.msg-right { background: linear-gradient(135deg, #fd7e14, #e85d04); color: #ffffff; padding: 14px 20px; border-radius: 20px 20px 4px 20px; box-shadow: 0 6px 20px rgba(253,126,20,0.3); font-size: 0.95rem; line-height: 1.5; }

.msg-time { font-size: 0.7rem; color: #9ca3af; margin-top: 6px; font-weight: 600; padding: 0 5px; }
.msg-right-time { text-align: right; }

/* --- 4. FORCE SINGLE-LINE INPUT AREA --- */
.chat-input-area { 
    display: flex !important; 
    align-items: center !important; 
    gap: 12px; 
    padding: 16px 20px; 
    background: #ffffff; 
    border-top: 1px solid #edf2f7; 
    flex-shrink: 0; /* Never shrink */
    width: 100%;
}
.chat-input-wrapper { 
    flex-grow: 1 !important; /* Take all available width */
    display: flex; 
    background: #f8fafc; 
    border: 1px solid #e2e8f0; 
    border-radius: 12px; 
    padding: 2px;
}
.chat-input-wrapper input { 
    width: 100% !important; 
    border: none; 
    background: transparent; 
    padding: 12px 16px; 
    font-size: 0.95rem; 
}
.chat-input-wrapper input:focus { outline: none; }
.btn-send-msg { 
    flex-shrink: 0 !important; /* Prevent button from squeezing */
    background: linear-gradient(135deg, #fd7e14, #e85d04); 
    color: white; border: none; border-radius: 10px; 
    padding: 0 24px; font-weight: 600; 
    height: 48px; /* Match input height */
    display: flex; align-items: center; justify-content: center; gap: 8px; 
    white-space: nowrap; /* Prevent text wrapping */
}

/* --- TABLES & UTILITIES --- */
.premium-table th { background: #fafbfc !important; color: #6b7280; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; border-bottom: 2px solid #edf2f7; padding: 1rem 1.25rem; }
.premium-table td { padding: 1rem 1.25rem; vertical-align: middle; border-bottom: 1px solid #f8f9fa; color: #374151; font-weight: 500; }
.premium-table tbody tr:hover { background-color: #fffaf6; }

.badge-soft-success { background: #d1e7dd; color: #0f5132; padding: 6px 12px; border-radius: 50rem; font-weight: 500; font-size: 0.75rem; border: none; }
.badge-soft-warning { background: #fff3cd; color: #856404; padding: 6px 12px; border-radius: 50rem; font-weight: 500; font-size: 0.75rem; border: none; }
.badge-soft-primary { background: #cfe2ff; color: #084298; padding: 6px 12px; border-radius: 50rem; font-weight: 500; font-size: 0.75rem; border: none; }
.badge-soft-secondary { background: #e2e3e5; color: #383d41; padding: 6px 12px; border-radius: 50rem; font-weight: 500; font-size: 0.75rem; border: none; }

.btn-premium { background: linear-gradient(135deg, #fd7e14, #e85d04) !important; color: white !important; border-radius: 10px; padding: 10px 20px; border: none; font-weight: 500; box-shadow: 0 4px 12px rgba(253,126,20,0.2); transition: 0.2s; }
.btn-premium:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(253,126,20,0.3); }
.premium-input { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px; background: #ffffff; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.premium-input:focus { border-color: #fd7e14; box-shadow: 0 0 0 4px rgba(253,126,20,0.1); outline: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- CUSTOM WHATSAPP-STYLE AUDIO PLAYER --- */
.custom-audio-player {
    border-radius: 8px;
}
.btn-play-pause {
    width: 38px;
    height: 38px;
    background: #f8fafc;
    border: none;
    color: #fd7e14;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.btn-play-pause:hover {
    background: #ffffff;
    transform: scale(1.05);
}
.msg-right .btn-play-pause {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: none;
}
.msg-right .btn-play-pause:hover {
    background: rgba(255, 255, 255, 0.3);
}
.custom-range {
    height: 4px;
    border-radius: 2px;
    accent-color: #fd7e14;
    background: rgba(0, 0, 0, 0.1);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.msg-right .custom-range {
    accent-color: #ffffff;
    background: rgba(255, 255, 255, 0.3);
}
.custom-range::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fd7e14;
    border-radius: 50%;
    cursor: pointer;
}
.msg-right .custom-range::-webkit-slider-thumb {
    background: #ffffff;
}