/* =============================================
   IkiiCodex - Cyber Liquid Glass iOS 26 Theme
   ============================================= */
:root {
    --bg: #020205;
    --bg-2: #080812;
    --surface: rgba(0, 240, 255, 0.04);
    --surface-2: rgba(255, 0, 127, 0.06);
    --border: rgba(0, 240, 255, 0.12);
    --border-glow: rgba(0, 240, 255, 0.5);
    --primary: #00f0ff;
    --primary-dark: #00b8d4;
    --secondary: #ff007f;
    --success: #00ff41;
    --error: #ff0040;
    --text: #e0f0ff;
    --text-2: #a0c0e0;
    --text-3: #506080;
    --shadow: 0 0 40px rgba(0, 240, 255, 0.15);
    --radius: 18px;
    --radius-sm: 12px;
    --font-mono: 'Space Grotesk', monospace;
    --font-body: 'Inter', sans-serif;
    --glow-primary: 0 0 16px rgba(0, 240, 255, 0.5);
    --glow-secondary: 0 0 16px rgba(255, 0, 127, 0.5);
    --glass-bg: rgba(8, 8, 18, 0.55);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(24px) saturate(160%);
    --glass-blur-light: blur(16px) saturate(140%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    text-shadow: 0 0 2px rgba(0, 240, 255, 0.1);
}

/* Background Layer */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(0, 240, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 240, 255, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
    opacity: 0.7;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
    animation: orbFloat 14s ease-in-out infinite alternate;
}
.orb-1 { width: 500px; height: 500px; background: var(--primary); top: -180px; left: -150px; animation-duration: 16s; }
.orb-2 { width: 450px; height: 450px; background: var(--secondary); bottom: -120px; right: -120px; animation-duration: 12s; animation-delay: -5s; }
.orb-3 { width: 350px; height: 350px; background: var(--primary-dark); top: 50%; left: 50%; transform: translate(-50%, -50%); animation-duration: 20s; animation-delay: -8s; opacity: 0.1; }

@keyframes orbFloat {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(45px, 35px) scale(1.12); }
}

