/* ─────────────────────────────────────────────
   MT5 VPS Manager — Premium Design System
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
  --sidebar-width:  248px;
  --topbar-height:  64px;

  /* Brand */
  --primary:        #d97706;
  --primary-light:  #fef3c7;
  --primary-glow:   rgba(217,119,6,.18);

  /* Surfaces */
  --body-bg:        #f4f4f5;
  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --sidebar-bg:     #111111;

  /* Text */
  --text-heading:   #111111;
  --text-body:      #374151;
  --text-muted:     #9ca3af;
  --text-faint:     #d1d5db;

  /* Semantic */
  --success:        #16a34a;
  --danger:         #dc2626;
  --warning:        #d97706;
  --info:           #0ea5e9;

  /* Shadows — layered for true 3D depth */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06),  0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-xl:  0 16px 40px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.05);

  /* Radii */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family:  var(--font);
  font-weight:  400;
  font-size:    14px;
  line-height:  1.6;
  background:   var(--body-bg);
  color:        var(--text-body);
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display:    flex;
  align-items: center;
  justify-content: center;
  background: #111111; /* Solid. No gradient. */
}

.login-container {
  width:     100%;
  max-width: 400px;
  padding:   1.5rem;
}

.login-card {
  background:    var(--surface);
  border-radius: var(--radius-xl);
  padding:       2.75rem 2.25rem;
  box-shadow:    var(--shadow-xl);
}

.login-brand {
  text-align:    center;
  margin-bottom: 2.25rem;
}

.brand-icon {
  font-size: 2.25rem;
  color:     var(--primary);
  display:   block;
  margin-bottom: .6rem;
}

.brand-name {
  font-size:   1.25rem;
  font-weight: 600;
  color:       var(--text-heading);
  letter-spacing: -.025em;
}

.brand-sub {
  font-size:  .8rem;
  color:      var(--text-muted);
  margin-top: .2rem;
}

.login-card .form-label {
  color:       var(--text-body);
  font-size:   .82rem;
  font-weight: 500;
  margin-bottom: .4rem;
}

.login-card .form-control {
  background:    var(--body-bg);
  border:        1px solid var(--text-faint);
  border-radius: var(--radius-sm);
  color:         var(--text-heading);
  font-size:     .88rem;
  height:        40px;
  transition:    border-color .15s, box-shadow .15s;
}

.login-card .form-control:focus {
  background:  #fff;
  border-color: var(--primary);
  box-shadow:  0 0 0 3px var(--primary-glow);
  outline:     none;
}

.login-card .input-group-text {
  background:  var(--body-bg);
  border:      1px solid var(--text-faint);
  color:       var(--text-muted);
}

.login-card .btn-outline-secondary {
  background:  var(--body-bg);
  border:      1px solid var(--text-faint);
  color:       var(--text-muted);
}

.login-card .btn-outline-secondary:hover {
  background: #fff;
  color:      var(--text-body);
}

.btn-login {
  height:        44px;
  font-size:     .88rem;
  font-weight:   500;
  letter-spacing: .01em;
  border-radius: var(--radius-sm);
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
}

/* ─────────────────────────────────────────────
   APP LAYOUT
   ───────────────────────────────────────────── */

.app-layout {
  display:    flex;
  min-height: 100vh;
  position:   relative;
}

/* ─────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────── */

.sidebar {
  width:         var(--sidebar-width);
  background:    var(--sidebar-bg);
  position:      fixed;
  top:    1rem;
  left:   1rem;
  bottom: 1rem;
  border-radius: var(--radius-xl);
  box-shadow:    var(--shadow-xl);
  display:       flex;
  flex-direction: column;
  z-index:       100;
  overflow:      hidden;
  transition:    all .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  height:      var(--topbar-height);
  display:     flex;
  align-items: center;
  padding:     0 1.25rem;
  gap:         .65rem;
  flex-shrink: 0;
}

.sidebar-brand-icon {
  font-size: 1.45rem;
  color:     var(--primary);
}

.sidebar-brand-text {
  font-size:      .9rem;
  font-weight:    500;
  color:          #fff;
  white-space:    nowrap;
  letter-spacing: -.01em;
}

/* Thin separator under brand */
.sidebar-brand::after {
  content: '';
  position: absolute;
  left: 1.25rem; right: 1.25rem;
  top: var(--topbar-height);
  height: 1px;
  background: rgba(255,255,255,.06);
}

