/* --- CSS VARIABLES (Dark Gray & Light Green Theme) --- */
:root {
  /* Dark Gray Palette (Charcoal / Slate) */
  --bg-body: #262626;
  --bg-gradient-start: #2e2e2e;
  --bg-gradient-end: #1f1f1f;

  /* Glassmorphism Surface */
  --glass-surface: rgba(50, 50, 50, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;

  /* Light Green Accents */
  --primary-accent: #81c784; /* Light Sage / Mint Green */
  --primary-accent-hover: #a5d6a7; /* Lighter Green Hover */
  --primary-accent-dark: #519657; /* Darker Green Shadow */

  /* Text Colors */
  --text-main: #f0f2f0; /* Off-White */
  --text-muted: #a3a3a3; /* Light Grey */
  --text-dark-on-accent: #0d2b16; /* Dark Green/Black text for accent buttons */

  /* Input Fields */
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-focus-border: var(--primary-accent);

  --radius-outer: 32px;
  --radius-inner: 16px;
  --pad: 32px;

  --shadow-luxury: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
}

/* --- RESET --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Manrope", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

/* --- BACKGROUNDS & LAYOUT --- */
.back-g {
  position: absolute;
  z-index: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
}

.back-g img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3; /* Subtle background texture */
  filter: grayscale(100%) contrast(1.1); /* Black & white photo to match gray theme */
}

/* Overlay to blend image into dark gray */
.back-g::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(38, 38, 38, 0.7) 0%,
    var(--bg-body) 90%
  );
  backdrop-filter: blur(3px);
}

/* --- APP FRAME (Glass Card) --- */
.app-frame {
  width: 100%;
  height: 100dvh;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* Desktop / Tablet View */
@media (min-width: 701px) {
  .app-frame {
    /* Reverting to Original "Phone Frame" Dimensions */
    max-width: 400px;
    height: 92vh;
    max-height: 880px;
    border-radius: var(--radius-outer);

    /* Glass Effect */
    background: rgb(17 50 15 / 65%);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));

    /* Reverting to Thicker "Bezel" Border (styled for theme) */
    border: 6px solid var(--glass-border);
    box-shadow: var(--shadow-luxury);
  }
}

/* Mobile View */
@media (max-width: 700px) {
  .app-frame {
    background: linear-gradient(to bottom, transparent 0%, var(--bg-body) 30%);
  }
}

/* --- CONTENT --- */
.content {
  /* flex: 1; */
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 2;

  /* Reverting to Original Content Placement */
  overflow-y: auto;
  top: 100px;
}

/* --- LOGO & BRANDING --- */
.logo-area {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeInDown 1s ease-out;
}

.logo-icon {
  font-size: 48px;
  color: var(--primary-accent);
  margin-bottom: 12px;
  filter: drop-shadow(0 0 15px rgba(129, 199, 132, 0.3));
}

.brand-title {
  font-family: "Playfair Display", serif;
  font-size: 36px;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--primary-accent);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 600;
  margin-top: 6px;
  opacity: 0.9;
}

/* --- AUTH VIEWS --- */
.auth-view {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.form-header {
  margin-bottom: 32px;
  text-align: center;
}

.form-header h2 {
  font-family: "Playfair Display", serif;
  font-size: 26px;
  color: var(--text-main);
  font-weight: 400;
  font-style: italic;
}

.form-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 300;
}

/* --- INPUTS --- */
.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-input {
  width: 100%;
  padding: 18px 20px;
  background: var(--input-bg);
  border: none;
  border-bottom: 1px solid var(--input-border);
  /* border-radius: 12px; */
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  color: var(--text-main);
  outline: none;
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: var(--input-focus-border);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(129, 199, 132, 0.1); /* Green glow */
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 300;
}

.input-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
}

.input-icon:hover {
  color: var(--primary-accent);
}

/* --- BUTTONS --- */
.btn-primary {
  width: 100%;
  padding: 18px;
  background: linear-gradient(
    135deg,
    var(--primary-accent) 0%,
    var(--primary-accent-dark) 100%
  );
  color: var(--text-dark-on-accent);
  border: none;
  border-radius: 12px;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-top: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(
    135deg,
    var(--primary-accent-hover) 0%,
    var(--primary-accent) 100%
  );
  box-shadow: 0 15px 30px -5px rgba(129, 199, 132, 0.2);
}

.btn-primary:active {
  transform: scale(0.98);
}

.text-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  margin-top: 32px;
  width: 100%;
  text-align: center;
  transition: color 0.2s;
}

.text-btn:hover {
  color: var(--text-main);
}

.text-btn span {
  color: var(--primary-accent);
  text-decoration: none;
  position: relative;
  font-weight: 600;
}

.text-btn span::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 1px;
  bottom: -2px;
  left: 0;
  background-color: var(--primary-accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.text-btn:hover span::after {
  transform: scaleX(1);
  transform-origin: left;
}

.forgot-link {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -12px;
  margin-bottom: 24px;
  cursor: pointer;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--primary-accent);
}

/* --- TOAST --- */
/* FIX: Fixed positioning, high Z-index, and opacity 0 by default */
.toast {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(-200%); /* Completely out of view */
  opacity: 0; /* Invisible by default */
  pointer-events: none; /* Non-blocking */

  background: rgba(38, 38, 38, 0.95);
  border: 1px solid var(--primary-accent);
  color: var(--primary-accent);
  padding: 14px 24px;
  border-radius: 50px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  font-size: 13px;
  font-weight: 600;
  width: auto;
  min-width: 250px;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast i {
  font-size: 18px;
}

.toast.error {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

/* --- ALERT (Inline Errors) --- */
.alert {
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  background-color: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  color: #ff6b6b;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.alert i {
  font-size: 18px;
}

.hidden {
  display: none !important;
}

/* --- PRELOADER --- */
.preloader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-body);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.preloader.active {
  opacity: 1;
  pointer-events: all;
}

.preloader-text {
  font-family: "Playfair Display", serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--primary-accent);
  letter-spacing: 6px;
  animation: pulseGreen 2s ease-in-out infinite;
}

/* --- ANIMATIONS --- */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGreen {
  0% {
    opacity: 0.6;
    transform: scale(0.98);
    text-shadow: 0 0 0 rgba(129, 199, 132, 0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
    text-shadow: 0 0 20px rgba(129, 199, 132, 0.5);
  }
  100% {
    opacity: 0.6;
    transform: scale(0.98);
    text-shadow: 0 0 0 rgba(129, 199, 132, 0);
  }
}

.backimg {
  width: 100%;
  height: auto;
  position: absolute;
  top: 0;
  left: 0;
}

.backimg img {
  width: 100%;
  opacity: 0.5;
}

.backimg::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 300px;
  background: linear-gradient(to top, #132b12, transparent);
}

.backimg::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 300px;
  background: linear-gradient(to top, #132b12, transparent);
}

.app-frame {
  background: #132b12;
  overflow: auto;
}

.content {
  top: auto;
  /* overflow: hidden; */
  padding-bottom: 100px;
  padding-top: 300px;
}
