@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

/* =========================================
   1. VARIABLES (LIGHT PASTEL & DARK MODE)
========================================== */
:root {
    --bg-color: #f4f7fb;
    --panel-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #888888;
    --border-color: #e2e8f0;
    
    --primary: #ff8fa3; /* Pastel red/pink yang lebih terang */
    --primary-hover: #ff4757;
    --accent: #8c7ae6; /* Pastel Purple */
    
    --bubble-me: #a9b4fa;
    --bubble-me-text: #ffffff;
    --bubble-other: #fcedf2;
    --bubble-other-text: #333333;
    
    --input-bg: #f8fafc;
}

body.dark-mode {
    --bg-color: #121212;
    --panel-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    
    --primary: #ff7979; /* Pastel terang */
    --primary-hover: #ff6b81;
    --accent: #74b9ff; /* Pastel biru cerah */
    
    /* Warna hijau dihilangkan, diganti biru/indigo pastel elegan */
    --bubble-me: #4a69bd; 
    --bubble-me-text: #ffffff;
    --bubble-other: #2d3436;
    --bubble-other-text: #e0e0e0;
    
    --input-bg: #2d3436;
}

/* =========================================
   2. GLOBAL RESET
========================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%; font-family: 'Inter', sans-serif;
    background: var(--bg-color); color: var(--text-main);
    overflow: hidden; touch-action: manipulation;
    transition: background 0.3s, color 0.3s;
}

/* =========================================
   3. LOGIN PAGE (FULL RESPONSIVE)
========================================== */
.login-screen {
    height: 100dvh; display: flex; flex-direction: column;
    padding: 30px 24px; overflow-y: auto; position: relative;
}

/* Tombol Pojok Atas */
.top-actions {
    position: absolute; top: 20px;
    display: flex; gap: 12px; z-index: 10;
}
.top-actions.left { left: 24px; }
.top-actions.right { right: 24px; }

.circle-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--panel-bg); border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    color: var(--text-main); text-decoration: none; font-size: 20px;
    transition: 0.2s; padding: 0;
}
.circle-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
.circle-btn:active { transform: scale(0.9); }
.circle-btn:hover { background: var(--border-color); }
a.no-underline { text-decoration: none; }

.login-header { text-align: center; margin-top: 80px; margin-bottom: 40px; }
.login-header h1 { font-size: 32px; font-weight: 800; color: var(--text-main); letter-spacing: -0.5px; }
.login-header p { color: var(--text-muted); font-size: 15px; margin-top: 8px; }
.fire-icon { font-size: 60px; display: inline-block; animation: float 3s ease-in-out infinite; margin-bottom: 10px; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.room-form { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.letter-slider { display: flex; align-items: center; gap: 15px; width: 100%; }
.letter-slider button {
    flex: 1; height: 55px; border-radius: 16px; font-size: 20px;
    background: var(--panel-bg); border: 1px solid var(--border-color);
    color: var(--text-main); cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.03); transition: 0.2s;
}
.letter-slider button:active { transform: scale(0.95); }
#letterDisplay { font-size: 36px; font-weight: 800; width: 60px; text-align: center; }

#digitInput {
    width: 100%; height: 60px; border-radius: 16px;
    background: var(--input-bg); border: 2px solid var(--border-color);
    color: var(--text-main); text-align: center; font-size: 32px; font-weight: 800;
    letter-spacing: 15px; outline: none; transition: 0.2s; font-family: 'Inter', sans-serif;
}
#digitInput:focus { border-color: var(--accent); }

.btn-masuk {
    width: 100%; padding: 18px; border-radius: 30px; font-size: 16px; font-weight: 700;
    background: var(--primary); color: #fff; border: none; cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 129, 0.3); transition: 0.2s; margin-top: 10px;
}
.btn-masuk:active { transform: scale(0.97); }

