@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-gradient: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  --surface-bg: rgba(255, 255, 255, 0.85);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --border-color: rgba(255, 255, 255, 0.4);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.cssc {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  padding: 30px 0;
  text-align: center;
}

.header p {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(to right, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.columns {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.post_content {
  background: var(--surface-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 1000px; /* Tăng kích thước khung chứa cho phần Admin */
  box-sizing: border-box;
  animation: fadeIn 0.5s ease-out;
}

/* Forms styling */
form.ajax {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

form.ajax span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: -10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

form.ajax input[type="text"],
form.ajax input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background-color: rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
}

form.ajax input[type="text"]:focus,
form.ajax input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

form.ajax input[type="submit"] {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin-top: 10px;
}

form.ajax input[type="submit"]:hover {
  background-color: var(--primary-hover);
}

form.ajax input[type="submit"]:active {
  transform: translateY(1px);
}

/* Links */
.link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Auth links container */
div[style*="width: 320px"] > span {
  display: block;
  margin-top: 15px;
  text-align: center;
}

#msg {
  text-align: center;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: #dc2626; /* Error red */
  min-height: 20px;
}

/* Footer */
.footer {
  padding: 20px 0;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

/* Override inline styles from PHP */
div[style*="width: 320px"] {
  width: 100% !important;
  max-width: 360px !important; /* Giữ cho khung form login nhỏ gọn */
  margin: 0 auto !important;
  padding: 0 !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================================
   ADMIN MENU STYLING
   ================================== */
ul.menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

ul.menu > li.menu-item {
  position: relative;
}

ul.menu > li.menu-item > a {
  display: block;
  padding: 16px 24px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
}

ul.menu > li.menu-item > a:hover {
  color: var(--primary-color);
  background: rgba(79, 70, 229, 0.05);
}

/* Sub-menu styling */
ul.sub-menu {
  list-style: none;
  padding: 10px 0;
  margin: 0;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

/* Hover over parent li to show sub-menu */
ul.menu > li.menu-item:hover > ul.sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

ul.sub-menu > li.menu-item > a {
  display: block;
  padding: 12px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

ul.sub-menu > li.menu-item > a:hover {
  color: var(--primary-color);
  background: rgba(79, 70, 229, 0.05);
  padding-left: 28px;
}

/* Add a subtle line under the menu item on hover */
ul.menu > li.menu-item > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary-color);
  transition: width 0.3s ease;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}

ul.menu > li.menu-item:hover > a::after {
  width: calc(100% - 32px); /* Leaves some padding on the sides */
}

/* =============================
RESPONSIVE CHO MOBILE
============================= */
@media screen and (max-width: 768px) {
  .container {
    padding: 0 2px !important;
  }
  .columns {
    padding: 10px 0 !important;
  }
  .post_content {
    padding: 15px 10px !important;
    border-radius: 12px;
  }
  /* Ép tất cả các div bên trong có inline-style cứng width: 320px hoặc 500px về 100% */
  .post_content div[style*="width"],
  #result div[style*="width"],
  #result div[style*="max-width"] {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  ul.menu {
    flex-direction: column;
    gap: 5px;
    padding: 10px;
  }
  ul.menu > li.menu-item > a {
    text-align: center;
    border-radius: 8px;
    padding: 12px;
  }
  ul.menu > li.menu-item > a::after {
    display: none;
  }
}
