/* Busiti.iT - Main Stylesheet */
:root {
    --bg-dark: #0b0f19;
    --bg-card: #121826;
    --bg-card-hover: #1a2235;
    --border: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

body.landing { background: var(--bg-dark); }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

.text-gradient {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navbar */
.landing-nav {
    background: rgba(11, 15, 25, 0.85) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}
.landing-nav .nav-link { color: var(--text-muted) !important; font-weight: 500; }
.landing-nav .nav-link:hover { color: #fff !important; }

/* Hero */
.hero {
    background: radial-gradient(ellipse at 30% 20%, rgba(99,102,241,0.15), transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(168,85,247,0.1), transparent 50%);
}
.hero-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.stat-item {
    background: var(--bg-dark);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}
.stat-value { font-weight: 600; font-size: 0.95rem; }

/* Sections */
.section-dark { background: rgba(18, 24, 38, 0.5); }

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: all 0.2s;
}
.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.feature-icon {
    width: 48px; height: 48px;
    background: rgba(99,102,241,0.15);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

.platform-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    transition: all 0.2s;
}
.platform-card:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}
.platform-icon { font-size: 2rem; color: var(--primary); }

.step-number {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-outline-light {
    border-color: var(--border);
    color: var(--text);
}
.btn-outline-light:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    color: #fff;
}

/* Dashboard layout */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1050; /* above topbar so menu covers it on mobile */
    display: flex;
    flex-direction: column;
    transition: transform 0.25s;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.15rem;
}
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.sidebar-nav .nav-link {
    color: var(--text-muted);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    margin-bottom: 2px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.15s;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(99,102,241,0.15);
    color: var(--primary);
}
.sidebar-nav .nav-link i { font-size: 1.15rem; width: 22px; text-align: center; }
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020; /* below sidebar (1050) and overlay (1040) */
}
.content-area { padding: 1.5rem; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.card-body { padding: 1.25rem; }

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.stat-box .stat-label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.25rem; }
.stat-box .stat-number { font-size: 1.5rem; font-weight: 700; }
.stat-box .stat-icon-sm {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Forms */
.form-control, .form-select {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
}
.form-control:focus, .form-select:focus {
    background: var(--bg-dark);
    border-color: var(--primary);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}
.form-control::placeholder { color: #64748b; }
.form-label { font-weight: 500; font-size: 0.9rem; margin-bottom: 0.35rem; }
.input-group-text {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Tables */
.table { color: var(--text); margin-bottom: 0; }
.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: var(--border);
    color: var(--text);
    vertical-align: middle;
}
.table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    border-bottom-width: 1px;
}
.table-hover tbody tr:hover { background: rgba(99,102,241,0.05); }

/* Badges */
.badge { font-weight: 500; padding: 0.35em 0.65em; }

/* Auth pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.12), transparent 60%);
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-card .logo { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
}
.alert-success { background: rgba(34,197,94,0.15); color: #4ade80; }
.alert-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.alert-info { background: rgba(59,130,246,0.15); color: #60a5fa; }
.alert-primary { background: rgba(99,102,241,0.15); color: #a5b4fc; }

/* Pagination */
.pagination .page-link {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text);
}
.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}
.pagination .page-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: #fff;
}

/* Mobile sidebar */
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 1040; /* above topbar, below sidebar */
    }
    .sidebar-overlay.show { display: block; }
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Service list */
.service-item {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
}
.service-item:hover, .service-item.selected {
    border-color: var(--primary);
    background: rgba(99,102,241,0.08);
}
.service-item .svc-name { font-weight: 500; font-size: 0.9rem; }
.service-item .svc-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Category tabs */
.category-tabs .nav-link {
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    margin: 0.2rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.category-tabs .nav-link.active,
.category-tabs .nav-link:hover {
    background: rgba(99,102,241,0.15);
    color: var(--primary);
    border-color: var(--primary);
}

/* Misc */
.text-secondary { color: var(--text-muted) !important; }
.bg-primary-subtle { background: rgba(99,102,241,0.15) !important; }
.bg-danger-subtle { background: rgba(239,68,68,0.15) !important; }
.bg-info-subtle { background: rgba(59,130,246,0.15) !important; }
.bg-success-subtle { background: rgba(34,197,94,0.15) !important; }
.bg-warning-subtle { background: rgba(245,158,11,0.15) !important; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; opacity: 0.4; margin-bottom: 1rem; display: block; }

/* ========== Responsive hardening ========== */
html { -webkit-text-size-adjust: 100%; }
img, svg, video { max-width: 100%; height: auto; }
.table-responsive { -webkit-overflow-scrolling: touch; }

/* Topbar currency + balance wrap */
.topbar {
  flex-wrap: wrap;
  gap: 0.5rem;
  row-gap: 0.5rem;
}
.topbar .form-select-sm { max-width: 100%; }

/* Cards never overflow viewport */
.card, .stat-box, .auth-card { max-width: 100%; overflow: hidden; }
.card-body, .content-area { overflow-x: auto; }

/* Forms full width on small screens */
@media (max-width: 575.98px) {
  .content-area { padding: 0.85rem; }
  .topbar { padding: 0.65rem 0.85rem; }
  .topbar h5 { font-size: 1rem; }
  .btn, .form-control, .form-select { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .stat-number { font-size: 1.2rem !important; }
  .display-6 { font-size: 1.5rem; }
  .table { font-size: 0.8rem; }
  .table th, .table td { white-space: nowrap; padding: 0.45rem 0.5rem; }
  .sidebar { width: min(280px, 86vw); }
  .auth-card { padding: 1.25rem; }
  .badge { font-size: 0.75rem; }
  #currencySwitcher { font-size: 0.8rem; padding: 0.25rem 0.4rem; }
}

@media (max-width: 767.98px) {
  .row.g-4 { --bs-gutter-y: 1rem; }
  .card-header { flex-wrap: wrap; gap: 0.5rem; }
  .d-flex.gap-2 { flex-wrap: wrap; }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-toggle { display: block; }
}

/* Large tables: sticky first column optional */
@media (max-width: 991.98px) {
  .table-responsive table { min-width: 0; }
}

/* Service platform chips */
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(99,102,241,0.12);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0.15rem;
  cursor: pointer;
  color: var(--text);
}
.platform-chip.active, .platform-chip:hover {
  border-color: var(--primary);
  background: rgba(99,102,241,0.22);
  color: #fff;
}
.platform-chip i { font-size: 1rem; }

.category-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category-logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99,102,241,0.15);
  flex-shrink: 0;
}

