/* assets/style.css */

/* =========================================
   1. CORE VARIABLES & BUBBLE STYLES
   (Preserved from your original style.css)
   ========================================= */
:root {
    /* Default Colors */
    --bg-color: #ffffff;
    --sidebar-bg: #f8f8f8;
    --text-main: #1a1a1a;
    --glass-border: rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    
    /* Bubble Colors */
    --bubble-me: #007aff;
    --bubble-me-text: #ffffff;
    --bubble-them: #e5e5ea;      
    --bubble-them-text: #000000; 
    
    --ios-blue: #007aff;
    --danger-red: #ff3b30;
    --glow: 0 0 10px rgba(0, 122, 255, 0.3);
    
    /* Additional Defaults for Admin */
    --bg-image: none;
    --scroll-btn-bg: #007aff;
}

[data-theme="dark"] {
    /* Dark Mode Bubbles */
    --bubble-me: #0088cc;
    --bubble-me-text: #ffffff;
    --bubble-them: #262628;      
    --bubble-them-text: #ffffff; 
    --glow: 0 0 10px rgba(0, 136, 204, 0.5);
    
    /* Admin Dark Mode Overrides */
    --bg-color: #000000;
    --sidebar-bg: #1c1c1e;
    --text-main: #ffffff;
    --glass-border: rgba(255,255,255,0.15);
    --input-bg: #2c2c2e;
    --bg-image: url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
    --scroll-btn-bg: #0088cc;
}

/* Base Styles (Chat Default: Fixed Screen) */
body {
    background-color: var(--bg-color);
    background-image: var(--bg-image);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    margin: 0;
    height: 100dvh; /* Chat needs fixed height */
    overflow: hidden; /* Chat needs hidden overflow */
    transition: background 0.3s ease, color 0.3s ease;
}

/* Side Navigation Bar (YOUR CUSTOM CODE) */
.side-nav {
    width: 70px;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.side-nav i {
    font-size: 20px;
    margin-bottom: 30px;
    color: #8e8e93;
    cursor: pointer;
    transition: 0.3s;
}

.side-nav i:hover, .side-nav i.active {
    color: var(--ios-blue);
    text-shadow: var(--glow);
}

/* Chat Bubbles (Base Design) */
.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 15px;
    margin-bottom: 8px;
    position: relative;
    font-size: 15px;
    line-height: 1.4;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    word-wrap: break-word !important; 
    word-break: break-word !important; 
    overflow-wrap: anywhere !important; 
    white-space: pre-wrap;
}

.message-me {
    align-self: flex-end;
    background: var(--bubble-me);
    color: var(--bubble-me-text);
    box-shadow: var(--glow);
}

.message-them {
    align-self: flex-start;
    background: var(--bubble-them);
    color: var(--bubble-them-text);
    border: 1px solid var(--glass-border);
}

.date-divider { text-align: center; margin: 20px 0; position: relative; }
.date-divider span { background: rgba(0,0,0,0.3); padding: 5px 15px; border-radius: 20px; font-size: 12px; color: var(--ios-blue); border: 1px solid var(--ios-blue); }

/* =========================================
   2. CHAT LAYOUT & INTERFACE 
   ========================================= */

/* Main Structure */
.main-container { display: flex; height: 100dvh; width: 100%; overflow: hidden; position: relative; }
.sidebar { width: 320px; background: var(--sidebar-bg); border-right: 1px solid var(--glass-border); display: flex; flex-direction: column; transition: transform 0.3s ease; z-index: 1000; }

.search-bar-container { padding: 10px 15px; border-bottom: 1px solid var(--glass-border); flex-shrink: 0; }
.search-bar-container input { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--input-bg); color: var(--text-main); outline: none; box-sizing: border-box; font-size: 14px; }

.chat-header { 
    padding: 0 20px; 
    height: 60px; 
    border-bottom: 1px solid var(--glass-border); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    background: var(--sidebar-bg); 
    z-index: 10; 
    box-sizing: border-box; 
    flex-shrink: 0; 
}