/* =========================================
   4. CHAT PAGE
========================================== */
.chat-page { height: 100dvh; display: flex; flex-direction: column; }
.header-bar {
    height: 60px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; background: var(--panel-bg); border-bottom: 1px solid var(--border-color); z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.room-title-chat { font-size: 18px; font-weight: 700; }
.online-indicator {
    background: rgba(46, 204, 113, 0.15); color: #2ecc71; padding: 4px 10px;
    border-radius: 20px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 4px; cursor: pointer; border: none;
}
.exit-btn {
    width: 38px; height: 38px; background: rgba(255, 71, 87, 0.1); border: none;
    color: #ff4757; font-weight: 700; font-size: 15px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
}

.container { flex: 1; display: flex; overflow: hidden; position: relative; }
.users {
    width: 220px; background: var(--panel-bg); border-right: 1px solid var(--border-color);
    padding: 15px; overflow-y: auto; transition: 0.3s;
}
@media(max-width:768px) {
    .users { position: absolute; left: -220px; top: 0; bottom: 0; z-index: 100; box-shadow: 4px 0 15px rgba(0,0,0,0.1); }
    .users.show { left: 0; }
}
.chat-wrap { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.chat-log { flex: 1; padding: 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; z-index: 1; }
.timer-watermark {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 15vw; font-weight: 900; color: var(--text-main); opacity: 0.03;
    pointer-events: none; z-index: 0; user-select: none;
}

/* =========================================
   5. CHAT BUBBLES & MEDIA BUTTONS
========================================== */
.msg-row { display: flex; width: 100%; }
.msg-row.me { justify-content: flex-end; }
.msg-row.other { justify-content: flex-start; }
.msg-bubble {
    max-width: 75%; padding: 12px 16px; font-size: 15px; word-wrap: break-word; line-height: 1.4;
    position: relative; user-select: none; box-shadow: 0 2px 5px rgba(0,0,0,0.03); cursor: pointer;
}
.msg-row.me .msg-bubble { background: var(--bubble-me); color: var(--bubble-me-text); border-radius: 20px 20px 4px 20px; }
.msg-row.other .msg-bubble { background: var(--bubble-other); color: var(--bubble-other-text); border-radius: 20px 20px 20px 4px; }

.user-name-label { font-size: 11px; opacity: 0.8; font-weight: 700; display: block; margin-bottom: 4px; }
.msg.system { align-self: center; background: var(--border-color); color: var(--text-main); font-size: 11px; padding: 4px 12px; border-radius: 20px; opacity: 0.7; margin: 10px 0; }

.quoted-message {
    background: rgba(0,0,0,0.1); border-left: 4px solid rgba(255,255,255,0.5);
    padding: 6px 10px; border-radius: 6px; margin-bottom: 6px; font-size: 13px;
}
.msg-row.other .quoted-message { background: rgba(0,0,0,0.05); border-left: 4px solid var(--accent); }
.quoted-user { font-weight: 700; margin-bottom: 2px; }
.quoted-text { opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Desain Modern Tombol Media (Voice/Video/Foto) */
.media-btn {
    background: rgba(255,255,255,0.25); border: 1px solid rgba(255,255,255,0.4);
    color: inherit; padding: 10px 16px; border-radius: 12px;
    font-size: 14px; font-weight: 700; cursor: pointer; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.msg-row.me .media-btn:hover { background: rgba(255,255,255,0.35); }
.msg-row.other .media-btn { background: var(--primary); color: white; border: none; }
.msg-row.other .media-btn:hover { filter: brightness(1.1); }
.media-btn:active { transform: scale(0.95); }

/* Tampilan Hangus Seragam */
.media-expired {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 600;
    background: rgba(150, 150, 150, 0.1); color: var(--text-muted);
    border: 1px dashed var(--border-color); width: 100%;
}

/* =========================================
   6. INPUT AREA & FLOATING ACTION BUTTON
========================================== */
.chat-input {
    padding: 10px 16px 20px 16px; background: var(--bg-color);
    display: flex; align-items: flex-end; gap: 10px; position: relative; border-top: 1px solid var(--border-color);
}

.input-pill {
    flex: 1; display: flex; align-items: center; background: var(--panel-bg);
    border: 1px solid var(--border-color); border-radius: 24px; padding: 4px 4px 4px 16px;
}
.input-pill input {
    flex: 1; border: none; background: transparent; color: var(--text-main);
    font-size: 15px; padding: 10px 5px; outline: none; font-family: 'Inter', sans-serif;
}
.send-btn {
    width: 40px; height: 40px; border-radius: 50%; background: var(--accent); border: none;
    color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s;
}
.send-btn:active { transform: scale(0.9); }
.send-btn svg { stroke: white; }

/* FAB (Path Style) */
.fab-container { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; margin-bottom: 4px;}
.fab-main {
    width: 42px; height: 42px; border-radius: 50%; background: var(--panel-bg);
    border: 1px solid var(--border-color); color: var(--text-muted); font-size: 24px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: 0.3s; box-shadow: 0 2px 8px rgba(0,0,0,0.05); line-height: 1;
}
.fab-main.active { transform: rotate(45deg); background: var(--primary); color: white; border-color: var(--primary); }
.fab-menu {
    position: absolute; bottom: 55px; left: 0; display: flex; flex-direction: column; gap: 12px;
    opacity: 0; visibility: hidden; transform: translateY(20px); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 20;
}
.fab-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }

.cam-icon {
    width: 44px !important; height: 44px !important; border-radius: 50% !important;
    background: var(--panel-bg) !important; border: 1px solid var(--border-color) !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    cursor: pointer !important; padding: 0 !important; box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
}
.cam-icon svg { width: 20px; height: 20px; stroke: var(--text-main); fill: none; stroke-width: 2; }
.cam-icon:hover { background: var(--primary) !important; border-color: var(--primary) !important; color: white !important;}
.cam-icon:hover svg { stroke: white; }

/* Mic Active Pulse Animation */
@keyframes pulseRecord { 0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); } }
.mic-recording { animation: pulseRecord 1.5s infinite !important; background: var(--primary) !important; border-color: var(--primary) !important;}
.mic-recording svg { stroke: white !important; }

/* =========================================
   7. MODALS & EXTRAS
========================================== */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: none; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(5px);}
.modal.show { display: flex; }
.modal-box { background: var(--panel-bg); color: var(--text-main); width: 90%; max-width: 400px; border-radius: 20px; padding: 24px; text-align: center; animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close { margin-top: 20px; width: 100%; padding: 14px; border: none; border-radius: 12px; background: var(--border-color); color: var(--text-main); font-weight: 600; cursor: pointer; }

/* Reply Bar */
.reply-preview-bar {
    position: absolute; bottom: 100%; left: 0; width: 100%; background: var(--panel-bg);
    padding: 10px 16px; display: none; border-left: 4px solid var(--accent); z-index: 10;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.03); justify-content: space-between; align-items: center;
}
.reply-preview-bar.active { display: flex; animation: slideUp 0.2s ease; }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.reply-info { font-size: 13px; overflow: hidden; }
.reply-info strong { color: var(--accent); display: block; }
.close-reply { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; }

/* Video Circle Player */
#videoPreviewModal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); z-index: 10001; align-items: center; justify-content: center; flex-direction: column; }
.video-circle-container { position: relative; width: 200px; height: 200px; border-radius: 50%; overflow: hidden; border: 4px solid var(--primary); background: #000; margin-bottom: 20px; }
.video-circle-container video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.video-countdown-text { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.6); color: white; padding: 4px 12px; border-radius: 12px; font-weight: bold; }
.stop-record-btn { background: var(--primary); color: white; border: none; padding: 14px 30px; border-radius: 30px; font-weight: bold; cursor: pointer; }

.pill-btn {
    height: 44px; padding: 0 16px; border-radius: 22px;
    background: var(--panel-bg); border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    color: var(--text-main); font-size: 14px; font-weight: 600;
    transition: 0.2s; font-family: 'Inter', sans-serif;
}
.pill-btn:active { transform: scale(0.95); }
.pill-btn:hover { background: var(--border-color); }