/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  --color-bg: #070b1a;
  --color-bg-card: #0d1529;
  --color-border: rgba(0, 229, 255, 0.15);
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-cyan: #00e5ff;
  --color-purple: #a855f7;
  --color-pink: #d946ef;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--color-bg);
}

body {
  font-family: var(--font-sans);
  background: transparent;
  color: var(--color-text);
  line-height: 1.6;
}

a:visited {
  color: inherit;
}

a {
  text-decoration: none;
}

/* ============================================
   Site-wide Background (circuit + gradient orbs)
   ============================================ */
.site-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

/* Circuit board SVG background */
.circuit-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.20;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 10%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 50%, black 10%, transparent 100%);
  overflow: hidden;
}

.site-bg__orb {
  position: absolute;
  pointer-events: none;
  filter: blur(80px);
}

.site-bg__orb--cyan {
  top: -10%;
  bottom: -10%;
  right: -14%;
  width: 38%;
  border-radius: 0;
  background: linear-gradient(to left,
      rgba(34, 211, 238, 0) 0%,
      rgba(34, 211, 238, 0.18) 25%,
      rgba(34, 211, 238, 0.28) 45%,
      rgba(34, 211, 238, 0.18) 60%,
      rgba(34, 211, 238, 0.04) 75%,
      rgba(34, 211, 238, 0) 100%);
}

.site-bg__orb--purple {
  top: -10%;
  bottom: -10%;
  left: -14%;
  width: 38%;
  border-radius: 0;
  background: linear-gradient(to right,
      rgba(168, 85, 247, 0) 0%,
      rgba(168, 85, 247, 0.18) 25%,
      rgba(168, 85, 247, 0.28) 45%,
      rgba(168, 85, 247, 0.18) 60%,
      rgba(168, 85, 247, 0.04) 75%,
      rgba(168, 85, 247, 0) 100%);
}

/* Glow overlays animate above the base SVG opacity — let them pop */
.circuit-node-glow {
  pointer-events: none;
}

/* Hero, feature-card, and CTA styles live in desktop.css / mobile.css —
   the homepage is developed independently per device. */

/* ============================================
   Modal Overlay & Dialog
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
}

.modal-overlay--active {
  visibility: visible;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 2.5rem;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
}

.modal-overlay--active .modal {
  transform: translateY(0) scale(1);
}

/* Close button */
.modal__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.modal__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* Modal content */
.modal__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-cyan);
  margin-bottom: 0.5rem;
}

.modal__description {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.6;
  text-align: left;
}

/* ============================================
   Form Styles
   ============================================ */
.modal__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
}

.form-required {
  color: var(--color-cyan);
}

.form-input {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

.form-input:focus {
  border-color: var(--color-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Submit button */
.modal__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple), var(--color-pink));
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: opacity 0.2s, transform 0.2s;
  margin-top: 0.25rem;
}

.modal__submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.modal__submit:active {
  transform: translateY(0);
}

/* ============================================
   Responsive (shared modal)
   ============================================ */
@media (max-width: 768px) {
  .modal {
    margin: 1rem;
    padding: 2rem 1.5rem;
  }
}

/* ============================================
   Auth Pages (Devise Sign In)
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 2.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-cyan);
  margin-bottom: 1.75rem;
  text-align: left;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-checkbox {
  accent-color: var(--color-cyan);
}

.auth-remember-label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.auth-submit {
  width: 100%;
  padding: 0.9rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: opacity 0.2s, transform 0.2s;
  margin-top: 0.25rem;
}

.auth-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
}

.auth-link {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-link:hover {
  color: var(--color-cyan);
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Auth form errors */
.auth-errors {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.auth-errors__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f87171;
  margin-bottom: 0.5rem;
}

.auth-errors__list {
  list-style: none;
  font-size: 0.85rem;
  color: #fca5a5;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ============================================
   Flash Messages
   ============================================ */
.flash-messages {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
  padding: 0 1rem;
}

.flash {
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  animation: flash-in 0.3s ease-out;
}

.flash--notice {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--color-cyan);
}

.flash--alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Admin Messages Grid
   ============================================ */
.admin-messages {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-messages__header {
  display: grid;
  grid-template-columns: 140px 1.4fr 3fr 100px;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.admin-messages__row {
  display: grid;
  grid-template-columns: 140px 1.4fr 3fr 100px;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.admin-messages__row+.admin-messages__row {
  margin-top: 0.4rem;
}

.admin-messages__cell {
  font-size: 0.9rem;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-messages__cell--muted {
  color: var(--color-text-muted);
}

.admin-messages__cell--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
}

.admin-messages__cell--body {
  white-space: normal;
  line-height: 1.5;
}

.admin-messages__empty {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .admin-messages__header {
    display: none;
  }

  .admin-messages__row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.9rem 1rem;
  }
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 1.5rem;
}

.admin-tab {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  transition: color 0.2s, background 0.2s;
}

.admin-tab:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.04);
}

.admin-tab--active {
  color: var(--color-cyan);
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.25);
}

/* Admin Buttons */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.admin-btn--subtle {
  background: rgba(148, 163, 184, 0.1);
  color: var(--color-text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.admin-btn--subtle:hover {
  background: rgba(148, 163, 184, 0.2);
  color: var(--color-text);
}

.admin-messages__cell--actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
