/* ═══════════════════════════════════════════════════════════════════════════════
   PLESK CLIENT PANEL — Design System
   Tema: Dark Industrial / Utility-first
   ═══════════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

/* ─── VARIABLES ──────────────────────────────────────────────────────────────── */
:root {
  --bg-base:      #0d0f14;
  --bg-panel:     #13161e;
  --bg-card:      #1a1d27;
  --bg-card-hover:#1f2335;
  --bg-input:     #0f1119;
  --border:       #252836;
  --border-light: #2e3347;

  --text-primary:   #e8eaf0;
  --text-secondary: #8b90a7;
  --text-muted:     #555a72;
  --text-code:      #a0d4b5;

  --accent:         #4f8ef7;
  --accent-dim:     #1e3a6e;
  --accent-glow:    rgba(79,142,247,.15);

  --green:    #3dd68c;
  --green-dim:#1a3d2e;
  --red:      #f56565;
  --red-dim:  #3d1a1a;
  --yellow:   #f6c90e;
  --yellow-dim:#3d3008;
  --orange:   #f0884d;

  --sidebar-w: 240px;
  --header-h:  60px;
  --radius:    8px;
  --radius-sm: 4px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --transition: .18s cubic-bezier(.4,0,.2,1);

  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

/* ─── RESET ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ─── LOGIN PAGE ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,142,247,.06) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61,214,140,.04) 0%, transparent 70%);
  bottom: -50px; right: -50px;
  pointer-events: none;
}
.login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 1.6rem;
  margin-bottom: .75rem;
  box-shadow: 0 0 20px var(--accent-glow);
}
.login-logo h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.login-logo p {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .2rem;
  font-family: var(--font-mono);
}

/* ─── LAYOUT ─────────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-brand .brand-icon {
  width: 34px; height: 34px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}
.sidebar-brand .brand-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.sidebar-brand .brand-version {
  font-size: .65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user .user-info .user-name {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.sidebar-user .user-info .user-role {
  font-size: .7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .75rem 1.25rem .25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1.25rem;
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 400;
  transition: var(--transition);
  cursor: pointer;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}
.nav-item .nav-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
}
.sidebar-footer .nav-item { border-radius: var(--radius-sm); border-left: none; }

/* ─── MAIN CONTENT ───────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.topbar-left .breadcrumb {
  font-size: .72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: .1rem;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
.page-body {
  padding: 1.75rem;
  flex: 1;
}

/* ─── CARDS ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.card-header h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card-body { padding: 1.25rem; }
.card:hover { border-color: var(--border-light); }

/* ─── STAT CARDS ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--accent-dim);  color: var(--accent); }
.stat-icon.green  { background: var(--green-dim);   color: var(--green); }
.stat-icon.yellow { background: var(--yellow-dim);  color: var(--yellow); }
.stat-icon.red    { background: var(--red-dim);     color: var(--red); }
.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  font-family: var(--font-mono);
}
.stat-info .stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* ─── TABLES ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
thead th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-card-hover); color: var(--text-primary); }
td.mono { font-family: var(--font-mono); font-size: .8rem; }

/* ─── FORMULARIOS ────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: .35rem;
  letter-spacing: .02em;
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: .6rem .85rem;
  font-family: var(--font-sans);
  font-size: .875rem;
  transition: var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* ─── BOTONES ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: var(--font-sans);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #3d7de8; filter: brightness(1.1); }
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-light); }
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: #5c2020; }
.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
}
.btn-success:hover { background: #235c3e; }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-xs { padding: .2rem .55rem; font-size: .72rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .02em;
}
.badge-active, .badge-paid   { background: var(--green-dim);  color: var(--green); }
.badge-inactive, .badge-closed { background: var(--red-dim);  color: var(--red); }
.badge-open, .badge-pending  { background: var(--yellow-dim); color: var(--yellow); }
.badge-medium                { background: var(--accent-dim); color: var(--accent); }
.badge-high                  { background: var(--red-dim);    color: var(--orange); }
.badge-low                   { background: var(--green-dim);  color: var(--green); }
.badge-default               { background: var(--border);     color: var(--text-muted); }

/* ─── ALERTAS ────────────────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-success { background: var(--green-dim);  border-color: var(--green);  color: var(--green); }
.alert-error   { background: var(--red-dim);    border-color: var(--red);    color: var(--red); }
.alert-warning { background: var(--yellow-dim); border-color: var(--yellow); color: var(--yellow); }
.alert-info    { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ─── PROGRESS ───────────────────────────────────────────────────────────────── */
.progress-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .25rem;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-ok      { background: var(--green); }
.progress-warning { background: var(--yellow); }
.progress-danger  { background: var(--red); }

/* ─── LOG VIEWER ─────────────────────────────────────────────────────────────── */
.log-viewer {
  background: #090b0f;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.7;
  padding: 1rem;
  max-height: 600px;
  overflow-y: auto;
  color: #9ca3af;
}
.log-viewer .log-line { display: block; padding: .05rem 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.log-viewer .log-error   { color: var(--red); }
.log-viewer .log-warning { color: var(--yellow); }
.log-viewer .log-info    { color: var(--text-code); }
.log-viewer .log-empty   { color: var(--text-muted); font-style: italic; }

/* ─── TICKET CHAT ────────────────────────────────────────────────────────────── */
.ticket-messages { display: flex; flex-direction: column; gap: .75rem; }
.message-bubble {
  max-width: 75%;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  line-height: 1.6;
  position: relative;
}
.message-bubble.user    { background: var(--bg-card); border: 1px solid var(--border); align-self: flex-start; }
.message-bubble.admin   { background: var(--accent-dim); border: 1px solid var(--accent); align-self: flex-end; color: var(--text-primary); }
.message-meta { font-size: .7rem; color: var(--text-muted); margin-top: .35rem; font-family: var(--font-mono); }

/* ─── UTILITIES ──────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.flex    { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.text-muted   { color: var(--text-muted); font-size: .82rem; }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-accent  { color: var(--accent); }
.font-mono    { font-family: var(--font-mono); }
.text-sm      { font-size: .82rem; }
.w-100        { width: 100%; }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: .875rem; }
.section-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-body { padding: 1rem; }
}