/* Prevent horizontal page scroll */
body { overflow-x: hidden; }
.app-wrapper { max-width: 100%; width: 100%; overflow-x: hidden; }

/* Input groups on mobile */
@media (max-width: 575.98px) {
  .input-group { flex-wrap: wrap; }
  .input-group > .form-control { width: 100%; }
  .input-group > .btn { width: 100%; margin-top: 0.35rem; border-radius: 8px !important; }
}

/* viewport-fix */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.app-wrapper, .main-content, .content-area, .topbar, .card {
  max-width: 100%;
  overflow-x: hidden;
}
.main-content { min-width: 0; }
.content-area { padding-left: max(0.85rem, env(safe-area-inset-left)); padding-right: max(0.85rem, env(safe-area-inset-right)); }
@media (max-width: 575.98px) {
  .topbar { padding-left: 0.75rem; padding-right: 0.75rem; }
  .table-responsive { margin: 0; }
  .table-responsive table { min-width: 0 !important; width: 100%; }
}

/* main-content-mobile-fix */
@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .topbar, .content-area {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Fixed topbar */
.main-content { display: flex; flex-direction: column; min-height: 100vh; }
.topbar-fixed {
  position: sticky;
  top: 0;
  z-index: 1020; /* must stay BELOW sidebar (1050) */
  background: rgba(11,15,25,0.95) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.content-area { flex: 1; }

/* Service package cards — price on top */
.pkg-card {
  display: block; width: 100%; text-align: left;
  background: #121826; border: 1px solid #1e293b; border-radius: 14px;
  padding: 0.9rem 1rem; margin: 0 0 0.65rem; color: inherit; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pkg-card:hover, .pkg-card:active { border-color: #6366f1; background: rgba(99,102,241,0.08); }
.pkg-price-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.45rem; gap: 0.5rem;
}
.pkg-price {
  font-size: 1.05rem; font-weight: 700; color: #a5b4fc;
}
.pkg-price small { font-size: 0.72rem; font-weight: 500; color: #94a3b8; margin-left: 0.2rem; }
.pkg-title {
  font-weight: 600; font-size: 0.9rem; line-height: 1.4;
  word-break: break-word; white-space: normal;
  margin-bottom: 0.4rem;
}
.pkg-footer { font-size: 0.72rem; color: #94a3b8; margin-top: 0.35rem; }


/* sidebar-over-topbar-fix: mobile menu must cover sticky topbar */
.sidebar { z-index: 1050 !important; }
.sidebar-overlay { z-index: 1040 !important; }
.topbar,
.topbar-fixed { z-index: 1020 !important; }
@media (max-width: 991.98px) {
  .sidebar {
    box-shadow: 4px 0 24px rgba(0,0,0,0.45);
  }
}


/* ===== Fixed top bar =====
   position:sticky silently fails here because html/body/.app-wrapper/.main-content all set
   overflow-x:hidden (that turns them into scroll containers). A fixed bar is not affected.
   --topbar-h is measured by a tiny script in the header so the content never hides under it. */
:root { --topbar-h: 64px; }
html { scroll-padding-top: calc(var(--topbar-h) + 8px); }
.topbar,
.topbar-fixed {
  position: fixed !important;
  top: 0;
  left: 260px;            /* sits beside the desktop sidebar */
  right: 0;
  width: auto !important;
  max-width: none !important;
  box-sizing: border-box;
  padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  background: rgba(11,15,25,0.96) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 1020 !important;   /* below sidebar (1050) and overlay (1040) */
}
.main-content { padding-top: var(--topbar-h); }
@media (max-width: 991.98px) {
  .topbar,
  .topbar-fixed { left: 0; }
}

/* Sidebar logo */
.sidebar-brand img { width: auto; max-width: 44px; object-fit: contain; flex-shrink: 0; }
