/* ============================================
   VP HOSTING - WHMCS Custom Theme
   Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #5B5FC7;
  --primary-dark: #4A4DAF;
  --primary-light: #EEF0FF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #6366F1;
  --info-light: #EDE9FE;
  --teal: #14B8A6;
  --teal-light: #CCFBF1;
  --bg: #F4F5FB;
  --white: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ============ TOP BAR ============ */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 8px 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  font-size: 13px;
}

.topbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  position: relative;
}

.topbar-item:hover { background: var(--bg); }

.topbar-item .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--warning);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.topbar-item .badge.danger { background: var(--danger); }

.lang-select {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

/* ============ NAVBAR ============ */
.navbar {
  background: var(--primary);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(91, 95, 199, 0.4);
}

.navbar-brand {
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
  padding: 16px 0;
  margin-right: 32px;
  white-space: nowrap;
}

.navbar-nav {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 2px;
}

.nav-link {
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
  font-weight: 500;
  padding: 18px 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s, background 0.15s;
  border-radius: 0;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: white;
  background: rgba(255,255,255,0.12);
}

.nav-link svg { width: 12px; height: 12px; }

.navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  position: relative;
}

.navbar-user:hover { background: rgba(255,255,255,0.12); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  border: 2px solid rgba(255,255,255,0.4);
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Dropdown */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 6px 0;
  display: none;
  z-index: 200;
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13.5px;
  transition: background 0.12s;
  cursor: pointer;
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}

/* ============ LAYOUT ============ */
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  gap: 20px;
  align-items: start;
}

/* ============ CARD ============ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.card-header svg, .card-header i {
  color: var(--text-secondary);
  font-size: 15px;
}

.card-body { padding: 16px 18px; }

/* ============ LEFT SIDEBAR ============ */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.info-card .card-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.info-card .card-body strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}

.info-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}

.info-link:hover { text-decoration: underline; }

.shortcut-list { display: flex; flex-direction: column; gap: 2px; }

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.shortcut-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

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

.shortcut-item.logout { color: var(--danger); }
.shortcut-item.logout:hover { background: var(--danger-light); color: var(--danger); }

/* ============ MAIN CONTENT ============ */
.main-content { display: flex; flex-direction: column; gap: 20px; }

.welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

