/* ═══════════════════════════════════════════════════════════════
   4KFlexHub Portal — Complete Stylesheet
   Brand: Dark navy background, electric blue + green accents
   ═══════════════════════════════════════════════════════════════ */

:root {
  --fh-bg:           #0a0e1a;
  --fh-surface:      #111827;
  --fh-surface-2:    #1a2235;
  --fh-border:       #1e2d45;
  --fh-accent:       #00b4d8;
  --fh-accent-2:     #00d4a0;
  --fh-accent-glow:  rgba(0, 180, 216, 0.15);
  --fh-text:         #e2e8f0;
  --fh-text-muted:   #64748b;
  --fh-text-dim:     #94a3b8;
  --fh-success:      #10b981;
  --fh-warning:      #f59e0b;
  --fh-danger:       #ef4444;
  --fh-radius:       12px;
  --fh-radius-sm:    8px;
  --fh-shadow:       0 4px 24px rgba(0,0,0,0.4);
  --fh-font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Reset & Base ─────────────────────────────────────────── */
.flexhub-portal * { box-sizing: border-box; margin: 0; padding: 0; }
.flexhub-portal {
  font-family: var(--fh-font);
  background: var(--fh-bg);
  color: var(--fh-text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Layout ───────────────────────────────────────────────── */
.fh-wrapper {
  display: flex;
  min-height: 100vh;
}

.fh-sidebar {
  width: 240px;
  background: var(--fh-surface);
  border-right: 1px solid var(--fh-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.fh-main {
  flex: 1;
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
}

/* ─── Sidebar Logo ─────────────────────────────────────────── */
.fh-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--fh-border);
}
.fh-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--fh-text);
  letter-spacing: -0.5px;
}
.fh-logo-text span {
  color: var(--fh-accent);
}
.fh-logo-sub {
  font-size: 11px;
  color: var(--fh-text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ─── Sidebar Nav ──────────────────────────────────────────── */
.fh-nav {
  padding: 16px 0;
  flex: 1;
}
.fh-nav-section {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--fh-text-muted);
  margin-top: 8px;
}
.fh-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--fh-text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.fh-nav a:hover,
.fh-nav a.active {
  background: var(--fh-accent-glow);
  color: var(--fh-accent);
  border-left-color: var(--fh-accent);
}
.fh-nav a .nav-icon { width: 18px; text-align: center; opacity: 0.8; }

/* ─── Sidebar User ─────────────────────────────────────────── */
.fh-sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--fh-border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.fh-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fh-accent), var(--fh-accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.fh-sidebar-user-info { flex: 1; min-width: 0; }
.fh-sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--fh-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-sidebar-user-role { font-size: 11px; color: var(--fh-text-muted); }
.fh-logout-btn {
  font-size: 12px; color: var(--fh-text-muted); text-decoration: none;
  padding: 4px 8px; border-radius: 6px; transition: all 0.2s;
}
.fh-logout-btn:hover { color: var(--fh-danger); background: rgba(239,68,68,0.1); }

/* ─── Page Header ──────────────────────────────────────────── */
.fh-page-header {
  margin-bottom: 28px;
}
.fh-page-title {
  font-size: 24px; font-weight: 700; color: var(--fh-text);
  display: flex; align-items: center; gap: 10px;
}
.fh-page-subtitle { font-size: 14px; color: var(--fh-text-muted); margin-top: 4px; }

/* ─── Stats Cards ──────────────────────────────────────────── */
.fh-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.fh-stat-card {
  background: var(--fh-surface);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.fh-stat-card:hover { border-color: var(--fh-accent); }
.fh-stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--fh-accent), var(--fh-accent-2));
}
.fh-stat-label { font-size: 12px; color: var(--fh-text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.fh-stat-value { font-size: 28px; font-weight: 800; color: var(--fh-text); margin: 6px 0 2px; line-height: 1; }
.fh-stat-sub { font-size: 12px; color: var(--fh-text-muted); }
.fh-stat-icon {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--fh-accent-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ─── Cards ────────────────────────────────────────────────── */
.fh-card {
  background: var(--fh-surface);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 24px;
  margin-bottom: 20px;
}
.fh-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--fh-border);
}
.fh-card-title { font-size: 16px; font-weight: 700; color: var(--fh-text); }
.fh-card-subtitle { font-size: 13px; color: var(--fh-text-muted); }

/* ─── Subscription Status Card ─────────────────────────────── */
.fh-sub-card {
  background: linear-gradient(135deg, var(--fh-surface) 0%, #0d1829 100%);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 28px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.fh-sub-card::after {
  content: '';
  position: absolute; bottom: -40px; right: -40px;
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--fh-accent-glow);
}
.fh-sub-plan { font-size: 13px; color: var(--fh-accent); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.fh-sub-name { font-size: 26px; font-weight: 800; margin: 6px 0; }
.fh-sub-expiry { font-size: 14px; color: var(--fh-text-muted); }
.fh-sub-expiry strong { color: var(--fh-text); }
.fh-sub-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 12px;
}
.fh-sub-badge.active { background: rgba(16,185,129,0.15); color: var(--fh-success); border: 1px solid rgba(16,185,129,0.3); }
.fh-sub-badge.expired { background: rgba(239,68,68,0.1); color: var(--fh-danger); border: 1px solid rgba(239,68,68,0.2); }
.fh-sub-badge.expiring { background: rgba(245,158,11,0.1); color: var(--fh-warning); border: 1px solid rgba(245,158,11,0.2); }

/* ─── Credentials Box ──────────────────────────────────────── */
.fh-credentials { display: flex; flex-direction: column; gap: 12px; }
.fh-cred-row {
  background: var(--fh-surface-2);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius-sm);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.fh-cred-label { font-size: 11px; color: var(--fh-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; font-weight: 600; }
.fh-cred-value {
  font-size: 14px; font-weight: 600; color: var(--fh-text);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}
.fh-copy-btn {
  background: var(--fh-accent-glow); border: 1px solid rgba(0,180,216,0.3);
  color: var(--fh-accent); padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; white-space: nowrap; margin-left: 12px;
  flex-shrink: 0;
}
.fh-copy-btn:hover { background: rgba(0,180,216,0.25); }
.fh-copy-btn.copied { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: var(--fh-success); }

/* ─── Table ────────────────────────────────────────────────── */
.fh-table-wrap { overflow-x: auto; }
.fh-table { width: 100%; border-collapse: collapse; }
.fh-table th {
  background: var(--fh-surface-2); padding: 12px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--fh-text-muted);
  text-align: left; border-bottom: 1px solid var(--fh-border);
}
.fh-table td {
  padding: 14px 16px; border-bottom: 1px solid rgba(30,45,69,0.5);
  font-size: 14px; color: var(--fh-text);
}
.fh-table tr:hover td { background: var(--fh-accent-glow); }
.fh-table tr:last-child td { border-bottom: none; }

/* ─── Badges / Status ──────────────────────────────────────── */
.fh-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.fh-badge-green  { background: rgba(16,185,129,0.12);  color: #10b981; }
.fh-badge-blue   { background: rgba(0,180,216,0.12);   color: #00b4d8; }
.fh-badge-yellow { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.fh-badge-red    { background: rgba(239,68,68,0.12);   color: #ef4444; }
.fh-badge-gray   { background: rgba(100,116,139,0.15); color: #94a3b8; }

/* ─── Forms ────────────────────────────────────────────────── */
.fh-form-group { margin-bottom: 18px; }
.fh-label { display: block; font-size: 13px; font-weight: 600; color: var(--fh-text-dim); margin-bottom: 6px; }
.fh-input, .fh-select, .fh-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--fh-surface-2); border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius-sm); color: var(--fh-text);
  font-size: 14px; font-family: var(--fh-font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.fh-input:focus, .fh-select:focus, .fh-textarea:focus {
  border-color: var(--fh-accent);
  box-shadow: 0 0 0 3px var(--fh-accent-glow);
}
.fh-textarea { resize: vertical; min-height: 100px; }
.fh-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Buttons ──────────────────────────────────────────────── */
.fh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--fh-radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; border: none; transition: all 0.2s;
  white-space: nowrap;
}
.fh-btn-primary {
  background: linear-gradient(135deg, var(--fh-accent), #0096c7);
  color: #fff; box-shadow: 0 4px 14px rgba(0,180,216,0.3);
}
.fh-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,180,216,0.4); }
.fh-btn-success {
  background: linear-gradient(135deg, var(--fh-success), #059669);
  color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,0.3);
}
.fh-btn-outline {
  background: transparent; border: 1px solid var(--fh-border);
  color: var(--fh-text-dim);
}
.fh-btn-outline:hover { border-color: var(--fh-accent); color: var(--fh-accent); }
.fh-btn-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--fh-danger); }
.fh-btn-sm { padding: 6px 12px; font-size: 12px; }
.fh-btn-full { width: 100%; justify-content: center; }

/* ─── Login Page ───────────────────────────────────────────── */
.fh-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--fh-bg);
  background-image: radial-gradient(ellipse at top, rgba(0,180,216,0.06) 0%, transparent 60%);
}
.fh-login-box {
  width: 100%; max-width: 420px; padding: 20px;
}
.fh-login-logo { text-align: center; margin-bottom: 32px; }
.fh-login-logo-text { font-size: 28px; font-weight: 900; color: var(--fh-text); }
.fh-login-logo-text span { color: var(--fh-accent); }
.fh-login-card {
  background: var(--fh-surface);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 32px;
  box-shadow: var(--fh-shadow);
}
.fh-login-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.fh-login-sub { font-size: 14px; color: var(--fh-text-muted); margin-bottom: 24px; }

