/*
 * 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 Reset (lightweight) */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol { margin: 0; }
ul, ol { padding-left: 1.25rem; }
img { max-width: 100%; display: block; }

/* Theme variables */
:root {
  --bg: #0f172a;           /* slate-900 */
  --panel: #0b1226;        /* slightly darker */
  --elev: #111b36;         /* elevated panel */
  --text: #e2e8f0;         /* slate-200 */
  --muted: #94a3b8;        /* slate-400 */
  --primary: #3b82f6;      /* blue-500 */
  --primary-700: #1d4ed8;  /* blue-700 */
  --accent: #22d3ee;       /* cyan-400 */
  --border: #1e293b;       /* slate-800 */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(2, 6, 23, 0.5);
}

body.app-body {
  background: radial-gradient(1200px 800px at 80% -10%, rgba(56, 189, 248, 0.15), transparent 60%),
              radial-gradient(900px 700px at -10% 20%, rgba(99, 102, 241, 0.18), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
}

/* Readability fixes for light background elements (forms and code blocks) */

label { color: var(--text); }

/* Pre/code blocks on light panels should render dark text */
pre, code, pre code {
  color: #111;
}

pre {
  background: #f8f8f8;
  border: 1px solid #e5e7eb; /* gray-200 */
  border-radius: 6px;
  overflow: auto;
}

.container {
  width: min(1200px, 92%);
  margin-inline: auto;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(2, 6, 23, 0.55);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand-link::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--primary));
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.6);
}

.top-nav__link { color: var(--text); opacity: 0.9; text-decoration: none; margin-left: 1rem; font-weight: 600; }
.top-nav__link:hover { opacity: 1; }
.top-nav__link:focus-visible { outline: 2px solid rgba(34, 211, 238, 0.6); outline-offset: 2px; border-radius: 6px; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0 2rem;
}

.sidebar {
  background: linear-gradient(180deg, rgba(17, 27, 54, 0.85), rgba(11, 18, 38, 0.85));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 74px;
  height: fit-content;
}

.sidebar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.sidebar-section { margin-bottom: 1rem; }
.sidebar-section.muted { opacity: 0.9; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin: 0.25rem 0; }
.sidebar-nav a {
  display: block;
  padding: 0.5rem 0.6rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid transparent;
}
.sidebar-nav a:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.35);
}
.sidebar-nav a:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.6);
  outline-offset: 2px;
}
.sidebar-nav a[aria-current="page"],
.sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.5);
}

.content {
  background: linear-gradient(180deg, rgba(17, 27, 54, 0.9), rgba(11, 18, 38, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* Cards, panels */
.card {
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

/* Typography helpers */
.muted { color: var(--muted); }
h1, .h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.75rem; }
h2, .h2 { font-size: 1.3rem; font-weight: 700; margin: 1rem 0 0.5rem; }

/* Links (global) */
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration: underline;
  color: #7dd3fc; /* lighter cyan for better hover visibility */
}
a:visited {
  color: #86efac; /* subtle green-tinted visited to keep contrast on dark */
}
a:active {
  color: var(--primary);
}
a:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.6);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Link utility classes */
.link-muted { color: var(--muted); }
.link-muted:hover { color: var(--text); text-decoration: underline; }
.link-danger { color: var(--danger); }
.link-danger:hover { filter: brightness(1.1); text-decoration: underline; }

/* Forms */
label { display: block; font-weight: 600; margin: 0.5rem 0 0.25rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
  width: 100%;
  background: #0b142b;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}
input::placeholder, textarea::placeholder { color: #7a8aa6; }

.btn, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(180deg, var(--primary), var(--primary-700));
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover, button:hover, input[type="submit"]:hover { filter: brightness(1.05); }
.btn.secondary { background: #334155; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
thead th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; }
tbody tr:hover { background: rgba(30, 41, 59, 0.4); }

/* Flash messages */
.flash { padding: 0.6rem 0.75rem; border-radius: 8px; margin-bottom: 0.75rem; border: 1px solid var(--border); }
.flash.notice { background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.35); }
.flash.alert { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.35); }
.flash.success { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.35); }

/* Footer */
.app-footer { color: var(--muted); border-top: 1px solid var(--border); margin-top: 1.25rem; }
.app-footer .container { padding: 1rem 0 2rem; font-size: 0.9rem; }

/* Responsive */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; order: 2; }
}