/* Gate Wajib */
.channel-gate {
    position: fixed; inset: 0;
    background: rgba(2, 2, 8, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.channel-gate.hidden { display: none; }
.gate-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px 28px;
    max-width: 420px; width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.05), 0 0 50px rgba(0,240,255,0.15);
    animation: fadeSlide 0.4s ease;
}
.gate-icon { font-size: 64px; margin-bottom: 20px; font-family: var(--font-mono); filter: drop-shadow(0 0 20px var(--primary)); }
.gate-title { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--primary); text-shadow: 0 0 12px var(--primary); margin-bottom: 10px; letter-spacing: 2px; text-transform: uppercase; }
.gate-desc { font-family: var(--font-mono); color: var(--text-2); font-size: 13px; margin-bottom: 28px; line-height: 1.7; letter-spacing: 0.3px; }
.gate-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 16px 24px; border-radius: 16px;
    font-family: var(--font-mono); font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all 0.3s;
    border: 1px solid transparent; text-decoration: none;
    text-transform: uppercase; letter-spacing: 1px;
    background: var(--success); color: #000;
    box-shadow: 0 0 24px rgba(0,255,65,0.5); border-color: rgba(0,255,65,0.3);
}
.gate-btn:hover { background: #00e676; box-shadow: 0 0 35px rgba(0,255,65,0.7); transform: scale(1.02); }
.gate-whatsapp-icon { width: 24px; height: 24px; fill: #fff; }

/* Sidebar */
.sidebar {
    position: fixed; top: 16px; left: 16px; bottom: 16px;
    width: 300px; background: var(--glass-bg);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 200; display: flex; flex-direction: column;
    transform: translateX(-110%); transition: transform 0.4s cubic-bezier(0.22,1,0.36,1);
    margin: 8px;
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 150; opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #000; font-family: var(--font-mono); box-shadow: 0 0 20px var(--primary); }
.sidebar-title { font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 2.5px; color: var(--primary); text-shadow: 0 0 10px var(--primary); }
.sidebar-actions { display: flex; gap: 8px; }

/* Tombol Ikon */
.btn-icon {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 8px; color: var(--primary);
    cursor: pointer; transition: all 0.25s; display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    font-family: var(--font-mono);
}
.btn-icon:hover { background: rgba(0,240,255,0.12); color: #fff; border-color: var(--primary); box-shadow: 0 0 20px var(--primary); transform: translateY(-1px); }

/* Navigasi */
.nav-menu { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px;
    color: var(--text-2); text-decoration: none; transition: all 0.25s;
    font-size: 14px; font-weight: 500; border: 1px solid transparent; font-family: var(--font-mono);
}
.nav-item:hover { background: rgba(0,240,255,0.06); color: var(--primary); border-color: rgba(0,240,255,0.25); }
.nav-item.active { background: rgba(0,240,255,0.1); color: var(--primary); border: 1px solid rgba(0,240,255,0.35); box-shadow: inset 0 0 14px rgba(0,240,255,0.1); }

/* Daftar Riwayat */
.history-list { flex: 1; overflow-y: auto; padding: 12px 16px; list-style: none; }
.history-list li {
    padding: 10px 14px; border-radius: 12px; cursor: pointer; font-size: 13px;
    color: var(--text-2); transition: all 0.25s; margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border: 1px solid transparent; font-family: var(--font-mono);
}
.history-list li:hover { background: rgba(0,240,255,0.05); color: var(--primary); border-color: rgba(0,240,255,0.2); }
.history-list li.active { background: rgba(0,240,255,0.1); color: var(--primary); border: 1px solid rgba(0,240,255,0.3); }
.history-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--text-3); font-family: var(--font-mono); }

/* Header Mengambang */
.header {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    width: calc(100% - 40px); max-width: 800px; padding: 14px 22px;
    background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); border-radius: 22px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 100; display: flex; align-items: center; justify-content: space-between; min-height: 60px;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 38px; height: 38px; border-radius: 12px; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; color: #000; font-family: var(--font-mono); box-shadow: 0 0 22px var(--primary); }
.brand-name { font-family: var(--font-mono); font-size: 18px; font-weight: 600; letter-spacing: 1.5px; color: var(--primary); text-shadow: 0 0 10px var(--primary); text-transform: uppercase; }
.brand-sub { font-size: 11px; color: var(--text-2); font-weight: 400; letter-spacing: 0.8px; font-family: var(--font-mono); }
.header-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); background: rgba(0,255,65,0.06); padding: 8px 14px; border-radius: 20px; border: 1px solid rgba(0,255,65,0.2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-family: var(--font-mono); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px var(--success), 0 0 28px var(--success); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.4; transform:scale(0.75); } }

/* Main Chat */
.main { flex:1; display:flex; flex-direction:column; position:relative; z-index:10; height:100vh; overflow:hidden; padding:0 8px; padding-top:90px; }
.chat-container { flex:1; overflow-y:auto; padding:18px 20px 20px; display:flex; flex-direction:column; gap:14px; scroll-behavior:smooth; padding-bottom:110px; }

