@import url('https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap');

:root {
  --g-text-primary: #ffffff;
  --g-text-secondary: #c4c7c5;
  --g-accent: #a8c7fa;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 16px;
  --font-family: 'Google Sans', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: #000000;
  color: var(--g-text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 80px; /* Space at the end of each page */
}

/* ============================================ */
/*              BACKGROUND LAYERS               */
/* ============================================ */

#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -1;
  pointer-events: none;
}

.aurora-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -2;
  background: black;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.5s ease;
}
.aurora-bg.visible {
  opacity: 1;
}
.aurora-bg::before, .aurora-bg::after {
  content: "";
  position: absolute;
  width: 250vw; height: 250vh;
  background: radial-gradient(circle, rgba(234, 67, 53, 0.12) 0%, rgba(0,0,0,0) 55%);
  top: -50%; left: -50%;
  animation: moveAurora 12s infinite alternate ease-in-out;
  pointer-events: none;
}
.aurora-bg::after {
  background: radial-gradient(circle, rgba(255, 120, 50, 0.1) 0%, rgba(0,0,0,0) 55%);
  top: auto; bottom: -50%; left: auto; right: -50%;
  animation: moveAurora 15s infinite alternate-reverse ease-in-out;
}

@keyframes moveAurora {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(15%, 10%) scale(1.2); }
  66% { transform: translate(-10%, 20%) scale(0.9); }
  100% { transform: translate(25%, -15%) scale(1.3); }
}

/* ============================================ */
/*              VIEW MANAGEMENT                 */
/* ============================================ */

.view {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.view.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

.top-nav { display: none; } /* Hidden globally */

/* ============================================ */
/*          BENTO GRID SYSTEM (12-col)          */
/* ============================================ */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 32px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.bento-cell {
  min-width: 0; /* Prevent grid blowout */
}

.col-span-12 { grid-column: span 12; }
.col-span-8  { grid-column: span 8; }
.col-span-6  { grid-column: span 6; }
.col-span-4  { grid-column: span 4; }
.col-span-3  { grid-column: span 3; }

/* ============================================ */
/*           GLASSMORPHISM COMPONENTS           */
/* ============================================ */

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  padding: 40px;
}

/* ============================================ */
/*                  BUTTONS                     */
/* ============================================ */

.btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--g-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 10px 24px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto !important;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}
.btn:active { transform: translateY(0); }

.btn-white {
  background: rgba(255, 255, 255, 0.9);
  color: #000000;
  border: none;
  font-weight: 700;
}
.btn-white:hover {
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--g-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================ */
/*                   INPUTS                     */
/* ============================================ */

input[type="text"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--g-text-primary);
  border-radius: 12px;
  padding: 16px;
  font-family: inherit;
  font-size: 16px;
  width: 100%;
  outline: none;
  transition: all 0.2s ease;
}
input[type="text"]:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.md-field {
  margin-bottom: 16px;
}

.md-field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.md-input-dt {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--g-text-primary);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  color-scheme: dark;
}
.md-input-dt:focus {
  border-color: var(--g-accent);
  background: rgba(255, 255, 255, 0.08);
}

/* ============================================ */
/*           TENANT ADMIN CARDS                 */
/* ============================================ */

