/* =========================================
   2. GLOBAL STYLES, DASHBOARD & AUTH
   ========================================= */
@import './variables.css';

/* --- CORE RESET & UTILS --- */
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  overflow-x: hidden;
  /* Print Adjustment */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Prevent text selection on UI elements for "App-like" feel */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* Animations Keyframes (Shared) */
@keyframes bgShift { 0%{ background-position: 0% 50%; } 50%{ background-position: 100% 50%; } 100%{ background-position: 0% 50%; } }
@keyframes drift { 0%,100%{ transform: translate(0,0) scale(1); } 50%{ transform: translate(35px,-22px) scale(1.05); } }
@keyframes popIn { from{ opacity:0; transform: translateY(14px) scale(.99); } to{ opacity:1; transform: translateY(0) scale(1); } }
@keyframes floaty { 0%,100%{ transform: translateY(4px); } 50%{ transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUpIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   MODULE: DASHBOARD & LOGIN (Specifics)
   Context: body:has(.blob)
   ========================================= */

body:has(.blob) {
  color: var(--c-dash-text);
  display: grid; 
  place-items: center;
  padding: 28px 16px;
  background: linear-gradient(135deg, var(--bg-dash-1), var(--bg-dash-2), var(--bg-dash-3));
  background-size: 220% 220%;
  animation: bgShift 14s ease-in-out infinite;
}

/* --- Shared Components (Card & Btn) --- */
body:has(.blob) .card {
  position: relative; 
  z-index: 1; 
  width: min(920px, 92vw);
  background: rgba(255,255,255,0.8); /* Fallback */
  background: var(--c-dash-card);
  border: 1px solid rgba(255,255,255,.65);
  backdrop-filter: blur(10px); 
  border-radius: var(--radius-dash);
  box-shadow: var(--shadow-dash); 
  padding: clamp(22px, 4vw, 34px);
  display: flex; 
  flex-direction: column; 
  gap: 22px;
  animation: popIn .7s ease both;
}

body:has(.blob) .btn {
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 10px;
  padding: 12px 24px; 
  border-radius: 14px; 
  border: 0; 
  text-decoration: none;
  font-weight: 700; 
  letter-spacing: .01em; 
  cursor: pointer;
  transform: translateZ(0); 
  transition: all .18s ease;
  box-shadow: 0 12px 28px rgba(251, 146, 60, .22);
  background: linear-gradient(135deg, var(--c-dash-accent-2), var(--c-dash-accent-1)); 
  color: #fff; 
  font-size: 15px;
}

body:has(.blob) .btn:hover { transform: translateY(-2px); filter: saturate(1.06); box-shadow: 0 16px 34px rgba(251, 146, 60, .28); }
body:has(.blob) .btn:active { transform: translateY(0); }
body:has(.blob) .btn.secondary { background: #fff; color: var(--c-dash-accent-1); border: 2px solid var(--c-dash-accent-1); box-shadow: none; }
body:has(.blob) .btn.secondary:hover { background: var(--bg-dash-2); }

/* --- Animated Blobs --- */
body:has(.blob) .blob {
  position: fixed; width: 520px; height: 520px; border-radius: 50%;
  filter: blur(35px); opacity: .45; z-index: 0; pointer-events: none;
  transform: translate3d(0,0,0); animation: drift 18s ease-in-out infinite;
}
body:has(.blob) .blob.b1 { background: radial-gradient(circle at 30% 30%, var(--c-dash-accent-2), transparent 60%); left:-180px; top:-180px; }
body:has(.blob) .blob.b2 { background: radial-gradient(circle at 70% 40%, var(--c-dash-accent-1), transparent 60%); right:-220px; top:80px; animation-duration: 22s; }
body:has(.blob) .blob.b3 { background: radial-gradient(circle at 50% 60%, var(--c-dash-accent-3), transparent 60%); left:20%; bottom:-260px; animation-duration: 20s; }

/* --- Index/Dashboard Layout --- */
body:has(.blob) .guest-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; align-items: center; width: 100%; }
body:has(.blob) .dashboard-layout { display: none; flex-direction: column; width: 100%; }
body:has(.blob) .title { margin: 0 0 10px 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.06; letter-spacing: -0.02em; }
body:has(.blob) .title .grad { background: linear-gradient(90deg, var(--c-dash-accent-2), var(--c-dash-accent-1), var(--c-dash-accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
body:has(.blob) .subtitle { margin: 0 0 18px 0; color: var(--c-dash-muted); font-size: 15.5px; line-height: 1.6; }
body:has(.blob) .cta-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
body:has(.blob) .hint { color: var(--c-dash-muted); font-size: 13px; }

/* Dashboard Grid */
body:has(.blob) .app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; width: 100%; }
body:has(.blob) .app-card {
  background: rgba(255,255,255,0.7); border: 1px solid rgba(255,255,255,0.8); border-radius: 18px; padding: 24px;
  text-decoration: none; color: var(--c-dash-text); transition: all 0.2s ease;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
}
body:has(.blob) .app-card:hover { transform: translateY(-5px); background: rgba(255,255,255,0.9); box-shadow: 0 10px 25px rgba(0,0,0,0.08); }
body:has(.blob) .app-icon { font-size: 32px; margin-bottom: 5px; background: linear-gradient(135deg, var(--c-dash-accent-2), var(--c-dash-accent-1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
body:has(.blob) .app-title { font-size: 18px; font-weight: 800; }
body:has(.blob) .app-desc { font-size: 13px; color: var(--c-dash-muted); line-height: 1.4; }

/* Dashboard Art */
body:has(.blob) .art {
  width: 100%; height: 320px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(96,165,250,.22), rgba(251,113,133,.22), rgba(251,146,60,.20));
  border: 1px solid rgba(255,255,255,.55); display: grid; place-items: center; overflow: hidden; position: relative;
}
body:has(.blob) .art img { width: min(340px, 75%); height: auto; filter: drop-shadow(0 18px 24px rgba(2,6,23,.18)); transform: translateY(2px); animation: floaty 6.5s ease-in-out infinite; }

/* --- Login Form Specifics --- */
body:has(#loginForm) .card { width: min(520px, 94vw); padding: 26px 22px; }
body:has(#loginForm) h1 { margin: 0 0 8px 0; font-size: 28px; letter-spacing: -0.02em; }
body:has(#loginForm) .sub { margin: 0 0 18px 0; color: var(--c-dash-muted); font-size: 14px; line-height: 1.55; }
body:has(#loginForm) label { display: block; font-size: 13px; font-weight: 700; color: var(--c-dash-muted); margin: 14px 0 6px; }

body:has(#loginForm) input {
  width: 100%; padding: 12px 12px; border-radius: 14px;
  border: 1px solid rgba(15,23,42,.14); background: rgba(255,255,255,.85);
  font-size: 15px; outline: none;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
body:has(#loginForm) input:focus { border-color: rgba(251,146,60,.55); box-shadow: var(--ring-focus); transform: translateY(-1px); }

body:has(#loginForm) .btn { width: 100%; margin-top: 18px; padding: 12px 16px; box-shadow: 0 14px 30px rgba(251,146,60,.22); }
body:has(#loginForm) .password-container { position: relative; }
body:has(#loginForm) .eye-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; user-select: none; font-size: 18px; opacity: .85;
  transition: transform .15s ease, opacity .15s ease;
}
body:has(#loginForm) .eye-icon:hover { transform: translateY(-50%) scale(1.06); opacity: 1; }
body:has(#loginForm) .error {
  display: none; margin-top: 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(239, 68, 68, .08); border: 1px solid rgba(239, 68, 68, .22);
  color: #b91c1c; font-size: 13px;
}
body:has(#loginForm) .foot { margin-top: 14px; text-align: center; color: var(--c-dash-muted); font-size: 12.5px; }
body:has(#loginForm) .foot a { color: #1d4ed8; text-decoration: none; font-weight: 700; }
body:has(#loginForm) .foot a:hover { text-decoration: underline; }

/* Responsive adjustments */
@media (max-width: 860px) {
  body:has(.blob) .guest-layout { grid-template-columns: 1fr; }
  body:has(.blob) .art { height: 240px; }
  body:has(.blob) .app-grid { grid-template-columns: 1fr; }
}