/* =========================================================================
   DACHBOXIT Blog Studio — Design System
   Single light theme to match the JSX. Brand color #5BC0DE.
   ========================================================================= */

:root {
  /* Brand */
  --brand: #5BC0DE;
  --brand-dark: #22839E;
  --brand-darker: #33A6C6;
  --brand-glow: rgba(91, 192, 222, 0.18);

  /* Surfaces */
  --bg: #F2F6F9;
  --bg-deep: #E7EDF2;
  --surface: #FFFFFF;
  --surface-hi: #F4F8FB;
  --surface-max: #EAF1F6;

  /* Text */
  --text: #151A1F;
  --text-dim: #525C66;
  --text-mute: #8D8F94;

  /* Lines */
  --border: #DCE4EB;
  --border-strong: #C6D2DB;

  /* Semantic (match artifact _C_LIGHT + brand status palette) */
  --green: #1B9D6A;
  --amber: #B07D15;
  --red: #D2453C;
  --purple: #a78bfa;

  /* Shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}
a:hover { color: var(--brand-darker); text-decoration: underline; }

/* =========================================================================
   Layout
   ========================================================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 4px 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-wordmark {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--brand-dark);
  margin: 0;
  line-height: 1;
}

.sidebar-logo {
  display: block;
  width: auto;
  height: 70px;
  max-width: 100%;
}

.sidebar-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--text-mute);
  margin-top: 6px;
}

.sidebar-sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
}

.nav-item:hover {
  background: var(--bg-deep);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: rgba(91, 192, 222, 0.12);
  color: var(--brand-dark);
}

.nav-item i {
  font-size: 16px;
  width: 18px;
  text-align: center;
}

.nav-item .badge-soon {
  margin-left: auto;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--text-mute);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand);
  color: #04161d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-footer .name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.sidebar-footer .role {
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.sidebar-footer .icon-link {
  margin-left: auto;
  color: var(--text-mute);
  font-size: 18px;
}

.sidebar-footer .icon-link:hover {
  color: var(--red);
}

.main {
  flex: 1;
  padding: 32px;
  max-width: 100%;
  overflow-x: hidden;
}

/* =========================================================================
   Header
   ========================================================================= */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.page-header p {
  font-size: 13px;
  color: var(--text-mute);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all .12s;
  text-decoration: none;
}
.btn:hover { background: var(--bg-deep); color: var(--text); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-darker));
  color: #04161d;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(91, 192, 222, 0.35);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-darker), var(--brand-dark)); color: #04161d; }

.btn-ghost {
  background: transparent;
}

.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(220, 38, 38, 0.08); color: var(--red); }

.btn-block { display: flex; width: 100%; justify-content: center; }

/* =========================================================================
   Cards & panels
   ========================================================================= */

.card {
  background: linear-gradient(155deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: 0 1px 2px rgba(21, 26, 31, 0.04), 0 8px 24px rgba(21, 26, 31, 0.05);
}

.card-flat {
  background: var(--bg-deep);
  border-radius: var(--r-md);
  padding: 16px;
}

/* =========================================================================
   Stat cards (Dashboard)
   ========================================================================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: linear-gradient(155deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(21, 26, 31, 0.04), 0 8px 24px rgba(21, 26, 31, 0.05);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(21, 26, 31, 0.08);
  border-color: var(--border-strong);
}

.stat-card .icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #04161d;
  font-size: 18px;
  margin-bottom: 14px;
}

.stat-card .label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-mute);
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text);
}

/* =========================================================================
   Forms
   ========================================================================= */

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.help {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
}

.form-row { margin-bottom: 14px; }

.form-row .errorlist {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
}

/* =========================================================================
   Password field — eye toggle
   ========================================================================= */

.password-wrap {
  position: relative;
}

.password-wrap .input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 16px;
  border-radius: 6px;
  line-height: 1;
}

.password-toggle:hover {
  color: var(--text);
  background: var(--bg-deep);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* =========================================================================
   Messages / flash
   ========================================================================= */

.flash-area {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin-bottom: 8px;
  font-size: 13px;
  border: 1px solid;
}

.flash.success { background: rgba(5, 150, 105, 0.08); color: var(--green); border-color: rgba(5, 150, 105, 0.3); }
.flash.error   { background: rgba(220, 38, 38, 0.08); color: var(--red);   border-color: rgba(220, 38, 38, 0.3); }
.flash.warning { background: rgba(217, 119, 6, 0.08); color: var(--amber); border-color: rgba(217, 119, 6, 0.3); }
.flash.info    { background: rgba(91, 192, 222, 0.12); color: var(--brand-dark); border-color: rgba(91, 192, 222, 0.4); }

/* =========================================================================
   Login screen
   ========================================================================= */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 10% 0%, rgba(91, 192, 222, 0.10), transparent 50%),
    radial-gradient(circle at 90% 100%, rgba(91, 192, 222, 0.08), transparent 50%),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(21, 26, 31, 0.08);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-wordmark {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 3px;
  color: var(--brand-dark);
  margin: 0 0 8px;
}

.login-logo {
  display: block;
  width: auto;
  height: 96px;
  max-width: 80%;
  margin: 0 auto 8px;
}

.login-card h1 {
  text-align: center;
  font-size: 18px;
  margin: 0 0 22px;
  font-weight: 700;
}

.login-help {
  text-align: center;
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 16px;
}

/* =========================================================================
   Misc utilities
   ========================================================================= */

.muted { color: var(--text-mute); }
.mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.phase-banner {
  background: rgba(91, 192, 222, 0.10);
  border: 1px dashed var(--brand);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--brand-dark);
  margin-bottom: 20px;
}

@media (max-width: 720px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .app-shell { flex-direction: column; }
  .main { padding: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* =========================================================================
   Phase 3 additions — selects, tables, hover rows, etc.
   ========================================================================= */

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237A858F' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea.input {
  font-family: var(--font-mono);
  line-height: 1.6;
  resize: vertical;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Table row hover */
tr[data-href]:hover {
  background: var(--bg-deep);
}