.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; background-color: var(--bg-color); }
.messages-display { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

.message-content img { max-width: 100%; height: auto; border-radius: 12px; display: block; margin-top: 5px; }

.chat-input-area { 
    padding: 15px 20px; 
    border-top: 1px solid var(--glass-border); 
    display: flex; 
    gap: 15px; 
    align-items: flex-end; 
    background: var(--sidebar-bg); 
    backdrop-filter: blur(15px);
    z-index: 10; 
    padding-bottom: calc(15px + env(safe-area-inset-bottom)); 
    flex-shrink: 0; 
}

.chat-input-area textarea { 
    flex: 1; 
    min-width: 0; 
    background: var(--input-bg); 
    border-radius: 20px; 
    padding: 12px 15px; 
    color: var(--text-main); 
    border: 1px solid var(--glass-border); 
    outline: none; 
    font-size: 16px; 
    font-family: inherit;
    resize: none; 
    max-height: 120px; 
    min-height: 24px; 
    overflow-y: auto;
    line-height: 1.4;
    box-sizing: border-box;
}

.action-icon { 
    color: var(--ios-blue); 
    cursor: pointer; 
    font-size: 24px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 40px; 
    height: 40px; 
    padding-bottom: 2px;
    flex-shrink: 0; 
    -webkit-tap-highlight-color: transparent; 
}

/* Modals & Overlays */
.overlay { display: none; position: fixed; z-index: 99999; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); align-items: center; justify-content: center; }
#lightbox img { max-width: 90%; max-height: 90%; border-radius: 12px; }
.modal-card { background: var(--sidebar-bg); padding: 30px; border-radius: 20px; width: 300px; border: 1px solid var(--glass-border); box-shadow: 0 10px 40px rgba(0,0,0,0.4); text-align: center; color: var(--text-main); }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ios-blue); margin-bottom: 15px; }
.profile-name { font-size: 20px; font-weight: bold; margin-bottom: 5px; }
.profile-role { display: inline-block; padding: 4px 10px; border-radius: 15px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: white; margin-bottom: 15px; }
.role-admin { background: var(--ios-blue); }
.role-user { background: #8e8e93; }
.profile-meta { font-size: 12px; opacity: 0.6; }
.edit-input { width: 100%; height: 80px; margin: 15px 0; border-radius: 10px; padding: 10px; background: var(--input-bg); color: var(--text-main); border: 1px solid var(--glass-border); resize: none; outline: none; box-sizing: border-box;}
.modal-actions { display: flex; justify-content: center; gap: 10px; margin-top: 15px; }

.btn-cancel { padding: 10px 20px; border-radius: 8px; border: none; background: rgba(128,128,128,0.2); color: var(--text-main); cursor: pointer; font-weight: 600; font-size: 14px; }
.btn-confirm { padding: 10px 20px; border-radius: 8px; border: none; background: var(--danger-red); color: white; cursor: pointer; font-weight: 600; font-size: 14px; }
.btn-save { padding: 8px 20px; border-radius: 8px; border: none; background: var(--ios-blue); color: white; cursor: pointer; font-weight: 600; }

/* Sidebar Elements */
.broadcast-banner { background: rgba(255, 149, 0, 0.9); color: white; padding: 10px 20px; text-align: center; font-size: 14px; font-weight: 600; display: flex; justify-content: center; align-items: center; position: relative; z-index: 2; backdrop-filter: blur(5px); }
.sidebar-section { padding: 15px; padding-bottom: 5px; opacity: 0.6; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.nav-item { padding: 10px 15px; display: flex; align-items: center; cursor: pointer; margin: 0 10px; border-radius: 8px; transition: 0.2s; color: var(--text-main); font-weight: 500; font-size: 14px; flex-wrap: nowrap; text-decoration: none; }
.nav-item:hover { background: var(--glass-border); }
.nav-item.active { background: var(--ios-blue); color: white; }

.nav-icon { 
    width: 24px; height: 24px; min-width: 24px; min-height: 24px; 
    border-radius: 6px; margin-right: 12px; 
    object-fit: cover; background: rgba(255,255,255,0.1); 
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

#soundToggleBtn { justify-content: center; background: var(--glass-border); text-align: center; }

/* Status Indicators */
.status-dot { width: 10px; height: 10px; border-radius: 50%; margin-left: auto; border: 2px solid var(--sidebar-bg); }
.status-online { background-color: #34c759; box-shadow: 0 0 5px #34c759; }
.status-away { background-color: #ff9500; }
.status-offline { background-color: #8e8e93; opacity: 0.3; }
.mention-highlight { background-color: rgba(255, 149, 0, 0.1); border-left: 3px solid #ff9500; padding-left: 8px; }

/* Popups & Notifications */
#dmNotification {
    position: fixed; top: 20px; right: 20px; background: var(--sidebar-bg);
    border: 1px solid var(--ios-blue); border-radius: 15px; padding: 12px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); z-index: 10000;
    display: none; align-items: center; gap: 15px;
    animation: slideIn 0.3s ease; max-width: 300px; cursor: pointer;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.notif-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.notif-text { flex: 1; }
.notif-name { font-weight: bold; font-size: 14px; color: var(--ios-blue); }
.notif-msg { font-size: 12px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vis-btn { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: bold; text-decoration: none; border: 1px solid var(--ios-blue); display: inline-block; margin-top: 2px; }
.vis-online { color: #34c759; border-color: #34c759; }
.vis-offline { color: #8e8e93; border-color: #8e8e93; }

.user-header-info { line-height: 1.2; margin-right: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.sidebar-footer { margin-top: auto; padding: 20px; font-size: 11px; opacity: 0.6; text-align: center; border-top: 1px solid var(--glass-border); }
.sidebar-footer a { color: var(--text-main); text-decoration: none; transition: 0.2s; }
.sidebar-footer a:hover { color: var(--ios-blue); }
.developer-link { color: var(--ios-blue) !important; font-weight: bold; }

/* Mobile Responsive - FIXED SHADOW ISSUE HERE */
#mobileBtnContainer { display: none; position: fixed; top: 0; left: 0; height: 60px; width: 60px; z-index: 100000; align-items: center; justify-content: center; }
#mobileMenuBtn { font-size: 24px; color: var(--ios-blue); cursor: pointer; background: var(--sidebar-bg); padding: 5px; border-radius: 5px; }
#menuBackdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9000; backdrop-filter: blur(2px); }

@media (max-width: 768px) { 
    .sidebar { 
        position: fixed; top: 0; left: 0; bottom: 0; width: 80%; max-width: 300px; 
        z-index: 9999; transform: translateX(-100%); 
        
        /* FIX: Removed box-shadow here so it doesn't show when closed */
        box-shadow: none; 
        transition: transform 0.3s ease; 
    }
    .sidebar.open { 
        transform: translateX(0); 
        /* FIX: Added box-shadow here so it only shows when open */
        box-shadow: 10px 0 50px rgba(0,0,0,0.5); 
    }
    
    #mobileBtnContainer { display: flex; } 
    .chat-header { padding-left: 60px; } 
    .header-desc-text { display: none; }
    .vis-btn span { display: inline-block; }
    .vis-btn i { margin-right: 6px !important; } 
    .chat-input-area { padding: 10px 15px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* Scroll Button (Specific override for this page) */
#scrollDownBtn {
    display: none;
    position: absolute;
    bottom: 90px;
    right: 25px;
    width: 45px;
    height: 45px;
    background-color: var(--scroll-btn-bg);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s;
}
#scrollDownBtn:hover { transform: scale(1.1); }

/* --- SIDEBAR USER LIST --- */
.user-list { flex: 1; overflow-y: auto; padding: 10px; }
.user-list-item { 
    display: flex; align-items: center; padding: 10px; 
    border-radius: 12px; cursor: pointer; transition: background 0.2s;
    color: var(--text-main); text-decoration: none;
}
.user-list-item:hover { background: rgba(128,128,128,0.1); }
.u-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; margin-right: 12px; border: 1px solid var(--glass-border); }
.u-info { flex: 1; }
.u-name { font-weight: 600; font-size: 14px; display: block; }
.u-role { font-size: 11px; opacity: 0.6; text-transform: uppercase; }

/* =========================================
   3. ADMIN DASHBOARD STYLES (NEW)
   (Applied ONLY when body has class "admin-body")
   ========================================= */

/* Override fixed layout for Admin Panel so it scrolls */
body.admin-body {
    height: auto !important; 
    min-height: 100vh !important;
    overflow-y: auto !important;
    padding: 20px;
    padding-bottom: 80px;
}

.admin-container { max-width: 1200px; margin: 0 auto; }
.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.header-actions { display: flex; align-items: center; gap: 15px; }
.back-btn { background: var(--sidebar-bg); color: var(--ios-blue); padding: 8px 15px; border-radius: 20px; text-decoration: none; font-weight: 600; font-size: 14px; border: 1px solid var(--glass-border); transition: 0.2s; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card { background: var(--sidebar-bg); padding: 20px; border-radius: 16px; border: 1px solid var(--glass-border); text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.stat-num { font-size: 32px; font-weight: 700; color: var(--ios-blue); display: block; margin-bottom: 5px; }
.stat-label { font-size: 13px; text-transform: uppercase; font-weight: 600; opacity: 0.6; letter-spacing: 0.5px; }

/* Tabs */
.segmented-control { display: flex; background: rgba(128,128,128,0.15); padding: 4px; border-radius: 12px; margin-bottom: 25px; overflow-x: auto; }
.tab-btn { flex: 1; min-width: 100px; padding: 10px; border: none; background: transparent; color: var(--text-main); font-weight: 600; font-size: 14px; cursor: pointer; border-radius: 8px; transition: all 0.2s; opacity: 0.7; white-space: nowrap; }
.tab-btn.active { background: var(--bg-color); box-shadow: 0 2px 8px rgba(0,0,0,0.15); opacity: 1; color: var(--ios-blue); }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Section Cards */
.section-card { background: var(--sidebar-bg); border-radius: 20px; padding: 25px; margin-bottom: 25px; border: 1px solid var(--glass-border); position: relative; }
.section-title { margin-top: 0; font-size: 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; opacity: 0.9; }

/* Form Elements (Admin Specific) */
.admin-body input, .admin-body textarea, .admin-body select { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--input-bg); color: var(--text-main); font-family: inherit; box-sizing: border-box; outline: none; margin-bottom: 10px; }

/* Buttons */
.btn-action { 
    background: var(--ios-blue); color: white; border: none; 
    padding: 0 20px; border-radius: 10px; font-weight: 600; cursor: pointer; 
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; min-width: 100px; font-size: 14px; transition: opacity 0.2s;
    text-decoration: none; box-sizing: border-box;
}
.btn-action:hover { opacity: 0.8; }
.btn-danger { background: #ff3b30; }
.btn-backup { background: #af52de; color: white; border: none; padding: 10px 20px; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 13px; display: inline-block; }

.control-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--glass-border); }
.control-row:last-child { border-bottom: none; }

/* Tables */
.table-responsive { overflow-x: auto; }
.user-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 800px; }
.user-table th { text-align: left; padding: 10px; border-bottom: 2px solid var(--glass-border); opacity: 0.6; font-size: 12px; text-transform: uppercase; }
.user-table td { padding: 12px 10px; border-bottom: 1px solid var(--glass-border); vertical-align: middle; }
.user-avatar-small { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; margin-right: 12px; vertical-align: middle; background: #fff; }
.user-ip { font-family: monospace; font-size: 12px; color: var(--ios-blue); background: rgba(0,122,255,0.1); padding: 2px 6px; border-radius: 4px; }

/* Pills */
.btn-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 20px; text-decoration: none; font-size: 11px; font-weight: 700; color: white; margin-right: 5px; margin-bottom: 5px; transition: 0.2s; }
.btn-pill:hover { opacity: 0.8; }
.pill-green { background: #34c759; }
.pill-orange { background: #ff9500; }
.pill-blue { background: #007aff; }
.pill-purple { background: #af52de; }
.pill-red { background: #ff3b30; }
.pill-grey { background: #8e8e93; }
.pill-dark { background: #333; }

/* Modal Override */
.modal { display: none; position: fixed; z-index: 9999; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); }
.modal-content { background: var(--sidebar-bg); margin: 15% auto; padding: 25px; border: 1px solid var(--glass-border); width: 90%; max-width: 400px; border-radius: 20px; color: var(--text-main); }
.close-modal { float: right; font-size: 24px; cursor: pointer; }

@media (max-width: 600px) {
    .control-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .btn-action { width: 100%; }
}

/* Logs Page Specifics */
.log-window { background: #1e1e1e; color: #00ff00; padding: 20px; border-radius: 10px; height: 600px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); border: 1px solid #333; }
.log-entry { padding: 5px 0; border-bottom: 1px solid #333; white-space: pre-wrap; }
.error-type { color: #ff3b30; font-weight: bold; }

/* =========================================
   4. ADVANCED LOGIN & REGISTER STYLES (NEW)
   ========================================= */
.login-body {
    margin: 0; height: 100dvh; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background-color: #f0f2f5; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-repeat: no-repeat; background-position: center center; background-size: cover; background-attachment: fixed;
}
.login-overlay { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0, 0.35); z-index: 0; pointer-events: none; }

.login-card {
    position: relative; z-index: 10;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    padding: 45px 40px; border-radius: 24px; width: 90%; max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25); text-align: center;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255, 255, 255, 0.95); /* Default fallback */
}

.brand-logo { max-height: 80px; margin-bottom: 20px; display: block; margin-left: auto; margin-right: auto; }
.login-card h2 { margin: 0 0 10px; font-size: 26px; color: #1a1a1a; letter-spacing: -0.5px; }
.login-card p { margin: 0 0 30px; color: #666; font-size: 15px; line-height: 1.4; }

.login-input-group { position: relative; margin-bottom: 20px; text-align: left; }
.login-input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #999; z-index: 2; }

.login-input {
    width: 100%; padding: 14px 15px 14px 45px;
    border: 2px solid transparent; background: rgba(240, 242, 245, 0.9);
    border-radius: 12px; font-size: 15px; outline: none;
    box-sizing: border-box; transition: 0.3s; color: #333;
}

.login-btn {
    width: 100%; padding: 14px; color: white; border: none;
    border-radius: 12px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: transform 0.2s, opacity 0.2s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}
.login-btn:hover { transform: translateY(-2px); opacity: 0.9; }

.login-links { margin-top: 25px; font-size: 13px; display: flex; justify-content: space-between; }
.login-links a { color: #555; text-decoration: none; transition: 0.2s; font-weight: 500; }

.alert-error { background: #fee; color: #e33; padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border: 1px solid #fcc; display:flex; align-items:center; gap:10px; text-align: left; }

.footer-text {
    position: relative; z-index: 10; margin-top: 30px; font-size: 12px;
    color: rgba(255,255,255,0.8); text-shadow: 0 1px 2px rgba(0,0,0,0.5); text-align: center;
}
.footer-text a { color: inherit; text-decoration: underline; }

/* Admin Design Page Preview */
.preview-box { height: 150px; background-size: cover; background-position: center; border-radius: 8px; margin-top: 10px; border: 2px solid var(--glass-border); display: flex; align-items: center; justify-content: center; color: var(--text-main); font-weight: bold; font-size: 18px; position: relative; overflow: hidden; background-color: var(--input-bg); }
.preview-box img { max-height: 100px; max-width: 90%; object-fit: contain; }

/* Unread Badge Style */
.unread-badge {
    background-color: #ff3b30;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(255, 59, 48, 0.4);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* YouTube Embed Styling - FIXED SIZE */
.yt-container {
    position: relative;
    width: 100%;
    min-width: 300px; /* <--- This forces the video to be big enough */
    max-width: 100%;  /* Allows it to fill the bubble */
    padding-bottom: 56.25%; /* Keeps the 16:9 aspect ratio */
    height: 0;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.yt-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Mobile Tweak: Ensure it fits on small screens */
@media (max-width: 768px) {
    .yt-container {
        min-width: 260px; /* Slightly smaller for mobile phones */
    }
}

/* --- FIXED SIZE CHAT IMAGES --- */
.chat-media-img {
    display: block;
    max-width: 100%;  /* Ensure it doesn't overflow horizontally on mobile */
    max-height: 250px; /* THE KEY FIX: Limits height so it's not massive */
    width: auto;      /* Maintain aspect ratio */
    height: auto;     /* Maintain aspect ratio */
    border-radius: 12px;
    cursor: pointer;  /* Shows hand cursor indicating it's clickable */
    margin-top: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Adds depth */
    transition: transform 0.2s ease, opacity 0.2s;
}

/* Optional: nice hover effect */
.chat-media-img:hover {
    transform: scale(1.02);
    opacity: 0.9;
}