/* ==========================================================================
   TECH WITH DAHAM - THE ULTIMATE PORTAL CORE STYLESHEET (INTEGRATED AI BOT)
   ========================================================================== */

/* --- GLOBAL VARIABLES --- */
:root {
    --neon-cyan: #00e5ff;
    --neon-pink: #ff003c;
    --bg-black: #020205;
    --glass: rgba(0, 229, 255, 0.05);
    --twd-panel: rgba(20, 20, 25, 0.95);
    --text-color: #ffffff; /* <-- අකුරු වල පාට සඳහා මේක අලුතෙන් එකතු කලා */
}

/* ඩාර්ක් මෝඩ් එකෙන් ලයිට් මෝඩ් එකට මාරු වෙද්දි Variables වෙනස් වන හැටි */
body.light-theme {
    --bg-black: #f4f5f7;
    --twd-panel: rgba(240, 240, 245, 0.95);
    --text-color: #121212;
}

/* මුළු සයිට් එකේම Background එක සහ Text පාට පාලනය කරන කොටස */
body {
    background-color: var(--bg-black);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- CRT SCANLINE EFFECT --- */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 4px;
    z-index: 5; /* බටන් සහ චැට් බොක්ස් වලට වඩා යටින් තැබීමට z-index එක 9999 සිට 5 දක්වා අඩු කලා */
    pointer-events: none;
    opacity: 0.3;
}

/* --- HERO & GLITCH EFFECTS --- */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

.hero-title-container {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.glitch {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(2.5rem, 10vw, 5.5rem);
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    letter-spacing: 12px;
    position: relative;
    display: inline-block;
    text-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--neon-cyan);
    clip: rect(44px, 450px, 56px, 0);
    animation: subtle-glitch-1 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 var(--neon-pink);
    clip: rect(44px, 450px, 56px, 0);
    animation: subtle-glitch-2 5s infinite linear alternate-reverse;
}

@keyframes subtle-glitch-1 {
    0%, 20%, 40%, 60%, 70%, 90% { clip: rect(0, 0, 0, 0); opacity: 0; }
    21%, 41%, 61%, 81% { clip: rect(10px, 9999px, 85px, 0); opacity: 1; transform: translateX(-2px); }
    25%, 45%, 65%, 85% { clip: rect(30px, 9999px, 50px, 0); opacity: 1; transform: translateX(2px); }
}

@keyframes subtle-glitch-2 {
    0%, 20%, 40%, 60%, 70%, 90% { clip: rect(0, 0, 0, 0); opacity: 0; }
    22%, 42%, 62%, 82% { clip: rect(40px, 9999px, 20px, 0); opacity: 1; transform: translateX(2px); }
    26%, 46%, 66%, 86% { clip: rect(70px, 9999px, 90px, 0); opacity: 1; transform: translateX(-2px); }
}

/* --- VIDEO SLIDER --- */
.cyber-video-slider {
    margin-top: -60px !important; 
    margin-bottom: 20px;
    width: 80%;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 10;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}


/* ========================================== */
/* UPGRADED: TECH WITH DAHAM ULTIMATE BOT     */
/* ========================================== */

#twd-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    /* මවුස් එක සාමාන්‍ය විදිහට උඩින් යන්න z-index එක හැමදේටම පෙනෙන ගාණකට සකස් කලා */
    z-index: 999; 
    font-family: 'Share Tech Mono', monospace;
}

/* Floating Action Button */
#twd-chat-btn {
    background: var(--twd-panel);
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    width: 65px;
    height: 65px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#twd-chat-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 0 30px var(--neon-cyan);
    background: var(--neon-cyan);
    color: #000;
}

/* Glassmorphism Chat Box */
#twd-chat-box {
    display: none;
    width: 380px;
    height: 550px;
    background: rgba(2, 2, 5, 0.9);
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.8), 0 0 20px rgba(0, 229, 255, 0.1);
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 229, 255, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform-origin: bottom right;
    animation: twdPopUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes twdPopUp {
    0% { transform: scale(0.5) translateY(50px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Chat Header */
.twd-chat-header {
    background: rgba(0, 0, 0, 0.75);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
}

.twd-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.twd-bot-info {
    display: flex;
    flex-direction: column;
}

.twd-bot-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 0 5px var(--neon-cyan);
}

.twd-bot-status {
    color: #888;
    font-size: 11px;
}

/* Live Animated Pulse Dot */
.twd-online-dot {
    width: 12px;
    height: 12px;
    background-color: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff00;
    animation: twdPulse 2s infinite;
}

@keyframes twdPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(0, 255, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0); }
}

