:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #ec4899;
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --bg-main: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
  
  --radius-sm: 0.75rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-xl: 2rem;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3, .subtitle, button {
  font-family: 'Outfit', sans-serif;
}

/* Noise Texture Overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("https://grainy-gradients.vercel.app/noise.svg");
  opacity: 0.05;
  pointer-events: none;
  z-index: 50;
}

/* Background Blobs */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  width: min(80vw, 600px);
  height: min(80vw, 600px);
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 20s infinite alternate ease-in-out;
}

@keyframes float {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  33% { transform: translate(10%, 10%) rotate(120deg) scale(1.1); }
  66% { transform: translate(-5%, 15%) rotate(240deg) scale(0.9); }
  100% { transform: translate(0, 0) rotate(360deg) scale(1); }
}

.blob-1 {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 30%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
  animation-delay: -10s;
  opacity: 0.1;
}

/* Layout Containers */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  width: 100%;
}

@media (max-width: 1024px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
  
  .image-side {
    display: none;
  }
}

.container {
  width: 100%;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

@media (max-width: 480px) {
  .container {
    padding: 0.5rem;
    justify-content: center; /* Keep strictly centered */
    overflow: hidden; /* Avoid any accidental scroll */
    max-height: 100vh;
  }
}

.container-form {
  max-width: 100%;
  background: transparent;
}

.container-admin {
  width: min(95%, 1400px);
  margin: 0 auto;
}

/* Header Styles */
header {
  text-align: center;
  margin-bottom: 0.75rem;
  width: 100%;
}

@media (max-width: 480px) {
  header {
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
  }
}

h1 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 0.2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.25rem;
  }
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  max-width: 400px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .subtitle {
    font-size: 0.7rem;
    line-height: 1.2;
  }
}

/* Form Card */
.form-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: min(100%, 540px);
  box-shadow: 
    0 20px 40px -10px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 10;
}

@media (max-width: 480px) {
  .form-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
  }
}

/* Image Side & 3D Effect */
.image-side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  overflow: hidden;
}

.image-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  max-height: min(85vh, 650px);
  border-radius: var(--radius-lg);
  perspective: 1500px;
  cursor: pointer;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-xl);
  box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.5);
  transform: rotateY(-15deg) rotateX(5deg);
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  filter: brightness(0.8) contrast(1.1);
}

.image-container:hover .hero-image {
  transform: rotateY(-5deg) rotateX(2deg) scale(1.02);
  filter: brightness(1) contrast(1.1);
}

.image-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: linear-gradient(to bottom, transparent 60%, rgba(15, 23, 42, 0.8));
  pointer-events: none;
}

.floating-badge {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
  transform: translateZ(50px);
  animation: floatBadge 4s infinite ease-in-out;
}

@keyframes floatBadge {
  0%, 100% { transform: translateY(0) translateZ(50px); }
  50% { transform: translateY(-10px) translateZ(50px); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Multi-Step Wizard */
.form-step {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.form-step.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.progress-container {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  margin-bottom: 2rem;
  overflow: hidden;
}

@media (max-width: 480px) {
  .progress-container {
    margin-bottom: 1.5rem;
  }
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-navigation {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

@media (max-width: 480px) {
  .form-navigation {
    margin-top: 1.5rem;
  }
}

.nav-btn {
  flex: 1;
}

.nav-btn.secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  box-shadow: none;
}

.nav-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.5);
}

.shake {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Form Groups */
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 480px) {
  .input-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
}

.input-group {
  position: relative;
  margin-bottom: 0.6rem;
}

@media (max-width: 480px) {
  .input-group {
    margin-bottom: 0.4rem;
  }
}

.input-group label {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition);
  font-weight: 500;
  font-size: 0.8rem;
  line-height: 1.2;
  max-width: 90%;
}

input, textarea, select {
  width: 100%;
  padding: 1.1rem 0.75rem 0.35rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

@media (max-width: 480px) {
  input, select {
    padding: 1rem 0.6rem 0.3rem;
  }
}

textarea {
  padding-top: 1.6rem;
  min-height: 55px;
  resize: none;
}

@media (max-width: 480px) {
  textarea {
    min-height: 45px;
    padding-top: 1.3rem;
    font-size: 0.8rem;
  }
}

input:focus + label,
input:not(:placeholder-shown) + label,
textarea:focus + label,
textarea:not(:placeholder-shown) + label,
select:focus + label {
  transform: translateY(-0.65rem) scale(0.75);
  transform-origin: left top;
  color: var(--primary);
  font-weight: 700;
}

input:focus, textarea:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Buttons */
button {
  width: 100%;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

button[type="submit"] {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

button[type="submit"]:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.5);
}

button[type="submit"]:active {
  transform: translateY(0);
}

button[type="submit"]::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  to { left: 100%; }
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

/* Admin Dashboard Specifics */
.admin-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  margin-bottom: 3rem;
  text-align: left;
}

@media (min-width: 768px) {
  .admin-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  width: 100%;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-card:hover {
  transform: translateY(-5px);
  background: #fff;
}

.stat-card .label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

/* Responsive Table */
.table-container {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

@media (max-width: 768px) {
  .table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    margin: 0 -1rem; /* Full width on mobile */
    overflow-x: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Use traditional table on mobile but with horizontal scroll */
  table {
    min-width: 700px;
  }
  
  th, td {
    padding: 1rem;
    font-size: 0.85rem;
  }
}

/* Custom Scrollbar */
.table-container::-webkit-scrollbar {
  height: 6px;
}
.table-container::-webkit-scrollbar-track {
  background: transparent;
}
.table-container::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: rgba(0,0,0,0.02);
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  font-size: 0.95rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(99, 102, 241, 0.02);
}

/* Success State Styles */
.success-msg {
  display: none;
  text-align: center;
  padding: 1rem;
}

.success-icon {
  width: 60px;
  height: 60px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 1.75rem;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 480px) {
  .success-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
}

@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.success-msg h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

@media (max-width: 480px) {
  .success-msg h2 {
    font-size: 1.25rem;
  }
}

.success-msg p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* Footer Section */
footer {
  width: 100%;
  text-align: center;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.7rem;
}

@media (max-width: 480px) {
  footer {
    padding: 0.25rem;
  }
  footer br {
    display: none;
  }
}

.footer-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

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

/* Extra Utils */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

.refresh-btn {
  width: auto;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.refresh-btn:hover {
  background: #fff;
  transform: translateY(-2px);
}

/* --- STRICT MOBILE OVERRIDES (Senior UX) --- */
@media (max-width: 1024px) {
  .layout-grid {
    display: block; /* Remove grid to avoid stacking height */
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
  }

  .image-side {
    display: none !important; /* Force hide the image side */
  }

  .container-form {
    padding: 1rem 0.5rem;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }

  header {
    margin-bottom: 0.5rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .subtitle {
    font-size: 0.75rem;
  }

  .form-card {
    width: 100%;
    max-width: 480px;
    padding: 1rem;
    margin: 0;
    max-height: 80vh; /* Safety limit */
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .progress-container {
    margin-bottom: 1rem;
  }

  .form-navigation {
    margin-top: 1rem;
  }

  footer {
    position: absolute;
    bottom: 0.5rem;
    padding: 0;
    font-size: 0.65rem;
  }
}

/* Fix for ultra-small height devices */
@media (max-height: 500px) {
  header { display: none; }
  .form-card { padding: 0.75rem; }
}

