/**
 * Triple S Hosting Manager - Dark Skeuomorphic Design System
 * Visual reference matching: ChatGPT Image Aug 22, 2026, 04_15_13 PM.png
 */

:root {
  --bg-main: #061019;
  --bg-sidebar: #07131d;
  --bg-panel: #0c1a25;
  --bg-panel-hover: #102331;
  --bg-input: #091721;
  --bg-card: #0a1722;

  --border-soft: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-primary: #f5f7fa;
  --text-secondary: #aeb8c3;
  --text-muted: #74818e;

  --primary: #ff9d00;
  --primary-hover: #ffad26;
  --primary-soft: rgba(255, 157, 0, 0.14);
  --primary-glow: rgba(255, 157, 0, 0.25);

  --success: #31d158;
  --success-soft: rgba(49, 209, 88, 0.14);

  --warning: #ff9f0a;
  --warning-soft: rgba(255, 159, 10, 0.14);

  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.14);

  --info: #0a84ff;
  --info-soft: rgba(10, 132, 255, 0.14);

  --purple: #8e5cff;
  --purple-soft: rgba(142, 92, 255, 0.14);

  --font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ==========================================================================
   SKEUOMORPHIC PANELS & CARDS
   ========================================================================== */

.panel {
  background: linear-gradient(145deg, rgba(255,255,255,0.035), rgba(255,255,255,0.006)), var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.panel-hover:hover {
  border-color: var(--border-medium);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   APP LAYOUT (Sidebar + Main Content)
   ========================================================================== */

.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 16px;
  z-index: 100;
  transition: transform 0.3s ease;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 20px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(145deg, #132738, #0a1722);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  font-weight: 600;
}

.sidebar-category {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 8px 12px 12px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 157, 0, 0.08), rgba(255, 255, 255, 0.02));
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(255, 157, 0, 0.35);
  box-shadow: 0 4px 20px rgba(255, 157, 0, 0.1);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px var(--primary);
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.nav-badge {
  background: #152433;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-soft);
}

.nav-badge.alert {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(255, 69, 58, 0.3);
}

/* User Card at Sidebar Bottom */
.user-profile-card {
  margin-top: auto;
  background: #091721;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #162838;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #f5f7fa;
  border: 1px solid var(--border-medium);
}

.user-meta {
  flex: 1;
  margin-left: 10px;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: #f5f7fa;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  padding-bottom: 40px;
}

/* Top Navigation Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-soft);
  background-color: rgba(6, 16, 25, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.search-container {
  position: relative;
  width: 340px;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 38px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-panel-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-main);
}

/* Page Header */
.page-header {
  padding: 24px 32px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary-hover) 0%, var(--primary) 100%);
  color: #061019;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 157, 0, 0.4);
}

.btn-secondary {
  background: var(--bg-panel);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(255, 69, 58, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 69, 58, 0.25);
}

/* ==========================================================================
   DASHBOARD METRICS ROW (6 CARDS)
   ========================================================================== */

.content-body {
  padding: 0 32px 32px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-icon-tile {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon-tile.blue { background: rgba(10, 132, 255, 0.15); color: #0a84ff; }
.metric-icon-tile.cyan { background: rgba(0, 199, 190, 0.15); color: #00c7be; }
.metric-icon-tile.green { background: rgba(49, 209, 88, 0.15); color: #31d158; }
.metric-icon-tile.yellow { background: rgba(255, 159, 10, 0.15); color: #ff9f0a; }
.metric-icon-tile.red { background: rgba(255, 69, 58, 0.15); color: #ff453a; }
.metric-icon-tile.purple { background: rgba(142, 92, 255, 0.15); color: #8e5cff; }

.metric-more {
  color: var(--text-muted);
  cursor: pointer;
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #ffffff;
}

.metric-sub {
  font-size: 12px;
  color: var(--info);
  font-weight: 500;
  margin-top: 6px;
  text-decoration: none;
  display: inline-block;
}

.metric-sub.text-muted { color: var(--text-muted); }
.metric-sub.text-pending { color: var(--purple); font-weight: 600; }

/* ==========================================================================
   MIDDLE SECTION: UPCOMING RENEWALS & PLUGIN STATUS
   ========================================================================== */

.dashboard-middle-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 20px;
  margin-bottom: 24px;
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.card-subtext {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-action-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-soft);
}

.data-table td {
  padding: 16px 20px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }

/* Donut Chart Box */
.donut-container {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
}

.donut-chart-svg {
  width: 160px;
  height: 160px;
  position: relative;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 13px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.legend-val {
  font-weight: 700;
  color: #ffffff;
}

/* ==========================================================================
   BOTTOM MINI CARDS WITH SPARKLINES
   ========================================================================== */

.bottom-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.mini-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 130px;
  position: relative;
  overflow: hidden;
}

.mini-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mini-card-val {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  margin-top: 6px;
}

.mini-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sparkline-svg {
  width: 100%;
  height: 40px;
  margin-top: 8px;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION (HIDDEN ON DESKTOP)
   ========================================================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(7, 19, 29, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-soft);
  z-index: 200;
  padding: 8px 16px env(safe-area-inset-bottom, 8px);
}

.mobile-nav-menu {
  display: flex;
  justify-content: space-around;
  list-style: none;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
}

.mobile-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

/* ==========================================================================
   MODAL & MOBILE BOTTOM SHEET
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 540px;
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #ffffff;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-medium);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  color: #ffffff;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Mobile-First Master Spec)
   ========================================================================== */

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-middle-grid {
    grid-template-columns: 1fr;
  }
  .bottom-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .mobile-bottom-nav {
    display: block;
  }
  .topbar {
    padding: 14px 16px;
  }
  .content-body {
    padding: 0 16px 80px;
  }
  .page-header {
    padding: 16px 16px 12px;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .bottom-cards-grid {
    grid-template-columns: 1fr;
  }
  .search-container {
    width: 200px;
  }
  
  /* Mobile Bottom Sheet Modal Behavior */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
  }
}