/* ============ STAT CARDS ============ */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-info { display: flex; flex-direction: column; gap: 3px; }

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.purple { background: var(--info-light); color: var(--info); }
.stat-icon.blue { background: #DBEAFE; color: #3B82F6; }
.stat-icon.green { background: var(--success-light); color: var(--success); }

.stat-footer {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-footer span.count {
  font-weight: 700;
  color: var(--danger);
}

.stat-footer span.count.orange { color: var(--warning); }
.stat-footer span.count.blue { color: #3B82F6; }
.stat-footer span.count.red { color: var(--danger); }

/* ============ CHART CARD ============ */
.chart-card .card-header {
  justify-content: space-between;
}

.chart-filters { display: flex; align-items: center; gap: 8px; }

.chart-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: white;
  cursor: pointer;
  outline: none;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.blue { background: var(--primary); }
.legend-dot.purple { background: #C4B5FD; }

/* ============ RIGHT SIDEBAR ============ */
.right-sidebar { display: flex; flex-direction: column; gap: 16px; }

/* Calendar */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.calendar-month {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.calendar-nav { display: flex; gap: 6px; }

.cal-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-size: 12px;
}

.cal-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

.calendar-grid {
  padding: 12px 14px;
}

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
}

.calendar-days-header span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  font-weight: 500;
}

.cal-day:hover { background: var(--primary-light); color: var(--primary); }
.cal-day.other-month { color: var(--text-muted); }
.cal-day.today {
  background: var(--primary);
  color: white;
  font-weight: 700;
}
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

/* Support Tickets */
.tickets-list { display: flex; flex-direction: column; }

.ticket-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s;
  cursor: pointer;
}

.ticket-item:last-child { border-bottom: none; }
.ticket-item:hover { background: var(--bg); }

.ticket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.badge-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-status.open { background: #FEF3C7; color: #D97706; }
.badge-status.closed { background: var(--success-light); color: #059669; }
.badge-status.affiliate { background: var(--info-light); color: var(--info); }
.badge-status.pending { background: #FEE2E2; color: #DC2626; }

.ticket-time {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
}

.ticket-subject {
  font-size: 12px;
  color: var(--text-secondary);
}

.open-ticket-btn {
  display: block;
  text-align: center;
  padding: 13px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13.5px;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}

.open-ticket-btn:hover { background: var(--primary-light); }

/* ============ FOOTER ============ */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 40px;
}

.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--primary); }

/* ============ LOGIN PAGE ============ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

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

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

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 95, 199, 0.12);
  background: white;
}

.form-control::placeholder { color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  padding: 13px;
}

.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-footer a { color: var(--primary); font-weight: 600; }

/* ============ PAGE HEADER ============ */
.page-header {
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.breadcrumb a { color: var(--primary); }
.breadcrumb span { color: var(--text-muted); }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  background: var(--bg);
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: var(--bg); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p { font-size: 14px; }

/* ============ INVOICE BADGE ============ */
.badge-invoice {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge-invoice.paid { background: var(--success-light); color: #059669; }
.badge-invoice.unpaid { background: #FEE2E2; color: #DC2626; }
.badge-invoice.overdue { background: #FEF3C7; color: #D97706; }
.badge-invoice.cancelled { background: var(--bg); color: var(--text-muted); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 220px 1fr;
  }
  .right-sidebar { display: none; }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }
  .navbar { padding: 0 16px; }
  .page-wrapper { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-card, .card { animation: fadeIn 0.25s ease forwards; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ============================================
   COMPATIBILITY FIXES - Bootstrap / Twenty-One
   ============================================ */

/* Fix body bg for inner pages */
body { background: var(--bg) !important; font-family: 'Inter', -apple-system, sans-serif !important; }

/* Fix Bootstrap form-control to match our theme */
.form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(91,95,199,0.12) !important;
}

/* Navbar override - our purple nav takes priority */
.header, #header { display: none !important; }
.topbar-wrapper { display: none !important; }

/* Page content wrapper fix */
.container-fluid.main-container, .main-content-wrapper {
  padding-top: 20px;
}

/* Fix Bootstrap buttons to match theme primary */
.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  font-family: 'Inter', sans-serif !important;
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
}

/* Fix DataTables */
.dataTables_wrapper { padding: 0 !important; }
table.dataTable thead th {
  background: var(--bg) !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  border-bottom: 1px solid var(--border) !important;
}
table.dataTable tbody td { color: var(--text) !important; }
table.dataTable tbody tr:hover td { background: var(--bg) !important; }

/* Fix badge colors */
.badge-success { background: var(--success-light) !important; color: #059669 !important; }
.badge-danger  { background: var(--danger-light)  !important; color: #DC2626 !important; }
.badge-warning { background: var(--warning-light) !important; color: #D97706 !important; }
.badge-info    { background: var(--info-light)    !important; color: var(--info) !important; }

/* Fix card styling */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}
.card-header {
  background: var(--white) !important;
  border-bottom: 1px solid var(--border) !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  color: var(--text) !important;
}

/* Fix tile stats on dashboard */
.tile {
  background: white !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  text-decoration: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding: 20px !important;
  transition: box-shadow 0.2s !important;
}
.tile:hover { box-shadow: var(--shadow-md) !important; }
.tile .stat { font-size: 28px !important; font-weight: 800 !important; color: var(--text) !important; }
.tile .title { font-size: 12px !important; color: var(--text-secondary) !important; font-weight: 500 !important; }
.tile i { font-size: 22px !important; color: var(--primary) !important; margin-bottom: 8px !important; }
.tile .highlight { display: none !important; }

/* Fix link colors */
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* Improve table responsiveness */
.table-responsive { border: none !important; }
.table th { white-space: nowrap; }

/* Fix status labels/badges */
.label-success { background: var(--success-light) !important; color: #059669 !important; border-radius: 20px !important; font-weight: 600 !important; }
.label-danger  { background: var(--danger-light)  !important; color: #DC2626 !important; border-radius: 20px !important; font-weight: 600 !important; }
.label-warning { background: var(--warning-light) !important; color: #D97706 !important; border-radius: 20px !important; font-weight: 600 !important; }
.label-default { background: var(--bg) !important; color: var(--text-secondary) !important; border-radius: 20px !important; }

/* Fix pagination */
.pagination > li > a, .pagination > li > span {
  color: var(--primary) !important;
  border-color: var(--border) !important;
}
.pagination > .active > a, .pagination > .active > span {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

/* Fix alerts */
.alert-success { background: var(--success-light) !important; border-color: #A7F3D0 !important; color: #065F46 !important; }
.alert-danger  { background: var(--danger-light)  !important; border-color: #FECACA !important; color: #991B1B !important; }
.alert-info    { background: var(--info-light)    !important; border-color: #C7D2FE !important; color: #3730A3 !important; }
.alert-warning { background: var(--warning-light) !important; border-color: #FDE68A !important; color: #92400E !important; }