/* ─── Alert Messages ───────────────────────────────────────── */
.fh-alert {
  padding: 12px 16px; border-radius: var(--fh-radius-sm);
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.fh-alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.2);  color: #fca5a5; }
.fh-alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: #6ee7b7; }
.fh-alert-info    { background: rgba(0,180,216,0.1);  border: 1px solid rgba(0,180,216,0.2);  color: #7dd3fc; }
.fh-alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: #fcd34d; }

/* ─── Ticket Thread ─────────────────────────────────────────── */
.fh-ticket-thread { display: flex; flex-direction: column; gap: 16px; }
.fh-message-bubble {
  max-width: 80%; padding: 14px 18px;
  border-radius: 12px; font-size: 14px; line-height: 1.6;
}
.fh-message-customer {
  background: var(--fh-surface-2); border: 1px solid var(--fh-border);
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.fh-message-support {
  background: linear-gradient(135deg, rgba(0,180,216,0.12), rgba(0,180,216,0.06));
  border: 1px solid rgba(0,180,216,0.2);
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.fh-message-internal {
  background: rgba(245,158,11,0.08); border: 1px dashed rgba(245,158,11,0.3);
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.fh-message-meta { font-size: 11px; color: var(--fh-text-muted); margin-top: 6px; }

/* ─── Customer CRM Card ─────────────────────────────────────── */
.fh-customer-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
}
.fh-customer-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--fh-accent), var(--fh-accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.fh-customer-name  { font-size: 20px; font-weight: 700; }
.fh-customer-email { font-size: 14px; color: var(--fh-text-muted); }

/* ─── Search Bar ───────────────────────────────────────────── */
.fh-search-bar {
  display: flex; gap: 12px; margin-bottom: 20px; align-items: center;
}
.fh-search-input {
  flex: 1; padding: 10px 16px 10px 42px;
  background: var(--fh-surface); border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius-sm); color: var(--fh-text);
  font-size: 14px; outline: none; transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
.fh-search-input:focus { border-color: var(--fh-accent); }

/* ─── Empty State ──────────────────────────────────────────── */
.fh-empty {
  text-align: center; padding: 60px 20px;
  color: var(--fh-text-muted);
}
.fh-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.fh-empty-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--fh-text-dim); }
.fh-empty-sub  { font-size: 14px; }

/* ─── Expiry Progress Bar ───────────────────────────────────── */
.fh-expiry-bar { margin-top: 12px; }
.fh-expiry-bar-track {
  height: 4px; background: var(--fh-surface-2);
  border-radius: 4px; overflow: hidden;
}
.fh-expiry-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--fh-accent), var(--fh-accent-2));
  transition: width 0.5s ease;
}
.fh-expiry-bar-fill.low { background: linear-gradient(90deg, var(--fh-danger), #f97316); }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .fh-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .fh-sidebar.open { transform: translateX(0); }
  .fh-main { margin-left: 0; padding: 16px; }
  .fh-stats-grid { grid-template-columns: 1fr 1fr; }
  .fh-form-row { grid-template-columns: 1fr; }
  .fh-mobile-menu-btn {
    display: block; position: fixed; top: 16px; left: 16px; z-index: 200;
    background: var(--fh-surface); border: 1px solid var(--fh-border);
    color: var(--fh-text); padding: 8px 12px; border-radius: 8px; cursor: pointer;
    font-size: 18px;
  }
}
@media (min-width: 769px) {
  .fh-mobile-menu-btn { display: none; }
}

/* ─── Utilities ─────────────────────────────────────────────── */
.fh-mt-0  { margin-top: 0; }
.fh-mt-16 { margin-top: 16px; }
.fh-mt-24 { margin-top: 24px; }
.fh-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fh-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.fh-flex   { display: flex; align-items: center; }
.fh-flex-between { display: flex; align-items: center; justify-content: space-between; }
.fh-gap-8  { gap: 8px; }
.fh-gap-12 { gap: 12px; }
.fh-text-muted { color: var(--fh-text-muted); }
.fh-text-sm    { font-size: 13px; }
.fh-fw-700     { font-weight: 700; }
.fh-divider    { border: none; border-top: 1px solid var(--fh-border); margin: 20px 0; }
