/* =========================================================
   GLOBAL VARIABLES — LIGHT/DARK THEME
=========================================================*/

/* DARK THEME (mặc định) */
:root {
  --bg: #0b0e1a;
  --text: #ffffff;
  --text-light: rgba(255,255,255,0.8);
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --highlight: #22d3ee;
  --shadow: rgba(0, 0, 0, 0.45);
}

/* LIGHT THEME */
body.light-theme {
  --bg: #f9f9f9;
  --text: #111827;
  --text-light: rgba(0,0,0,0.7);
  --card: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.1);
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --highlight: #3b82f6;
  --shadow: rgba(0, 0, 0, 0.2);
}

/* =========================================================
   GLOBAL STYLE
=========================================================*/
body {
  font-family: "Segoe UI", Poppins, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3 {
  margin: 0;
  color: var(--text);
}

a {
  text-decoration: none;
  color: var(--accent);
}

img {
  max-width: 100%;
  border-radius: 12px;
}

/* =========================================================
   HEADER
=========================================================*/
header {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  padding: 18px 0;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background 0.3s, border-color 0.3s;
}

header .container {
  max-width: 1200px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* NAVIGATION */
nav a {
  margin: 0 10px;
  padding: 10px 16px;
  border-radius: 6px;
  transition: 0.3s;
  color: var(--text);
}

nav a:hover,
nav .active {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
}

/* =========================================================
   THEME TOGGLE BUTTON
=========================================================*/
.theme-btn {
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  transition: 0.3s;
}

.theme-btn:hover {
  transform: scale(1.15);
}

/* =========================================================
   HERO SECTION
=========================================================*/
.hero {
  text-align: center;
  padding: 50px 20px;
  max-width: 850px;
  margin: auto;
}

.hero .profile {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  box-shadow: 0 10px 30px var(--shadow);
  animation: floatProfile 4s ease-in-out infinite;
}

.hero span {
  color: var(--highlight);
  font-weight: bold;
}

/* =========================================================
   BUTTONS
=========================================================*/
.btn, .btn2, .btn10 {
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  transform: translateY(0);
}

.btn {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
}

.btn:hover {
  background: var(--accent-dark);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}

.btn2 {
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #fff;
  padding: 10px 18px;
}

.btn2:hover {
  background: linear-gradient(135deg, var(--accent-dark), #2563eb);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}

/* =========================================================
   SECTION
=========================================================*/
section {
  margin: 60px auto;
  padding: 40px;
  max-width: 1000px;
  background: linear-gradient(135deg, #111827, #1e1b4b);
  border-radius: 20px;
  box-shadow: 0 10px 30px var(--shadow);
  border: 1px solid var(--card-border);
  transition: background 0.3s, border-color 0.3s;
}

/* LIGHT THEME SECTION OVERRIDE */
body.light-theme section {
  background: #ffffff;
  border: 1px solid var(--card-border);
}

/* =========================================================
   CARDS & PROJECTS
=========================================================*/
.experience-card,
.leadership-card,
.education-card,
.course-card,
.project-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.experience-card:hover,
.leadership-card:hover,
.education-card:hover,
.course-card:hover,
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

/* =========================================================
   FADE-IN ANIMATION
=========================================================*/
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1.2s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in:nth-child(1) { animation-delay: 0.2s; }
.fade-in:nth-child(2) { animation-delay: 0.4s; }
.fade-in:nth-child(3) { animation-delay: 0.6s; }

/* HERO FLOAT */
@keyframes floatProfile {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
  100% { transform: translateY(0px); }
}

/* HERO TEXT ZOOM-IN */
.hero h2, .hero p {
  animation: zoomIn 1s ease forwards;
  opacity: 0;
}

@keyframes zoomIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* =========================================================
   CONTACT FORM
=========================================================*/
.contact-form.card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 35px;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 12px 30px var(--shadow);
  border: 1px solid var(--card-border);
  transition: all 0.3s;
}

.contact-form.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 35px var(--shadow);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--highlight);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--text-light);
}

.contact-form button.btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #ffffff;
}