.tenant-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}
.tenant-card:hover {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.tenant-card-status {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-active { background: rgba(52, 168, 83, 0.2); color: #34a853; }
.status-future { background: rgba(251, 188, 5, 0.2); color: #fbbc05; }
.status-expired { background: rgba(234, 67, 53, 0.2); color: #ea4335; }

/* ============================================ */
/*          VIEW: LOGIN (ANTESALA ÉPICA)        */
/* ============================================ */

.login-fullscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  justify-content: center !important;
  align-items: center !important;
  text-align: center;
  padding: 40px;
}

.login-title {
  display: inline-block;
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 24px;
  
  background: linear-gradient(90deg, #4285F4, #EA4335, #4285F4);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  animation: googleGradient 8s linear infinite;
}

@keyframes googleGradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.login-subtitle {
  font-size: clamp(27px, 4.2vw, 40px);
  color: #ffffff;
  max-width: 95%; /* Use 95% instead of a fixed pixel width to prevent screen overflow while allowing it to be as wide as needed */
  margin: 0 auto 48px auto;
  line-height: 1.5;
  font-weight: 300;
}

.login-form {
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================ */
/*            ANALYTICS MODAL CARDS             */
/* ============================================ */

.mission-log-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mission-log-card.completed {
  border-left: 4px solid #34a853;
}
.mission-log-card.failed {
  border-left: 4px solid #ea4335;
}

/* ============================================ */
/*           VIEW: DASHBOARD (HUB)              */
/* ============================================ */

.section-title {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(90deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #fff; /* Fallback */
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.section-body {
  font-size: 18px;
  color: var(--g-text-secondary);
  line-height: 1.6;
}

.card-title {
  font-size: 24px;
  color: #fff;
  margin-bottom: 12px;
}

.card-body {
  font-size: 15px;
  color: var(--g-text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  margin-bottom: 14px;
  padding-left: 28px;
  position: relative;
  color: var(--g-text-secondary);
  line-height: 1.5;
  font-size: 15px;
}

.feature-list li .dot {
  position: absolute;
  left: 0;
  top: 2px;
}

.feature-list li strong {
  color: #fff;
}

.cta-banner {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.1), rgba(52, 168, 83, 0.05));
  border-left: 4px solid #4285f4;
  border-radius: 16px;
  padding: 32px;
}

.cta-banner p {
  font-size: 20px;
  font-weight: 400;
  color: #fff;
  line-height: 1.5;
  margin: 0;
}

/* Stat Cards */
.stat-card {
  text-align: center;
  padding: 24px;
}

.stat-label {
  font-size: 11px;
  color: var(--g-text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  display: block;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

/* Missions Grid inside bento */
.missions-bento {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 0 !important;
}

.mission-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mission-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.mission-card.completed {
  border-color: rgba(15, 157, 88, 0.4);
}
.mission-card.failed {
  border-color: rgba(219, 68, 55, 0.4);
}

.mission-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--g-text-secondary);
  font-weight: 500;
}

/* ============================================ */
/*       VIEW: MISSION INTRO (SPLIT GRID)       */
/* ============================================ */

.mission-action-panel {
  position: sticky;
  top: 24px;
  align-self: start;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--g-text-secondary);
  font-size: 15px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row strong { color: #fff; }

.warning-card {
  background: rgba(219, 68, 55, 0.1);
  border: 1px solid rgba(219, 68, 55, 0.3);
  border-radius: 16px;
  padding: 20px;
}

/* ============================================ */
/*       VIEW: ACTIVE MISSION (FULL GRID)       */
/* ============================================ */

.active-mission-header {
  position: sticky;
  top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  padding: 16px 24px !important;
}

.timer {
  font-size: 15px;
  font-weight: 600;
  font-family: 'Roboto Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--g-text-primary);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}
.timer::before {
  content: '⏱️';
  font-size: 14px;
}

.timer.warning { 
  color: #f4b400; 
  background: rgba(244, 180, 0, 0.1);
  border-color: rgba(244, 180, 0, 0.2);
}
.timer.danger { 
  color: #ff6b6b; 
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.2);
  animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* ============================================ */
/*       RICH TEXT IN MISSION VIEWS              */
/* ============================================ */

.desc-html-content h3 { margin-bottom: 16px; font-size: 22px; color: #fff; }
.desc-html-content p { color: var(--g-text-secondary); margin-bottom: 16px; line-height: 1.6; }
.desc-html-content strong { color: #fff; }

.prompt-box {
  background: rgba(0, 0, 0, 0.5);
  border-left: 4px solid rgba(255,255,255,0.3);
  padding: 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 24px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  color: #e8eaed;
  line-height: 1.5;
  position: relative;
}

.prompt-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  font-family: var(--font-family);
}
.prompt-copy-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

/* Security Question */
.security-question-card {
  background: rgba(32, 33, 36, 0.85); /* Material Dark Gray */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  margin-top: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.security-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.security-option {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.5;
  color: var(--g-text-secondary);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.security-option:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

.security-option.selected {
  border-color: var(--g-accent);
  background: rgba(66, 133, 244, 0.15);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.3);

}

/* ============================================ */
/*               RESPONSIVE                     */
/* ============================================ */

@media (max-width: 900px) {
  .col-span-8,
  .col-span-6,
  .col-span-4,
  .col-span-3 {
    grid-column: span 12;
  }
  
  .bento-grid {
    gap: 16px;
    padding: 16px;
  }

  .mission-action-panel {
    position: relative;
    top: auto;
  }
  
  .missions-bento {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .login-title {
    font-size: 48px;
  }
  
  .login-subtitle {
    font-size: 27px;
  }
  
  .glass-card {
    padding: 24px;
    border-radius: 16px;
  }
}

/* =========================================
   ADVANCED CAROUSEL (DASHBOARD)
========================================= */
.carousel-wrapper button {
  transition: all 0.2s;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
#btn-carousel-prev:hover, #btn-carousel-next:hover {
  background: var(--g-accent);
  color: #fff;
  transform: scale(1.1);
}

.mission-card {
  position: absolute;
  width: 320px;
  left: 50%;
  top: 50%;
  margin-top: -150px; /* Adjust for centering */
  margin-left: -160px; /* Adjust for centering */
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease, filter 0.4s ease, z-index 0.4s ease;
}

/* Center card is larger and fully opaque */
.mission-card.center {
  transform: translateX(0) scale(1.05);
  opacity: 1;
  z-index: 3;
  filter: blur(0);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  cursor: pointer;
  pointer-events: auto !important;
}

/* Side cards are smaller, slightly transparent, and blurred */
.mission-card.left {
  transform: translateX(-320px) scale(0.85);
  opacity: 0.5;
  z-index: 2;
  filter: blur(2px);
  pointer-events: none;
}
.mission-card.right {
  transform: translateX(320px) scale(0.85);
  opacity: 0.5;
  z-index: 2;
  filter: blur(2px);
  pointer-events: none;
}
.mission-card.hidden {
  transform: translateX(0) scale(0.6);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}


/* 3x3 Chip Grid */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* We want exactly 3 columns on desktop */
@media (min-width: 768px) {
  .chip-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ranking-chip {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s, background 0.2s;
}

.ranking-chip:hover {
  background: rgba(255,255,255,0.07);
  transform: translateY(-2px);
}

.ranking-chip .rank-number {
  font-size: 20px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.ranking-chip .rank-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ranking-chip .rank-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-chip .rank-score {
  color: var(--g-accent);
  font-size: 13px;
  font-weight: 600;
}

@keyframes slideInF1 {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ============================================ */
/*              TOAST NOTIFICATIONS             */
/* ============================================ */

.toast-item {
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--g-accent);
  color: #fff;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  max-width: 350px;
  word-wrap: break-word;
  pointer-events: auto;
}

.toast-item.fade-out {
  animation: fadeOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* ============================================ */
/*              BADGES                          */
/* ============================================ */
.badge-icon {
  font-size: 14px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  padding: 2px 4px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  transition: transform 0.2s;
}
.badge-icon:hover {
  transform: scale(1.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
