/* =========================
   GLOBAL VARIABLES
========================= */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #06b6d4;
  --danger: #ef4444;
  --danger-hover: #dc2626;

  --bg-dark: #0f172a;
  --bg-gradient: linear-gradient(135deg, #1e3a8a, #1e40af, #2563eb);
  --card-gradient: linear-gradient(145deg, #1e40af, #1e3a8a);

  --text-light: #f9fafb;
  --text-muted: #94a3b8;
}

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

body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(
    180deg,
    #0f172a 0%,
    #2563eb 20%,
    #0f172a 40%,
    #2563eb 60%,
    #1e3a8a 80%,
    #60a5fa 100%
  );
  color: var(--text-light);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease, background 0.3s ease;
}

section {
  padding: 60px 20px;
}

/* =========================
   HEADER
========================= */
header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); /* fallback */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: backdrop-filter 0.3s ease;
}

header:hover {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.3s ease;
  margin-right: auto;
}

header .brand:hover {
  transform: scale(1.05);
}

header .brand img {
  width: 4vw;                 /* tương tự coin-icon / button height */
  height: 4vw;                /* đồng bộ với width */
  border-radius: 1vw;          /* giống button / credit-box */
  padding: 0.4vw;                /* tương tự padding button */
  background: linear-gradient(145deg, #1e293b, #0f172a);
  box-shadow: 0 0.5vw 1vw rgba(0,0,0,0.6); /* tương tự button shadow */
  border: 2px solid rgba(255,255,255,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}


header .brand img:hover {
  transform: rotate(-5deg) scale(1.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.7);
}

header .brand span {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: text-shadow 0.3s ease;
}

/* =========================
   USER INFO
========================= */
.user-info {
  display: flex;
  margin-left: auto;
  align-items: center;
  gap: 20px;
  font-size: 15px;
}

.hi-user {
  font-size: 16px;
  color: #e2e8f0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hi-text {
  color: #38bdf8;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  transition: text-shadow 0.3s ease;
}

.hi-text:hover {
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

/* =========================
   CREDIT BOX
========================= */
.credit-box {
  display: flex;
  align-items: center;
  gap: 1.5vw;                               /* tương tự padding horizontal button */
  background: linear-gradient(135deg, #facc15, #fbbf24);
  color: #1e293b;
  padding: 1vw 2vw;                          /* giống button */
  border-radius: 1vw;                         /* giống button */
  font-weight: 700;
  font-size: 0.8vw;                           /* giống button */
  transition: all 0.25s ease;                 /* giống button */
  box-shadow: 0 0.5vw 1vw rgba(250,204,21,0.45); /* tương tự button */
  cursor: pointer;
}

.credit-box:hover {
  transform: translateY(-2px) scale(1.03);   /* giống button */
  box-shadow: 0 0.6vw 1.2vw rgba(250,204,21,0.55); /* hover shadow */
}

.coin-icon {
  width: 1.25vw;                               /* tương tự font-size để đồng bộ */
  height: 1.25vw;
  object-fit: contain;
}



/* =========================
   BUTTONS
========================= */
.btn-login, .btn-logout {
  padding: 1vw 2vw;       /* padding thay đổi theo width màn hình */
  border-radius: 0.8vw;
  font-size: 0.9vw;        /* font-size thay đổi theo màn hình */
  box-shadow: 0 0.5vw 1vw rgba(0,0,0,0.3);
  font-weight:700; /* chữ đậm hơn */
}

.btn-login {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.btn-login:hover {
  background: linear-gradient(90deg, #1e40af, #0ea5e9);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 16px rgba(37,99,235,0.5);
}

.btn-logout {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.btn-logout:hover {
  background: linear-gradient(90deg, #dc2626, #f87171);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 16px rgba(239,68,68,0.5);
}

/* =========================
   NAV LINKS
========================= */
.nav-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.nav-link:hover {
  background: rgba(99,102,241,0.15);
  color: var(--text-light);
}

.nav-link.login {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(99,102,241,0.5);
}

.nav-link.logout {
  background: linear-gradient(90deg, var(--danger), #f87171);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(239,68,68,0.45);
}

/* =========================
   MODAL + FORM
========================= */
.modal-content {
  border-radius: 18px;
  background: #1e293b;
  color: var(--text-light);
  box-shadow: 0 10px 28px rgba(0,0,0,0.6);
}

.modal-header {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: #fff;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.form-control {
  background: #f9fafb;
  border-radius: 12px;
}

/* =========================
   GOOGLE LOGIN BUTTON
========================= */
.google-btn {
  background-color: #fff !important;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  color: #3c4043 !important;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  padding: 8px 12px;
}

.google-btn img {
  margin-right: 8px;
}

.google-btn:hover {
  background-color: #f7f8f8;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

.google-btn:active {
  background-color: #f1f3f4;
}

.google-btn span {
  flex: 1;
  text-align: center;
}

/* =========================
   SPINNER
========================= */
#spinner {
  position: fixed;
  top:0; left:0;
  width:100%; height:100%;
  background: rgba(255,255,255,0.7);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:9999;
}

.loader {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   MOBILE ADJUSTMENTS
========================= */
@media screen and (max-width: 768px) { /* màn hình nhỏ hơn 768px */
  
  /* Credit box */
  .credit-box {
    padding: 2vw 3vw;        /* tăng padding */
    font-size: 1.5vw !important;
    gap: 2vw;                /* khoảng cách icon */
  }

  .coin-icon {
    width: 3vw;              /* tăng kích thước icon */
    height: 3vw;
  }

  /* Buttons */
  .btn-login, .btn-logout {
    padding: 2vw 3vw;        /* tăng padding */
    font-size: 1.5vw !important;
    border-radius: 1.5vw;    /* hơi tròn hơn */
    box-shadow: 0 0.7vw 1.2vw rgba(0,0,0,0.3);
  }

  /* Logo */
  header .brand img {
    width: 8vw !important;   /* tăng kích thước */
    height: 8vw!important; 
    border-radius: 1.5vw;
    padding: 0.5vw;
    box-shadow: 0 0.7vw 1.2vw rgba(0,0,0,0.6);
  }
}
