/* RTR Domain Manager — Light Theme */

:root {
  /* Palette principale */
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-light:  #eff6ff;
  --accent-border: #bfdbfe;

  /* Superfici */
  --bg-page:  #f1f5f9;
  --bg-card:  #ffffff;
  --bg-input: #ffffff;
  --bg-thead: #f8fafc;
  --bg-hover: #f8fafc;

  /* Bordi */
  --border:       #e2e8f0;
  --border-input: #cbd5e1;

  /* Testo */
  --text:       #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Stato */
  --green:        #16a34a;
  --green-light:  #f0fdf4;
  --green-border: #bbf7d0;
  --red:          #dc2626;
  --red-light:    #fef2f2;
  --red-border:   #fecaca;
  --yellow:       #d97706;
  --yellow-light: #fffbeb;
  --yellow-border:#fde68a;
  --orange:       #ea580c;

  /* Forme */
  --radius:  8px;
  --radius-lg: 12px;
  --shadow:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 58px;
  position: sticky; top: 0; z-index: 100;
  gap: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.navbar-brand {
  display: flex; align-items: center; gap: .5rem;
  flex-shrink: 0; margin-right: .5rem;
}
.brand-icon { font-size: 1.3rem; }
.brand-name {
  font-weight: 700; font-size: 1rem; color: var(--text);
  white-space: nowrap;
}
.brand-name:hover { color: var(--accent); text-decoration: none; }

.navbar-menu {
  display: flex; list-style: none; gap: .1rem;
  overflow-x: auto; flex: 1;
}
.navbar-menu a {
  display: block; padding: .4rem .75rem; border-radius: 6px;
  color: var(--text-muted); font-size: .82rem; white-space: nowrap;
  font-weight: 500; transition: all .15s;
}
.navbar-menu a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.navbar-menu a.active {
  background: var(--accent-light); color: var(--accent);
  font-weight: 600;
}

/* ── Navbar utente ───────────────────────────────────────────── */
.navbar-user {
  display: flex; align-items: center; gap: .75rem; flex-shrink: 0;
  padding-left: 1rem; border-left: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: .6rem; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.user-role { font-size: .72rem; color: var(--text-muted); }
.btn-logout {
  padding: .35rem .6rem; border-radius: 6px; font-size: 1.1rem;
  color: var(--text-muted); transition: all .15s; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; display: flex; align-items: center;
}
.btn-logout:hover { background: var(--red-light); color: var(--red); border-color: var(--red-border); text-decoration: none; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  font-size: .62rem; font-weight: 700; padding: .2rem .5rem;
  border-radius: 4px; letter-spacing: .04em; text-transform: uppercase;
}
.badge-prod { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-ote  { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ── Layout principale ───────────────────────────────────────── */
.main-content { max-width: 1400px; margin: 0 auto; padding: 1.75rem 1.5rem; }
.page-header { margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: .9rem; font-weight: 600; color: var(--text);
  margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}

/* ── Stats grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr));
  gap: 1rem; margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%; background: var(--accent);
  border-radius: 4px 0 0 4px;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; font-weight: 500; }

/* ── Tabelle ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead th {
  background: var(--bg-thead); padding: .65rem 1rem;
  text-align: left; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: .7rem 1rem; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; margin-bottom: .35rem; font-size: .82rem;
  font-weight: 500; color: var(--text);
}
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], select, textarea {
  width: 100%; padding: .55rem .8rem;
  background: var(--bg-input); border: 1px solid var(--border-input);
  border-radius: var(--radius); color: var(--text); font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
input[type="checkbox"] { width: auto; margin-right: .4rem; }
textarea { min-height: 80px; resize: vertical; }
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
small.text-muted { display: block; margin-top: .25rem; font-size: .76rem; }

/* ── Pulsanti ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius);
  font-size: .84rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-success {
  background: var(--green-light); color: var(--green); border-color: var(--green-border);
}
.btn-success:hover { background: #dcfce7; color: var(--green); }

.btn-danger {
  background: var(--red-light); color: var(--red); border-color: var(--red-border);
}
.btn-danger:hover { background: #fee2e2; color: var(--red); }

.btn-warn {
  background: var(--yellow-light); color: var(--yellow); border-color: var(--yellow-border);
}
.btn-warn:hover { background: #fef3c7; color: var(--yellow); }

.btn-ghost {
  background: #fff; color: var(--text-muted); border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: .3rem .65rem; font-size: .78rem; }

/* ── Alert ───────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: .875rem;
  display: flex; align-items: flex-start; gap: .5rem;
}
.alert-success { background: var(--green-light); border: 1px solid var(--green-border); color: #15803d; }
.alert-error   { background: var(--red-light);   border: 1px solid var(--red-border);   color: var(--red); }
.alert-warning { background: var(--yellow-light); border: 1px solid var(--yellow-border); color: var(--yellow); }
.alert-info    { background: var(--accent-light); border: 1px solid var(--accent-border); color: var(--accent); }

/* ── Status badge ────────────────────────────────────────────── */
.status {
  display: inline-block; padding: .2rem .55rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
}
.status-active   { background: #dcfce7; color: #15803d; }
.status-expired  { background: var(--red-light); color: var(--red); }
.status-pending  { background: var(--yellow-light); color: var(--yellow); }
.status-inactive { background: #f1f5f9; color: var(--text-light); }
.status-ok       { background: #dcfce7; color: #15803d; }
.status-error    { background: var(--red-light); color: var(--red); }

/* ── Search bar ──────────────────────────────────────────────── */
.search-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 200px; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .35rem .75rem; border-radius: 6px; font-size: .82rem;
  border: 1px solid var(--border); background: #fff;
}
.pagination a { color: var(--text-muted); }
.pagination a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Dettagli dominio ────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.detail-item { margin-bottom: .85rem; }
.detail-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.detail-value { font-size: .9rem; margin-top: .2rem; color: var(--text); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.4);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem; max-width: 560px; width: 90%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.3rem; line-height: 1; padding: .25rem; border-radius: 4px; }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-footer { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  background: #fff; border-top: 1px solid var(--border);
  text-align: center; padding: 1rem 1.5rem;
  font-size: .78rem; color: var(--text-muted); margin-top: 2rem;
}

/* ── Code / pre ──────────────────────────────────────────────── */
pre.code {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 6px; padding: 1rem; overflow-x: auto;
  font-size: .78rem; color: var(--text-muted); white-space: pre-wrap;
  font-family: 'Cascadia Code', 'Fira Mono', monospace;
}
code { font-family: 'Cascadia Code', 'Fira Mono', monospace; font-size: .85em; }

/* ── Utility ─────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap     { gap: .75rem; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: .8rem; }
.text-mono    { font-family: 'Cascadia Code', 'Fira Mono', monospace; font-size: .85em; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }
.mb-2         { margin-bottom: 1rem; }
.actions      { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.empty-state  { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; display: block; }
.check-available { color: var(--green); font-weight: 600; }
.check-taken     { color: var(--red);   font-weight: 600; }

/* ── Login page ──────────────────────────────────────────────── */
body.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.5rem;
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.25rem; font-weight: 700; }
.login-logo p { font-size: .83rem; color: var(--text-muted); margin-top: .2rem; }
.login-footer { text-align: center; margin-top: 1.25rem; font-size: .78rem; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .navbar-user .user-details { display: none; }
  .navbar { padding: 0 1rem; gap: .75rem; }
  .main-content { padding: 1rem; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid-3, .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .navbar-menu { display: none; }
}