/* Pesan */
.message {
    max-width:78%; padding:14px 20px; border-radius:20px; font-size:14.5px; line-height:1.7;
    word-break:break-word; animation:fadeSlide 0.35s ease;
    border:1px solid rgba(255,255,255,0.08); background:rgba(0,240,255,0.04);
    backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(255,255,255,0.04);
    position:relative; transition:all 0.25s ease; font-family:var(--font-body);
}
.message.user { align-self:flex-end; background:rgba(255,0,127,0.08); border-bottom-right-radius:8px; border-color:rgba(255,0,127,0.3); box-shadow:0 8px 32px rgba(255,0,127,0.12), inset 0 0 0 1px rgba(255,255,255,0.04); }
.message.ai { align-self:flex-start; background:rgba(0,240,255,0.04); border-bottom-left-radius:8px; border-color:rgba(0,240,255,0.2); }
.message .meta { font-size:10px; color:var(--text-3); margin-top:8px; display:flex; align-items:center; gap:8px; justify-content:flex-end; font-family:var(--font-mono); }
.message .meta .badge { font-size:10px; font-weight:500; text-transform:uppercase; letter-spacing:0.6px; padding:2px 10px; border-radius:10px; background:rgba(0,240,255,0.08); border:1px solid rgba(0,240,255,0.2); color:var(--primary); text-shadow:0 0 6px var(--primary); font-family:var(--font-mono); }
.message.user .meta .badge { border-color:rgba(255,0,127,0.3); color:var(--secondary); text-shadow:0 0 6px var(--secondary); background:rgba(255,0,127,0.08); }
.message .content { white-space:pre-wrap; padding-right:12px; }
.message .content pre { background:rgba(0,0,0,0.5); border-radius:12px; padding:12px 16px; margin:8px 0; overflow-x:auto; font-size:13px; border-left:3px solid var(--primary); font-family:'Courier New',monospace; box-shadow:inset 0 0 16px rgba(0,240,255,0.08); }
.message .content code { background:rgba(0,240,255,0.1); padding:3px 8px; border-radius:6px; font-size:13px; font-family:'Courier New',monospace; color:var(--primary); text-shadow:0 0 4px var(--primary); }

/* Tombol Salin */
.copy-btn {
    position:absolute; top:10px; right:10px; background:rgba(255,255,255,0.04);
    backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    border:1px solid rgba(255,255,255,0.1); border-radius:14px; padding:6px 12px;
    font-size:11px; font-weight:500; color:var(--primary); cursor:pointer;
    display:flex; align-items:center; gap:5px; transition:all 0.25s ease; z-index:5;
    opacity:0; transform:translateY(-6px); pointer-events:none;
    text-shadow:0 0 6px var(--primary); box-shadow:0 0 12px rgba(0,240,255,0.15);
    font-family:var(--font-mono);
}
.message:hover .copy-btn, .copy-btn.copied { opacity:1; transform:translateY(0); pointer-events:auto; }
.copy-btn:hover { background:rgba(0,240,255,0.15); border-color:var(--primary); box-shadow:0 0 22px var(--primary); }
.copy-btn.copied { background:rgba(0,255,65,0.12); border-color:var(--success); color:var(--success); text-shadow:0 0 6px var(--success); box-shadow:0 0 20px var(--success); }
.copy-btn svg { width:13px; height:13px; }

@keyframes fadeSlide { 0%{opacity:0;transform:translateY(8px);} 100%{opacity:1;transform:translateY(0);} }

/* Indikator Mengetik */
.typing-indicator {
    position:fixed; bottom:100px; left:50%; transform:translateX(-50%);
    padding:8px 20px; border-radius:20px; background:rgba(0,240,255,0.08);
    backdrop-filter:blur(18px) saturate(180%); -webkit-backdrop-filter:blur(18px) saturate(180%);
    border:1px solid rgba(0,240,255,0.25); display:none; gap:10px; align-items:center;
    color:var(--primary); font-size:13px; box-shadow:0 8px 30px rgba(0,0,0,0.4), 0 0 20px rgba(0,240,255,0.2);
    z-index:110; white-space:nowrap; text-shadow:0 0 6px var(--primary); font-family:var(--font-mono);
}
.typing-indicator.show { display:flex; }
.typing-indicator .dots { display:flex; gap:5px; }
.typing-indicator .dots span { display:inline-block; width:8px; height:8px; background:var(--primary); border-radius:50%; animation:bounce-dot 1.4s infinite ease-in-out; box-shadow:0 0 8px var(--primary); }
.typing-indicator .dots span:nth-child(2) { animation-delay:0.2s; }
.typing-indicator .dots span:nth-child(3) { animation-delay:0.4s; }
@keyframes bounce-dot { 0%,80%,100%{transform:scale(0.6);opacity:0.3;} 40%{transform:scale(1);opacity:1;} }