.twd-close-btn {
    cursor: pointer;
    color: #aaa;
    font-size: 22px;
    transition: 0.3s;
    display: flex;
    line-height: 1;
}

.twd-close-btn:hover {
    color: var(--neon-pink);
    transform: scale(1.2);
}

/* Messages Streaming Container */
#twd-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

#twd-chat-messages::-webkit-scrollbar { width: 5px; }
#twd-chat-messages::-webkit-scrollbar-track { background: transparent; }
#twd-chat-messages::-webkit-scrollbar-thumb { background: rgba(0, 229, 255, 0.3); border-radius: 10px; }

.twd-msg-container {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: twdFadeIn 0.3s ease;
}

@keyframes twdFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.twd-msg {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Advanced Response Formatting Rules */
.twd-msg strong { color: var(--neon-cyan); text-shadow: 0 0 3px rgba(0, 229, 255, 0.5); }
.twd-msg code { background: #000; padding: 2px 6px; border-radius: 4px; color: var(--neon-pink); font-family: monospace; border: 1px solid rgba(255, 0, 60, 0.2); }
.twd-time { font-size: 10px; color: #555; margin-top: 5px; }

/* Bot Grid layout */
.twd-bot-container { align-self: flex-start; }
.twd-bot-msg {
    background: rgba(20, 20, 25, 0.8);
    color: #e0e0e0;
    border-left: 3px solid var(--neon-cyan);
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    border-top-left-radius: 4px;
}
.twd-bot-container .twd-time { align-self: flex-start; margin-left: 5px; }

/* User Grid layout */
.twd-user-container { align-self: flex-end; align-items: flex-end; }
.twd-user-msg {
    background: rgba(0, 229, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    border-top-right-radius: 4px;
}

/* System Input Area */
.twd-chat-input-area {
    display: flex;
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    gap: 12px;
}

#twd-chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    outline: none;
    font-size: 14px;
    transition: 0.3s;
}

#twd-chat-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

#twd-send-btn {
    background: rgba(0, 229, 255, 0.1);
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
    border-radius: 8px;
    width: 46px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
}

#twd-send-btn:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--neon-cyan);
}

/* Cyber Terminal Typing Indicator */
.twd-typing-indicator {
    padding: 12px 16px;
    display: flex;
    gap: 6px;
    background: rgba(20, 20, 25, 0.8);
    border-left: 3px solid var(--neon-cyan);
    width: max-content;
    margin-left: 20px;
    margin-bottom: 10px;
    border-radius: 12px;
}

.twd-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--neon-cyan);
    border-radius: 50%;
    animation: twdTypingBounce 1.4s infinite ease-in-out both;
}

.twd-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.twd-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes twdTypingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Mobile Responsive Optimization */
@media (max-width: 480px) {
    #twd-chat-widget { bottom: 15px; right: 15px; }
    #twd-chat-box { width: calc(100vw - 30px); height: 75vh; }
}

/* ========================================== */
/* 10. POWER ABSORPTION LOGO EFFECTS (SUPER CLEAN) */
/* ========================================== */
.power-logo-container {
    position: relative;
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none !important; 
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    overflow: hidden;
    margin-top: 50px;
}

#powerCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: transparent !important;
}

.power-logo {
    position: relative;
    z-index: 2;
    width: 180px; 
    animation: absorb-pulse 2s infinite alternate ease-in-out; 
}

@keyframes absorb-pulse {
    0% { 
        filter: drop-shadow(0 0 15px var(--neon-pink)); 
        transform: scale(0.92); 
    }
    100% { 
        filter: drop-shadow(0 0 40px var(--neon-cyan)); 
        transform: scale(1.08); 
    }
}

/* ========================================== */
/* LIGHT / DARK MODE TOGGLE BUTTON STYLE      */
/* ========================================== */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    background: var(--twd-panel);
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
    font-family: 'Share Tech Mono', monospace;
    border-radius: 4px;
    cursor: pointer;
    z-index: 10000; /* කර්සර් එක උඩින් වැඩ කිරීමටත්, අනෙක් ඒවාට නොවැසීමටත් z-index එක 998 ලෙස වෙනස් කලා */
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    transition: 0.3s ease;
}
.scroll-top-btn {
  display: none; /* මුලින් මේක පේන්නේ නෑ */
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  border: none;
  outline: none;
  background-color: #ff5722;
  color: white;
  cursor: pointer;
  padding: 15px;
  border-radius: 50%; /* රවුම් හැඩයක් දෙන්න */
  font-size: 18px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
}

.scroll-top-btn:hover {
  background-color: #e64a19;
}

.dark-mode-toggle:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--neon-cyan);
}