.sidebar-nav {
  flex:       1;
  overflow-y: auto;
  padding:    1rem 0;
}

.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-title {
  font-size:      .65rem;
  font-weight:    500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color:          rgba(255,255,255,.25);
  padding:        .75rem 1.5rem .3rem;
}

.sidebar-nav .nav-link {
  display:     flex;
  align-items: center;
  gap:         .65rem;
  padding:     .55rem .85rem;
  margin:      .15rem .75rem;
  color:       rgba(255,255,255,.5);
  font-size:   .84rem;
  font-weight: 400;
  border-radius: var(--radius-md);
  transition:  all .18s ease;
  white-space: nowrap;
  text-decoration: none;
}

.sidebar-nav .nav-link i {
  font-size: .95rem;
  width:     18px;
  text-align: center;
  opacity:   .7;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.06);
  color:      rgba(255,255,255,.85);
}

.sidebar-nav .nav-link:hover i { opacity: 1; }

.sidebar-nav .nav-link.active {
  background: var(--primary);
  color:      #111;
  font-weight: 500;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-footer {
  padding:    1rem 1.25rem;
  flex-shrink: 0;
}

.sidebar-footer::before {
  content: '';
  display: block;
  height:  1px;
  background: rgba(255,255,255,.06);
  margin-bottom: .85rem;
}

.sidebar-footer .admin-info {
  display:     flex;
  align-items: center;
  gap:         .6rem;
}

.sidebar-footer .admin-avatar {
  width:         32px;
  height:        32px;
  border-radius: var(--radius-sm);
  background:    var(--primary);
  color:         #111;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-weight:   600;
  font-size:     .78rem;
  flex-shrink:   0;
}

.sidebar-footer .admin-name {
  font-size:   .8rem;
  font-weight: 500;
  color:       rgba(255,255,255,.8);
  line-height: 1.3;
}

.sidebar-footer .admin-role {
  font-size: .7rem;
  color:     rgba(255,255,255,.3);
}

.sidebar-footer .logout-btn {
  display:         inline-flex;
  align-items:     center;
  gap:             .35rem;
  margin-top:      .65rem;
  font-size:       .76rem;
  font-weight:     400;
  color:           rgba(255,255,255,.3);
  text-decoration: none;
  transition:      color .15s;
}

.sidebar-footer .logout-btn:hover { color: var(--danger); }

/* ─────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────── */

.main-content {
  margin-left: calc(var(--sidebar-width) + 2rem);
  padding-right: 1rem;
  flex:          1;
  display:       flex;
  flex-direction: column;
  min-width:     0;
}

/* ─────────────────────────────────────────────
   TOPBAR
   ───────────────────────────────────────────── */

.topbar {
  height:           var(--topbar-height);
  background:       rgba(244,244,245,.85);
  backdrop-filter:  blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display:          flex;
  align-items:      center;
  padding:          0 1.5rem;
  gap:              1rem;
  position:         sticky;
  top:              0;
  z-index:          50;
}

.topbar-title {
  font-size:      .9rem;
  font-weight:    500;
  color:          var(--text-heading);
  letter-spacing: -.01em;
}

.topbar-spacer { flex: 1; }

.topbar-badge {
  display:       flex;
  align-items:   center;
  gap:           .35rem;
  font-size:     .75rem;
  color:         var(--text-muted);
  background:    var(--surface);
  border-radius: 20px;
  padding:       .3rem .85rem;
  box-shadow:    var(--shadow-xs);
}

/* ─────────────────────────────────────────────
   PAGE CONTENT
   ───────────────────────────────────────────── */

.page-content { padding: 1.5rem 1.5rem 2rem; flex: 1; }

/* ─────────────────────────────────────────────
   STAT CARDS — shadow elevation, no border
   ───────────────────────────────────────────── */

.stat-card {
  background:    var(--surface);
  border-radius: var(--radius-lg);
  padding:       1.35rem 1.5rem;
  display:       flex;
  align-items:   center;
  gap:           1rem;
  box-shadow:    var(--shadow-md);
  transition:    box-shadow .2s ease, transform .2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform:  translateY(-1px);
}

.stat-icon {
  width:         44px;
  height:        44px;
  border-radius: var(--radius-md);
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     1.2rem;
  flex-shrink:   0;
}

.stat-icon.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.orange { background: var(--primary-light); color: var(--primary); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }
.stat-icon.teal   { background: #f0fdfa; color: #0d9488; }

.stat-value {
  font-size:   1.65rem;
  font-weight: 500;
  line-height: 1;
  color:       var(--text-heading);
  letter-spacing: -.02em;
}

.stat-label {
  font-size:  .75rem;
  color:      var(--text-muted);
  margin-top: .25rem;
  font-weight: 400;
}

/* ─────────────────────────────────────────────
   PANELS — shadow only, no border
   ───────────────────────────────────────────── */

.panel {
  background:    var(--surface);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow-md);
  overflow:      hidden;
}

.panel-header {
  padding:     .9rem 1.25rem;
  display:     flex;
  align-items: center;
  gap:         .6rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
}

.panel-title {
  font-size:   .84rem;
  font-weight: 500;
  color:       var(--text-heading);
  flex:        1;
  letter-spacing: -.01em;
}

.panel-body { padding: 1.25rem; }

/* ─────────────────────────────────────────────
   TABLES — minimal, open, no heavy borders
   ───────────────────────────────────────────── */

.table-wrapper { overflow-x: auto; }

.data-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       .82rem;
}