/* Input Area Mengambang */
.input-area {
    position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
    width:calc(100% - 48px); max-width:800px; padding:10px 14px;
    background:rgba(8,8,20,0.65); backdrop-filter:blur(28px) saturate(190%); -webkit-backdrop-filter:blur(28px) saturate(190%);
    border:1px solid rgba(255,255,255,0.1); border-radius:24px; display:flex; gap:10px; align-items:flex-end;
    box-shadow:0 20px 50px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06), 0 0 40px rgba(0,240,255,0.12);
    z-index:100; transition:all 0.3s ease;
}
.input-area:focus-within { box-shadow:0 20px 50px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,240,255,0.3), 0 0 60px rgba(0,240,255,0.25); border-color:rgba(0,240,255,0.4); }
.input-wrapper { flex:1; background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.06); border-radius:18px; padding:8px 16px; display:flex; align-items:flex-end; gap:8px; transition:all 0.3s; box-shadow:inset 0 0 14px rgba(0,240,255,0.04); }
.input-wrapper:focus-within { border-color:rgba(0,240,255,0.3); box-shadow:inset 0 0 20px rgba(0,240,255,0.08), 0 0 20px rgba(0,240,255,0.1); }
.input-wrapper textarea { flex:1; background:transparent; border:none; outline:none; color:var(--text); font-family:var(--font-mono); font-size:14px; resize:none; min-height:24px; max-height:130px; line-height:1.6; padding:8px 0; text-shadow:0 0 3px rgba(0,240,255,0.15); }
.input-wrapper textarea::placeholder { color:var(--text-3); }
.input-wrapper .char-count { font-size:11px; color:var(--text-3); padding:4px 0; flex-shrink:0; font-family:var(--font-mono); }
.input-area .send-btn { background:var(--primary); border:none; border-radius:16px; padding:12px 18px; font-family:var(--font-mono); font-weight:600; font-size:14px; color:#000; cursor:pointer; transition:all 0.3s; height:46px; display:flex; align-items:center; gap:6px; flex-shrink:0; box-shadow:0 0 24px var(--primary), 0 0 48px rgba(0,240,255,0.4); text-transform:uppercase; letter-spacing:1px; }
.input-area .send-btn:hover { background:#fff; box-shadow:0 0 35px var(--primary), 0 0 70px var(--primary); transform:scale(1.03); }
.input-area .send-btn:active { transform:scale(0.95); }
.input-area .send-btn:disabled { opacity:0.4; pointer-events:none; box-shadow:0 0 8px var(--primary); }
.input-area .send-btn svg { width:17px; height:17px; }

/* Scrollbar */
.chat-container::-webkit-scrollbar, .history-list::-webkit-scrollbar { width:4px; }
.chat-container::-webkit-scrollbar-track, .history-list::-webkit-scrollbar-track { background:transparent; }
.chat-container::-webkit-scrollbar-thumb, .history-list::-webkit-scrollbar-thumb { background:var(--primary); border-radius:4px; box-shadow:0 0 8px var(--primary); }

/* Responsive */
@media (max-width:720px) {
    .sidebar { width:280px; top:10px; left:10px; bottom:10px; border-radius:20px; }
    .header { width:calc(100% - 20px); top:10px; padding:10px 14px; border-radius:18px; }
    .brand-name { font-size:15px; } .brand-sub { font-size:10px; }
    .main { padding-top:80px; }
    .chat-container { padding:14px 14px 110px; }
    .message { max-width:90%; font-size:14px; padding:12px 16px; border-radius:16px; }
    .input-area { width:calc(100% - 24px); padding:8px 10px; gap:8px; border-radius:20px; bottom:16px; }
    .typing-indicator { bottom:90px; }
    .input-wrapper { padding:6px 12px; border-radius:14px; }
    .input-area .send-btn { padding:8px 14px; font-size:12px; height:40px; border-radius:12px; }
}