/* -----------------------------------------------
   GLOBAL STYLES - Presensi Digital (Fully Compatible)
   Modern Glassmorphism + Smooth Interactions
   Support for index.php & akun_baru.php without HTML changes
-------------------------------------------------- */

/* ---------- VARIABLES ---------- */
:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --surface: rgba(255, 255, 255, 0.95);
  --surface-blur: rgba(255, 255, 255, 0.75);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --shadow-sm: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background: var(--primary-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow-x: hidden;
}

/* ---------- ANIMATIONS ---------- */
@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-60px) rotate(8deg); }
}

@keyframes float-reverse {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(40px) rotate(-6deg); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- BACKGROUND DECORATIONS (Compatible with existing circles) ---------- */
.circle {
  position: fixed;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  pointer-events: none;
  z-index: 0;
}

/* Support for exactly 2 circles as in index.php (plus extra if exist) */
.circle:first-child {
  width: 280px;
  height: 280px;
  top: -80px;
  left: -80px;
  animation: float 18s infinite alternate ease-in-out;
}

.circle:last-child {
  width: 200px;
  height: 200px;
  bottom: 40px;
  right: -60px;
  animation: float-reverse 22s infinite alternate ease-in-out;
  background: rgba(255, 255, 255, 0.1);
}

/* Optional extra circles (if added later) - no harm */
.circle:nth-child(3) {
  width: 120px;
  height: 120px;
  bottom: 20%;
  left: 5%;
  animation: float 14s infinite alternate ease-in-out;
  background: rgba(129, 140, 248, 0.2);
}

.circle:nth-child(4) {
  width: 350px;
  height: 350px;
  top: 30%;
  right: -100px;
  animation: float-reverse 25s infinite alternate ease-in-out;
  background: rgba(118, 75, 162, 0.15);
}

/* ---------- CARD STYLES ---------- */
.login-card,
.register-card {
  background: var(--surface-blur);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 460px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.6s var(--transition-smooth);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
  position: relative;
  z-index: 2;
}

.login-card:hover,
.register-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 40px -15px rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ---------- HEADER & LOGO ---------- */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  background: var(--primary-gradient);
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 12px 20px -8px rgba(79, 70, 229, 0.4);
  transition: transform var(--transition-fast);
}

.logo-icon:hover {
  transform: scale(1.02);
}

.logo-icon svg,
.logo-icon i {
  width: 32px;
  height: 32px;
  color: white;
}

.header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main), var(--primary-dark));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 0.25rem;
}

.header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- FORM GROUP & LABELS ---------- */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

/* ---------- INPUT STYLES (Unified for both structures) ---------- */
input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: 1.5px solid rgba(203, 213, 225, 0.6);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  transition: all var(--transition-fast);
  font-family: inherit;
}

/* Special case for password field WITHOUT tools (index.php) - no extra padding */
/* For password field WITH tools (akun_baru.php), we target by sibling existence later */

input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: white;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* ---------- ICON STYLES (BOTH STRUCTURES) ---------- */
/* Style for index.php: icon as direct child of .form-group, placed before input */
.form-group > i {
  position: absolute;
  left: 14px;
  top: 38px;
  color: var(--text-light);
  width: 18px;
  height: 18px;
  transition: color var(--transition-fast);
  pointer-events: none;
}

/* When input inside .form-group gets focus, change sibling icon color (index.php) */
.form-group > input:focus ~ i,
.form-group > input:focus + i {
  color: var(--primary);
}

/* Style for akun_baru.php: icon inside .input-wrapper */
.input-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

.input-wrapper > i.icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
  transition: color var(--transition-fast);
  pointer-events: none;
  z-index: 1;
}

/* For akun_baru.php, input inside .input-wrapper does not need extra left padding? Actually input already has padding-left */
.input-wrapper input {
  padding-left: 2.75rem;
}

/* Focus effect for akun_baru.php */
.input-wrapper input:focus ~ i.icon-left,
.input-wrapper input:focus + i.icon-left {
  color: var(--primary);
}

/* ---------- PASSWORD FIELD ADJUSTMENTS ---------- */
/* For password field that has .password-tools sibling (akun_baru.php) */
.form-group:has(.password-tools) input {
  padding-right: 100px;
}

/* Fallback if :has() not supported widely - we target by id */
input#password {
  padding-right: 100px;
}

/* Password tools container (akun_baru.php) */
.password-tools {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
  background: transparent;
  z-index: 2;
}

.tool-btn {
  background: rgba(79, 70, 229, 0.08);
  border: none;
  color: var(--primary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
}

.tool-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

.tool-btn:active {
  transform: scale(0.96);
}

/* ---------- STRENGTH METER (only in akun_baru.php) ---------- */
.strength-container {
  margin-top: 0.75rem;
}

.strength-meter {
  height: 6px;
  background: rgba(203, 213, 225, 0.5);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 10px;
  transition: width 0.4s ease, background 0.2s ease;
}

.strength-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 0.5rem;
  display: block;
  letter-spacing: 0.3px;
}

/* ---------- BUTTON (Ripple effect) ---------- */
button,
.btn-submit {
  width: 100%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

button::after,
.btn-submit::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

button:active::after,
.btn-submit:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
  transition: 0s;
}

button:hover,
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.5);
}

button:active,
.btn-submit:active {
  transform: scale(0.98);
}

/* ---------- ERROR BOX (index.php) ---------- */
.error-box {
  background: rgba(254, 226, 226, 0.9);
  backdrop-filter: blur(8px);
  color: #b91c1c;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-left: 4px solid var(--danger);
  animation: fadeIn 0.3s ease;
}

.error-box svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

/* ---------- LINKS & FOOTER ---------- */
.register-link,
.back-link {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.register-link a,
.back-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.register-link a:hover,
.back-link a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-light);
  letter-spacing: 0.5px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 1rem;
}

/* ---------- SMALL NOTES & DATALIST (akun_baru.php) ---------- */
small {
  font-size: 0.7rem;
  color: var(--text-light);
  display: block;
  margin-top: 0.4rem;
  padding-left: 0.25rem;
}

input[list] {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
  background-repeat: no-repeat;
  background-position: right 1rem center;
  appearance: none;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 520px) {
  body {
    padding: 1rem;
  }

  .login-card,
  .register-card {
    padding: 1.5rem;
    max-width: 100%;
  }

  .logo-icon {
    width: 52px;
    height: 52px;
  }

  .header h2 {
    font-size: 1.5rem;
  }

  input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.9rem;
  }

  .password-tools {
    gap: 4px;
  }

  .tool-btn {
    width: 30px;
    height: 30px;
  }

  input#password {
    padding-right: 80px;
  }
}

@media (max-width: 380px) {
  .password-tools {
    right: 6px;
  }

  .tool-btn {
    width: 28px;
    height: 28px;
  }

  input#password {
    padding-right: 70px;
  }
}

/* ---------- MISC ---------- */
input::placeholder {
  color: var(--text-light);
  font-weight: 400;
  opacity: 0.7;
}

:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 10px;
}

/* Ensure icons inside buttons (lucide) are centered */
button svg,
.btn-submit svg,
.tool-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}