/* ============================================
   Absensi Santri - Design Tokens & Global Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap');

/* --- Design Tokens --- */
:root {
  /* Colors */
  --color-primary: #0D9488;
  --color-primary-dark: #115E59;
  --color-primary-darker: #0A3D38;
  --color-primary-light: #2CC3BC;
  --color-primary-lightest: #F0FDFA;
  --color-accent: #D4A24C;
  --color-accent-light: #FEFCE8;

  --color-text-primary: #1E293B;
  --color-text-secondary: #64748B;
  --color-text-muted: #94A3B8;
  --color-text-white: #FFFFFF;

  --color-bg-white: #FFFFFF;
  --color-bg-light: #F8FAFC;
  --color-bg-input: #F1F5F9;
  --color-border: #E2E8F0;
  --color-border-focus: #0D9488;

  --color-error: #DC2626;
  --color-error-bg: #FEF2F2;
  --color-success: #16A34A;
  --color-success-bg: #F0FDF4;

  /* Typography */
  --font-heading: 'Lexend', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-input-focus: 0 0 0 3px rgba(13, 148, 136, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background-color: var(--color-bg-light);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

/* --- Heading Styles --- */
.heading-1 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-primary);
}

.heading-2 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text-primary);
}

.heading-3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.4;
}

.text-body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
}

.text-small {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
}

/* ============================================
   Page Layout
   ============================================ */

.auth-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* --- Left Branding Panel --- */
.brand-panel {
  position: relative;
  width: 45%;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  overflow: hidden;
}

.brand-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.06) 0%, transparent 45%);
  pointer-events: none;
}

/* Islamic geometric pattern overlay */
.brand-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.06;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255, 255, 255, 0.5) 40px, rgba(255, 255, 255, 0.5) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255, 255, 255, 0.5) 40px, rgba(255, 255, 255, 0.5) 41px),
    repeating-linear-gradient(45deg, transparent, transparent 28px, rgba(255, 255, 255, 0.3) 28px, rgba(255, 255, 255, 0.3) 29px),
    repeating-linear-gradient(-45deg, transparent, transparent 28px, rgba(255, 255, 255, 0.3) 28px, rgba(255, 255, 255, 0.3) 29px);
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 400px;
}

.brand-logo {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-8);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-logo svg {
  width: 40px;
  height: 40px;
  color: var(--color-text-white);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--color-text-white);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin-bottom: var(--space-10);
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
}

.brand-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--text-sm);
  font-family: var(--font-body);
}

.brand-feature-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
}

/* Decorative floating shapes */
.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 0;
}

.floating-shape-1 {
  width: 200px;
  height: 200px;
  top: -50px;
  right: -60px;
  animation: float 8s ease-in-out infinite;
}

.floating-shape-2 {
  width: 150px;
  height: 150px;
  bottom: 80px;
  left: -40px;
  animation: float 6s ease-in-out infinite reverse;
}

.floating-shape-3 {
  width: 100px;
  height: 100px;
  top: 40%;
  right: 10%;
  animation: float 10s ease-in-out infinite 2s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

/* --- Right Form Panel --- */
.form-panel {
  width: 55%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background-color: var(--color-bg-white);
  position: relative;
}

.form-wrapper {
  width: 100%;
  max-width: 440px;
  position: relative;
}

/* --- Form Container & Toggle --- */
.form-container {
  position: relative;
  overflow: hidden;
}

.form-section {
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.form-section.hidden {
  display: none;
}

.form-section.slide-out-left {
  opacity: 0;
  transform: translateX(-30px);
}

.form-section.slide-in-right {
  opacity: 0;
  transform: translateX(30px);
}

/* --- Form Header --- */
.form-header {
  margin-bottom: var(--space-8);
}

.form-header .greeting {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-primary-lightest);
  color: var(--color-primary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
}

.form-header h1 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-header p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: var(--space-4);
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-icon svg {
  width: 20px;
  height: 20px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4) 0 calc(var(--space-4) + 20px + var(--space-3));
  background-color: var(--color-bg-input);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input::placeholder {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.form-input:hover {
  border-color: var(--color-primary-light);
}

.form-input:focus {
  border-color: var(--color-border-focus);
  background-color: var(--color-bg-white);
  box-shadow: var(--shadow-input-focus);
}

.form-input:focus ~ .input-icon,
.form-input:focus + .input-icon {
  color: var(--color-primary);
}

/* Reverse order for sibling selector - icon before input */
.input-wrapper:focus-within .input-icon {
  color: var(--color-primary);
}

.form-input.has-error {
  border-color: var(--color-error);
  background-color: var(--color-error-bg);
}

.form-input.has-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* Password toggle button */
.password-toggle {
  position: absolute;
  right: var(--space-3);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.password-toggle:hover {
  color: var(--color-primary);
  background: var(--color-primary-lightest);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.active .icon-eye {
  display: none;
}

.password-toggle.active .icon-eye-off {
  display: block;
}

/* Error message */
.error-message {
  display: none;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-error);
  font-family: var(--font-body);
}

.error-message.visible {
  display: flex;
}

.error-message svg {
  width: 14px;
  height: 14px;
  min-width: 14px;
}

/* --- Form Options Row --- */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: nowrap;
}

/* Custom checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: var(--color-bg-white);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-custom svg {
  width: 12px;
  height: 12px;
  color: white;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-fast);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkbox-custom svg {
  opacity: 1;
  transform: scale(1);
}

.checkbox-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
}

.forgot-link {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 500;
  font-family: var(--font-body);
  transition: color var(--transition-fast);
  margin-left: auto;
  white-space: nowrap;
}

.forgot-link:hover {
  color: var(--color-primary-dark);
}

/* --- Submit Button --- */
.btn-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--color-text-white);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.btn-submit:hover::before {
  left: 100%;
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* --- Divider --- */
.form-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.form-divider span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Form Footer / Switch --- */
.form-switch {
  text-align: center;
  margin-top: var(--space-8);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
}

.form-switch a {
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.form-switch a:hover {
  color: var(--color-primary-dark);
}

/* --- Success Toast --- */
.toast {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-lg);
  color: var(--color-success);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform var(--transition-slow);
  z-index: 100;
}

.toast.visible {
  transform: translateX(0);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .brand-panel {
    width: 40%;
    padding: var(--space-8);
  }

  .form-panel {
    width: 60%;
  }

  .brand-title {
    font-size: var(--text-3xl);
  }
}

@media (max-width: 768px) {
  .auth-container {
    flex-direction: column;
  }

  .brand-panel {
    width: 100%;
    min-height: auto;
    padding: var(--space-10) var(--space-6) var(--space-8);
  }

  .brand-features {
    display: none;
  }

  .brand-subtitle {
    margin-bottom: 0;
    font-size: var(--text-base);
  }

  .brand-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
  }

  .brand-logo {
    width: 60px;
    height: 60px;
    margin-bottom: var(--space-4);
  }

  .brand-logo svg {
    width: 30px;
    height: 30px;
  }

  .form-panel {
    width: 100%;
    min-height: auto;
    padding: var(--space-6);
  }

  .form-wrapper {
    max-width: 100%;
  }

  .floating-shape {
    display: none;
  }
}

@media (max-width: 480px) {
  .form-panel {
    padding: var(--space-5) var(--space-4);
  }

  .form-header h1 {
    font-size: var(--text-xl);
  }

  .form-header {
    text-align: center;
  }

  .form-header .greeting {
    display: inline-flex;
  }
}
