/* ========================================================
   RIBAP - Components Stylesheet
   Drawers, Auth Forms, Modals, OTP Boxes
   ======================================================== */

/* ========================================================
   Drawers (Left Navigation Drawer & Right Profile Drawer)
   ======================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- Left Navigation Drawer (Pages 9, 10, 11) --- */
.left-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-drawer);
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.left-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  height: 58px;
  background-color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.drawer-header .drawer-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffffff;
}

.drawer-close-btn {
  color: #ffffff;
  font-size: 22px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.drawer-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.nav-menu-list {
  list-style: none;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-menu-item {
  border-radius: 8px;
  overflow: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(66, 85, 255, 0.25);
  color: var(--accent-cyan);
}

.nav-link-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.nav-link-text {
  flex: 1;
}

.nav-link-chevron {
  width: 18px;
  height: 18px;
  transition: transform 0.25s ease;
}

.nav-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-link-row .nav-link {
  flex: 1;
}

.nav-chevron-btn {
  background: none;
  border: none;
  color: #ffffff;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  border-radius: 6px;
}

.nav-chevron-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--accent-cyan);
}

.nav-chevron-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform 0.25s ease;
}

.nav-menu-item.open .nav-chevron-btn svg {
  transform: rotate(180deg);
}

.nav-link-chevron svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.nav-menu-item.open .nav-link-chevron {
  transform: rotate(180deg);
}

/* Submenu dropdowns (Page 10, 11) */
.nav-submenu {
  list-style: none;
  padding: 4px 0 6px 42px;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.nav-menu-item.open .nav-submenu {
  display: flex;
}

.nav-submenu-link {
  display: block;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14.5px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-submenu-link:hover, .nav-submenu-link.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
  padding-left: 16px;
}

/* --- Right User Profile Drawer (Page 8) --- */
.right-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-user-drawer);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.right-drawer.active {
  transform: translateX(0);
}

.user-profile-header {
  padding: 28px 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.profile-avatar-large {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #d9deeb;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.profile-avatar-large svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
}

.profile-username {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 10px;
}

/* Material Progress Card in Drawer (Page 8) */
.material-progress-box {
  background: rgba(255, 255, 255, 0.08);
  margin: 20px;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.material-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.material-progress-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}

.btn-check-progress {
  background-color: #ffffff;
  color: var(--text-dark);
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 9999px;
  transition: all 0.2s;
}

.btn-check-progress:hover {
  background-color: var(--accent-cyan-light);
  transform: translateY(-1px);
}

.user-drawer-menu {
  list-style: none;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-drawer-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.2s;
}

.user-drawer-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
}

.user-drawer-link.logout {
  color: #f87171;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.user-drawer-link.logout:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ========================================================
   Authentication Pages (Login Page 4, Register Pages 5,6,7)
   ======================================================== */
.auth-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 30px 16px;
  position: relative;
}

.auth-brand-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand-title {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
}

.auth-brand-subtitle {
  font-size: 18px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 4px;
}

/* Login Card (Page 4) */
.login-card {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: #ffffff;
  color: var(--text-dark);
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(66, 85, 255, 0.35);
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: #ffffff;
  color: var(--text-dark);
  font-size: 14.5px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.btn-auth-pill {
  width: 100%;
  max-width: 240px;
  margin: 10px auto 0;
  background-color: #ffffff;
  color: var(--text-dark);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 13px 28px;
  border-radius: 9999px;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: block;
}

.btn-auth-pill:hover {
  background-color: #f1f3f9;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.auth-divider-box {
  width: 100%;
  text-align: center;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-divider-text {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.5px;
}

.auth-divider-or {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.btn-create-account-link {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  transition: all 0.2s;
  display: inline-block;
  margin-top: 4px;
}

.btn-create-account-link:hover {
  color: #ffffff;
  text-decoration: underline;
  transform: translateY(-1px);
}

/* ========================================================
   Registration Flow (Pages 5, 6, 7)
   ======================================================== */
.register-container {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Step 1: Email & OTP Card (Pages 6 & 7) */
.email-first-card,
.email-otp-card {
  width: 100%;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 32px 28px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.email-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-send-code {
  background-color: #ffffff;
  color: var(--text-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 8px;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-send-code:hover {
  background-color: var(--accent-cyan-light);
}

.otp-box-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.otp-inputs-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.otp-digit-input {
  width: 48px;
  height: 58px;
  background-color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: var(--text-dark);
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  outline: none;
  transition: all 0.2s;
}

.otp-digit-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(66, 85, 255, 0.35);
  transform: scale(1.05);
}

.otp-meta-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 340px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

.resend-countdown {
  color: var(--accent-cyan);
  cursor: pointer;
}

/* Step 2: 2-Column Registration Details (Page 5) */
.reg-two-column-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 36px 32px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.reg-grid {
  display: grid;
  grid-template-columns: 1fr 1px 1.1fr;
  gap: 36px;
  align-items: start;
}

.reg-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.reg-vertical-divider {
  background-color: rgba(255, 255, 255, 0.2);
  width: 1px;
  height: 100%;
  min-height: 280px;
}

@media (max-width: 768px) {
  /* Prevent iOS Safari automatic zoom on input focus by enforcing 16px minimum */
  .form-input,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
    padding: 12px 14px;
    border-radius: 8px;
  }

  /* Auth wrapper mobile padding */
  .auth-wrapper {
    padding: 20px 14px;
    min-height: calc(100vh - 60px);
  }
  .auth-brand-title {
    font-size: 32px;
    letter-spacing: 2px;
  }
  .auth-brand-subtitle {
    font-size: 15px;
  }
  .login-card,
  .email-first-card,
  .email-otp-card,
  .reg-two-column-card {
    padding: 24px 16px;
    border-radius: 14px;
  }
  .btn-auth-pill {
    width: 100%;
    max-width: 100%;
    padding: 14px 20px;
    min-height: 48px;
    font-size: 15.5px;
  }
  .btn-send-code {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* Registration 2-column to mobile single column */
  .reg-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .reg-vertical-divider {
    display: none;
  }
  .otp-digit-input {
    width: clamp(38px, 12vw, 48px);
    height: 52px;
    font-size: 20px;
  }

  /* Search modal on mobile */
  .search-modal {
    padding: 20px 14px;
    align-items: center;
  }
  .search-modal-box {
    width: 100%;
    padding: 18px;
    border-radius: 12px;
  }
  .search-input-field {
    font-size: 16px;
    padding: 12px 14px;
  }

  /* Accessible touch targets for navigation items */
  .nav-link {
    padding: 12px 14px;
    font-size: 15.5px;
  }
  .nav-chevron-btn {
    padding: 12px 16px;
  }
  .user-drawer-link {
    padding: 12px 14px;
    font-size: 14.5px;
  }
}

/* ========================================================
   Search Modal Overlay
   ======================================================== */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 9, 45, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.search-modal.active {
  display: flex;
}

.search-modal-box {
  background-color: #12163b;
  width: 90%;
  max-width: 600px;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.search-input-field {
  width: 100%;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 17px;
  outline: none;
}

.search-input-field:focus {
  border-color: var(--accent-cyan);
}

/* ========================================================
   Alerts & Notifications
   ======================================================== */
.alert {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background-color: rgba(34, 197, 94, 0.2);
  border: 1px solid var(--accent-green);
  color: #86efac;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.alert-info {
  background-color: rgba(59, 130, 246, 0.2);
  border: 1px solid #3b82f6;
  color: #93c5fd;
}