.data-table th {
  background:     transparent;
  color:          var(--text-muted);
  font-size:      .7rem;
  font-weight:    500;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding:        .6rem 1.25rem;
  border-bottom:  1px solid rgba(0,0,0,.05);
  white-space:    nowrap;
}

.data-table td {
  padding:       .8rem 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
  vertical-align: middle;
  color:         var(--text-body);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background .12s ease;
}

.data-table tbody tr:hover {
  background: rgba(0,0,0,.018);
}

/* ─────────────────────────────────────────────
   STATUS BADGES
   ───────────────────────────────────────────── */

.status-badge {
  display:       inline-flex;
  align-items:   center;
  gap:           .3rem;
  padding:       .18rem .6rem;
  border-radius: 20px;
  font-size:     .7rem;
  font-weight:   500;
  white-space:   nowrap;
  letter-spacing: .01em;
}

.status-badge::before {
  content:       '';
  width:         5px;
  height:        5px;
  border-radius: 50%;
  background:    currentColor;
}

.badge-trial_active  { background: #eff6ff; color: #3b82f6; }
.badge-paid_active   { background: #f0fdf4; color: var(--success); }
.badge-trial_expired { background: #fffbeb; color: var(--warning); }
.badge-suspended     { background: #fef2f2; color: var(--danger); }
.badge-cancelled     { background: #f9fafb; color: var(--text-muted); }
.badge-paid          { background: #f0fdf4; color: var(--success); }
.badge-unpaid        { background: #fffbeb; color: var(--warning); }
.badge-overdue       { background: #fef2f2; color: var(--danger); }

/* ─────────────────────────────────────────────
   RESOURCE BARS
   ───────────────────────────────────────────── */

.resource-bar { margin-bottom: 1.1rem; }

.resource-bar .label-row {
  display:         flex;
  justify-content: space-between;
  font-size:       .77rem;
  margin-bottom:   .35rem;
  color:           var(--text-muted);
}

.resource-bar .label-row .val {
  font-weight: 500;
  color:       var(--text-body);
}

.progress-slim {
  height:        5px;
  border-radius: 3px;
  background:    var(--body-bg);
  overflow:      hidden;
}

.progress-slim .bar {
  height:        100%;
  border-radius: 3px;
  transition:    width .5s cubic-bezier(.4,0,.2,1);
}

.bar-ok      { background: var(--success); }
.bar-warning { background: var(--warning); }
.bar-danger  { background: var(--danger); }

/* ─────────────────────────────────────────────
   ALERT BANNERS
   ───────────────────────────────────────────── */

.alert-banner {
  border-radius: var(--radius-sm);
  padding:       .6rem 1rem;
  font-size:     .82rem;
  display:       flex;
  align-items:   flex-start;
  gap:           .5rem;
  margin-bottom: .5rem;
}

/* ─────────────────────────────────────────────
   BULK ACTION BAR
   ───────────────────────────────────────────── */

.bulk-bar {
  background:    var(--primary-light);
  border-radius: var(--radius-sm);
  padding:       .55rem 1rem;
  display:       flex;
  align-items:   center;
  gap:           .75rem;
  margin-bottom: .75rem;
  font-size:     .82rem;
  box-shadow:    var(--shadow-xs);
}

.bulk-bar .bulk-count {
  font-weight: 500;
  color:       var(--text-heading);
}

/* ─────────────────────────────────────────────
   MESSAGE THREAD
   ───────────────────────────────────────────── */

.message-item {
  padding:       .9rem 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
}

.message-item:last-child { border-bottom: none; }

.message-meta {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   .3rem;
}

.message-subject { font-weight: 500; font-size: .83rem; color: var(--text-heading); }
.message-date    { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }

.message-body {
  font-size:    .8rem;
  color:        var(--text-muted);
  white-space:  pre-wrap;
  line-height:  1.55;
}

.message-channel {
  font-size:      .65rem;
  font-weight:    500;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding:        .1rem .45rem;
  border-radius:  4px;
}

.channel-email    { background: #eff6ff; color: #3b82f6; }
.channel-manual   { background: #f9fafb; color: var(--text-muted); }
.channel-whatsapp { background: #f0fdf4; color: #16a34a; }

/* ─────────────────────────────────────────────
   MODALS — elevated, clean
   ───────────────────────────────────────────── */

.modal-content {
  border:        none;
  border-radius: var(--radius-xl);
  box-shadow:    var(--shadow-xl);
}

.modal-header {
  border-bottom:  1px solid rgba(0,0,0,.05);
  padding:        1.15rem 1.5rem;
}

.modal-footer {
  border-top:  1px solid rgba(0,0,0,.05);
  padding:     1rem 1.5rem;
}

.modal-title {
  font-size:   .92rem;
  font-weight: 500;
  color:       var(--text-heading);
}

/* ─────────────────────────────────────────────
   FORM CONTROLS — unified style
   ───────────────────────────────────────────── */

.form-control, .form-select {
  border:        1px solid rgba(0,0,0,.1);
  border-radius: var(--radius-sm);
  font-size:     .84rem;
  color:         var(--text-body);
  background:    var(--body-bg);
  transition:    border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow:   0 0 0 3px var(--primary-glow);
  background:   #fff;
  outline:      none;
}

.form-label {
  font-size:   .8rem;
  font-weight: 500;
  color:       var(--text-body);
  margin-bottom: .35rem;
}

.form-text {
  font-size: .75rem;
  color:     var(--text-muted);
}

/* ─────────────────────────────────────────────
   BUTTONS — refined, not heavy
   ───────────────────────────────────────────── */

.btn {
  font-size:     .82rem;
  font-weight:   500;
  border-radius: var(--radius-sm);
  transition:    all .15s ease;
  letter-spacing: .01em;
}

.btn-primary {
  background:   var(--primary);
  border-color: var(--primary);
  color:        #111;
}

.btn-primary:hover {
  background:   #b45309;
  border-color: #b45309;
  color:        #111;
  box-shadow:   0 4px 12px var(--primary-glow);
}

.btn-xs {
  padding:       .22rem .55rem;
  font-size:     .73rem;
  border-radius: 6px;
  line-height:   1.4;
}

/* ─────────────────────────────────────────────
   UTILITY
   ───────────────────────────────────────────── */

.text-mono {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size:   .82em;
}

.empty-state {
  text-align: center;
  padding:    3rem 1rem;
  color:      var(--text-muted);
}

.empty-state i {
  font-size:     2rem;
  display:       block;
  margin-bottom: .65rem;
  opacity:       .3;
}

.empty-state p {
  margin:    0;
  font-size: .84rem;
}

/* ─────────────────────────────────────────────
   MOBILE SIDEBAR
   ───────────────────────────────────────────── */

.sidebar-toggle {
  display:      none;
  background:   none;
  border:       none;
  font-size:    1.2rem;
  color:        var(--text-body);
  cursor:       pointer;
  padding:      .25rem .4rem;
  margin-right: .4rem;
  border-radius: var(--radius-sm);
  transition:   background .12s;
}

.sidebar-toggle:hover { background: rgba(0,0,0,.05); }

.sidebar-overlay {
  display:    none;
  position:   fixed;
  inset:      0;
  background: rgba(0,0,0,.4);
  z-index:    99;
  backdrop-filter: blur(2px);
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    top: 0; left: 0; bottom: 0;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

  .sidebar.open          { transform: translateX(0); }
  .sidebar-overlay.open  { display: block; }
  .main-content          { margin-left: 0; padding-right: 0; }
  .sidebar-toggle        { display: flex; align-items: center; }
  .page-content          { padding: 1rem; }
}
