/* Font Face */
@font-face {
  font-family: "Gia";
  src: url("../font/gia.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* Reset và Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #000;
  color: #fff;
  font-family: "Poppins", sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Header Styles */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1001;
  width: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 204, 0, 0.25);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo {
  height: 44px;
  width: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.nav {
  display: flex;
  align-items: center;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-item {
  display: inline-flex;
}

.btn-primary {
  display: inline-block;
  padding: 10px 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 204, 0, 0.25),
    rgba(255, 204, 0, 0.15)
  );
  border: 1px solid rgba(255, 204, 0, 0.5);
  border-radius: 10px;
  color: #ffcc00;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 204, 0, 0.25);
  background: linear-gradient(
    180deg,
    rgba(255, 204, 0, 0.35),
    rgba(255, 204, 0, 0.2)
  );
}

/* Container to keep content centered and above video */
.content {
  position: relative;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 16px;
}

/* Center only the main content vertically */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

footer {
  margin-top: 24px;
}

/* Layout places chat aside on desktop, below on mobile */
.layout {
  display: flex;
  gap: 24px;
  width: 100%;
  flex-direction: column; /* chat luôn bên dưới */
}

.chat {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(2px);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.chat h3 {
  margin: 0 0 12px 0;
  color: #ffcc00;
}

.chat-messages {
  overflow: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Polished scrollbar for chat list */
.chat-messages {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.08);
}
.chat-messages::-webkit-scrollbar {
  width: 10px;
}
.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 204, 0, 0.9),
    rgba(0, 255, 174, 0.9)
  );
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.25);
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 204, 0, 1),
    rgba(0, 255, 174, 1)
  );
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  opacity: 1;
  margin-bottom: 2px;
}
.chat-item-name {
  font-weight: 800;
  font-size: 1.08rem;
}
.chat-item-time {
  font-size: 0.8rem;
  opacity: 0.65;
}
.chat-item-content {
  margin-top: 2px;
  text-align: left;
}

.chat-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.chat-form input,
.chat-form textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}
.chat-form button {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: #00ffae;
  color: #000;
  font-weight: 700;
  cursor: pointer;
}
.chat-status {
  font-size: 0.85rem;
  opacity: 0.8;
  min-height: 1em;
}

/* Emoji picker */

/* Responsive */
@media (min-width: 992px) {
  .layout {
    flex-direction: column;
  }
  .layout .main-col {
    flex: none;
  }
  .layout .chat {
    width: 100%;
  }
}
@media (max-width: 991.98px) {
  .layout {
    flex-direction: column;
  }
  .chat {
    width: 100%;
  }
}

/* Full-screen background video */
.bg-video {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0; /* dưới nội dung, trên nền body */
  pointer-events: none;
  filter: brightness(0.6);
}

/* Bảo đảm nội dung nổi trên video */
main,
footer {
  position: relative;
  z-index: 1;
}

/* Typography */
h1 {
  font-family: "Gia", "Poppins", sans-serif;
  font-size: 2.5rem;
  color: #ffcc00;
  margin-bottom: 20px;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h2 {
  font-family: "Gia", "Poppins", sans-serif;
  font-size: 1.5rem;
  color: #fff;
  font-weight: 400;
  margin-bottom: 30px;
}

/* Countdown Styles */
.count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin: 16px auto 0 auto;
}
.count-card {
  background: rgba(255, 255, 255, 0.92);
  color: #222;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
}
.count-value {
  font-family: "Gia", "Poppins", system-ui, -apple-system, sans-serif;
  font-size: 3.2rem;
  font-weight: 700;
  padding: 28px 8px 18px;
}
.count-label {
  font-family: "Gia", "Poppins", system-ui, -apple-system, sans-serif;
  background: #f1f3f5;
  padding: 12px 8px;
  font-weight: 700;
  letter-spacing: 2px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Footer */
footer {
  margin-top: 40px;
  font-size: 0.9rem;
  opacity: 0.7;
  color: #ccc;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
    min-height: 56px;
  }

  .brand-logo {
    height: 40px;
  }

  .btn-primary {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .count-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 520px;
  }
  .count-value {
    font-size: 2.4rem;
    padding: 22px 6px 14px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 10px 12px;
  }

  .brand-logo {
    height: 36px;
  }

  .btn-primary {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1rem;
  }

  .count-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .count-value {
    font-size: 2rem;
  }
}

/* Loading Animation */
.loading {
  opacity: 0.7;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

/* Greeting Card Page Styles */
.greeting-card-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px;
}

.greeting-card-container h1 {
  margin-bottom: 10px;
  text-align: center;
}

.greeting-subtitle {
  text-align: center;
  color: #ccc;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.greeting-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 30px;
}

.greeting-left-panel,
.greeting-right-panel {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.greeting-section {
  margin-bottom: 30px;
}

.greeting-section:last-child {
  margin-bottom: 0;
}

.greeting-section h3 {
  color: #ffcc00;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

/* Template Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.template-item {
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease;
}

.template-item:hover {
  transform: translateY(-2px);
}

.template-item.active .template-preview {
  border: 3px solid #ffcc00;
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4);
}

.template-preview {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.template-red {
  background: linear-gradient(135deg, #c92a2a, #ff6b6b);
}

.template-gold {
  background: linear-gradient(135deg, #f59f00, #ffd43b);
}

.template-blue {
  background: linear-gradient(135deg, #1864ab, #4dabf7);
}

.template-pink {
  background: linear-gradient(135deg, #c2255c, #f783ac);
}

.template-item span {
  display: block;
  margin-top: 8px;
  color: #ccc;
  font-size: 0.9rem;
}

/* Text Controls */
#greeting-text,
.text-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  resize: vertical;
  margin-bottom: 16px;
}

#greeting-text:focus,
.text-input:focus {
  outline: none;
  border-color: #ffcc00;
}

.text-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  color: #fff;
  font-size: 0.9rem;
}

.control-group input[type="range"] {
  width: 100%;
}

.control-group input[type="color"] {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.control-group select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: "Poppins", sans-serif;
}

/* Image Upload */
.btn-secondary,
.btn-danger,
.btn-download {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Poppins", sans-serif;
}

.btn-secondary {
  background: #4dabf7;
  color: #fff;
}

.btn-secondary:hover {
  background: #339af0;
  transform: translateY(-1px);
}

.btn-danger {
  background: #ff6b6b;
  color: #fff;
  margin-top: 12px;
}

.btn-danger:hover {
  background: #ff5252;
}

.btn-download {
  background: linear-gradient(135deg, #ffcc00, #ffd43b);
  color: #000;
  font-size: 1rem;
}

.btn-download:hover {
  background: linear-gradient(135deg, #ffd43b, #ffcc00);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.3);
}

.image-preview {
  margin-top: 12px;
  min-height: 50px;
}

.image-preview img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Preview Section */
.greeting-preview-section {
  position: sticky;
  top: 80px;
}

.greeting-preview-section h3 {
  margin-bottom: 20px;
}

.canvas-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  overflow: hidden;
}

#greeting-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  background: #fff;
}

.preview-actions {
  display: flex;
  gap: 12px;
}

.preview-actions button {
  flex: 1;
}

/* Responsive Design for Greeting Card */
@media (max-width: 992px) {
  .greeting-editor {
    grid-template-columns: 1fr;
  }

  .greeting-preview-section {
    position: static;
  }

  #greeting-canvas {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .template-preview {
    height: 100px;
  }

  .greeting-left-panel,
  .greeting-right-panel {
    padding: 16px;
  }

  .preview-actions {
    flex-direction: column;
  }
}