.contact-form button.btn:hover {
  transform: translateY(-3px);
  background: linear-gradient(135deg, var(--accent-dark), #2563eb);
}

/* =========================================================
   FOOTER
=========================================================*/
footer {
  text-align: center;
  padding: 30px;
  margin-top: 60px;
  color: var(--text-light);
  transition: color 0.3s;
}

/* =========================================================
   RESPONSIVE
=========================================================*/
@media (max-width: 768px) {
  nav { justify-content: center; flex-wrap: wrap; gap: 8px; }
  .hero .profile { width: 140px; height: 140px; }
  section { padding: 25px; }
}

@media (max-width: 600px) {
  .contact-form.card { padding: 30px 20px; }
}

/* SMOOTH SCROLL */
html { scroll-behavior: smooth; }

/* DARK MODE OVERRIDE */
body.dark-mode {
  background: var(--bg);
  color: var(--text);
}

body.dark-mode header {
  background: rgba(255,255,255,0.05);
}

body.dark-mode .btn,
body.dark-mode .btn2 {
  background: var(--accent);
  color: #fff;
}
#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* để không che nút bấm */
  z-index: 9999;
}
/* ===== CHATBOX STYLES ===== */
.chatbox {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 360px;
  max-height: 600px;
  background: #f7f7f7;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', sans-serif;
  overflow: hidden;
  z-index: 9999;
}

.chat-header {
  background: #0652DD;
  color: #fff;
  padding: 12px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.chat-actions {
  display: flex;
  justify-content: space-around;
  padding: 5px;
  background: #ddd;
}

.chat-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
}

.chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: whitesmoke;
}

.chat-message {
  display: flex;
  margin-bottom: 10px;
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  word-wrap: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background: #0652DD;
}

.chat-message.bot {
  align-self: flex-start;
  background: black;
}

.chat-message.typing::after {
  content: '...';
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,50%,100% { opacity: 1; }
  25%,75% { opacity: 0; }
}

.chat-input {
  display: flex;
  padding: 10px;
  gap: 5px;
  background: #f0f0f0;
}

.chat-input input {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid whitesmoke;
}

.chat-input button {
  padding: 0 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #0652DD;
  color: #fff;
}

/* Dark mode */
.chatbox.dark {
  background: black;
  color: #fff;
}

.chatbox.dark .chat-header {
  background: black;
}

.chatbox.dark .chat-messages {
  background: black;
  color: #fff;
}

.chatbox.dark .chat-message.user {
  background: #0652DD;
  color: white;
}

.chatbox.dark .chat-message.bot {
  background: greenyellow;
  color: black;
}

.chatbox.dark .chat-input {
  background: #444;
}

.chatbox.dark .chat-input input {
  background: black;
  color: #fff;
  border: 1px solid #888;
}

.chatbox.dark .chat-actions {
  background: gray;
}

.chatbox.dark .chat-actions button {
  color: #fff;
}

/* Avatars */
.chat-message.user::before { content: "🧑🏼"; margin-right: 6px; }
.chat-message.bot::before { content: "🤖"; margin-right: 6px; }
/* Toggle Chatbox Button */
.toggle-chatbox-btn {
  position: fixed;
  bottom: 30px;
  right: 410px; /* Cách chatbox 50px */
  width: 50px;
  height: 50px;
  border-radius: 70%;
  border: none;
  background: #0652DD;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  z-index: 10000;
  transition: transform 0.2s;
}

.toggle-chatbox-btn:hover {
  transform: scale(1.1);
}
/* Flashing animation for new message */
@keyframes flash {
  0%, 100% { background-color: #0078ff; }
  50% { background-color: #ff3b3b; }
}

.toggle-chatbox-btn.new-message {
  animation: flash 1s infinite;
}

.hidden {
  display: none;
}

.dark-mode {
  background-color: #222;
  color: #eee;
}
/* CSS */
#ai-chatbox {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 330px;
  height: 520px;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid #ccc;
  border-radius: 25px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  z-index: 9999;
}

#ai-chatbox.dark { background: #222; color: #eee; }

#chat-messages { flex: 1; overflow-y: auto; padding: 10px; }
.chat-message { margin-bottom: 5px; }
.chat-message.user { text-align: right; }
.chat-message.bot { text-align: left; }
