@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 270px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --primary: #00c48c;
    --primary-dark: #00a876;
    --primary-light: #34d9a8;
    --accent: #00a876;
    --success: #00c48c;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f9fafb;
    --sidebar-active: #e6faf4;
    --sidebar-text: #6b7280;
    --body-bg: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --shadow-xs: 0 1px 2px rgba(16,24,40,0.05);
    --shadow-sm: 0 2px 8px rgba(16,24,40,0.06);
    --shadow-md: 0 8px 24px rgba(16,24,40,0.08);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --bs-primary: #00c48c;
    --bs-primary-rgb: 0, 196, 140;
    --bs-link-color: #00a876;
    --bs-link-hover-color: #008f65;
}

.btn-primary:focus,
.btn-primary:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.bg-primary-subtle {
    background-color: #e6faf4 !important;
}

.text-bg-primary {
    background-color: var(--primary) !important;
}

[data-bs-theme="dark"] {
    --body-bg: #0f1117;
    --card-bg: #1a1d2e;
    --border-color: #2d3148;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --sidebar-bg: #13151f;
    --sidebar-hover: rgba(255,255,255,0.05);
    --sidebar-active: rgba(0,196,140,0.15);
    --sidebar-text: #9ca3af;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Layout ─── */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.sidebar-brand {
    padding: 1.35rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: -0.02em;
}

.sidebar-brand .brand-name {
    font-size: 0.82rem;
    line-height: 1.25;
    max-width: 160px;
}

.sidebar-brand .brand-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,196,140,0.35);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.6rem 0.85rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    width: 20px;
    font-size: 1.05rem;
    opacity: 0.8;
}

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: var(--primary-dark);
    background: var(--sidebar-active);
    box-shadow: inset 3px 0 0 var(--primary);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i { opacity: 1; color: var(--primary); }

.nav-section {
    padding: 1.25rem 0.85rem 0.4rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.credits-badge {
    display: flex;
    gap: 0.5rem;
}

.credit-pill {
    flex: 1;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.credit-pill i { color: var(--primary); }

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    height: var(--header-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-bs-theme="dark"] .app-header {
    background: rgba(19,21,31,0.9);
}

.page-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-actions .btn-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.header-actions .btn-link:hover {
    background: var(--body-bg);
    color: var(--primary);
}

.header-icon-btn {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.header-icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,196,140,0.06);
}

.app-content {
    padding: 1.75rem;
    flex: 1;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Cards ─── */
.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
    overflow: hidden;
}

.dashboard-card:hover { box-shadow: var(--shadow-sm); }

.dashboard-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.15rem 1.5rem;
    font-weight: 600;
}

.dashboard-card .card-header h5 {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.dashboard-card .card-body { padding: 1.5rem; }

/* ─── Stat Cards ─── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before { opacity: 1; }

.stat-card.stat-primary::before { opacity: 1; background: linear-gradient(90deg, #00c48c, #34d9a8); }
.stat-card.stat-success::before { opacity: 1; background: linear-gradient(90deg, #00c48c, #00a876); }
.stat-card.stat-warning::before { opacity: 1; background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.stat-info::before    { opacity: 1; background: linear-gradient(90deg, #06b6d4, #22d3ee); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-info h3, .stat-info h4 {
    margin: 0;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-info p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-card-sm {
    padding: 1.1rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.stat-card-sm h4 { font-size: 1.25rem; }

/* ─── Avatar ─── */
.avatar-circle {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,196,140,0.35);
}

/* ─── Buttons ─── */
.btn {
    font-family: var(--font);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    box-shadow: 0 4px 12px rgba(0,196,140,0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #008f65);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,196,140,0.45);
}

.btn-success {
    background: linear-gradient(135deg, #00c48c, #00a876);
    border: none;
    box-shadow: 0 4px 12px rgba(0,196,140,0.3);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-shopify {
    background: linear-gradient(135deg, #96bf48, #5e8e3e);
    border: none;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(150,191,72,0.4);
}

.btn-shopify:hover {
    background: linear-gradient(135deg, #7a9e3a, #4a7a2e);
    color: #fff;
    transform: translateY(-1px);
}

.btn-shopify:disabled {
    background: #d1d5db;
    box-shadow: none;
    transform: none;
}

/* ─── Forms ─── */
.form-control, .form-select {
    font-family: var(--font);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,196,140,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.input-group-text {
    background: var(--body-bg);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ─── Tables ─── */
.table {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    background: var(--body-bg);
}

.table tbody td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

.table-hover > tbody > tr:hover {
    background: rgba(0,196,140,0.04);
}

/* ─── Badges ─── */
.badge {
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35em 0.7em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* ─── Alerts ─── */
.alert {
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success { border-left-color: var(--success); background: rgba(16,185,129,0.1); color: #065f46; }
.alert-danger  { border-left-color: var(--danger);  background: rgba(239,68,68,0.1);  color: #991b1b; }
.alert-info    { border-left-color: var(--info);    background: rgba(6,182,212,0.1);  color: #155e75; }
.alert-warning { border-left-color: var(--warning); background: rgba(245,158,11,0.1); color: #92400e; }

[data-bs-theme="dark"] .alert-success { color: #6ee7b7; }
[data-bs-theme="dark"] .alert-danger  { color: #fca5a5; }
[data-bs-theme="dark"] .alert-info    { color: #67e8f9; }

/* ─── Progress ─── */
.progress {
    background: var(--body-bg);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar { border-radius: 100px; }

/* ─── Dropdown ─── */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    font-size: 0.875rem;
    background: var(--card-bg);
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-item:hover { background: rgba(0,196,140,0.08); color: var(--primary-dark); }

/* ─── Auth ─── */
.auth-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-panel-left {
    background: linear-gradient(135deg, #00c48c 0%, #00a876 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-panel-left::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
}

.auth-panel-left .auth-tagline {
    position: relative;
    z-index: 1;
    color: #fff;
}

.auth-panel-left .auth-tagline h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.auth-panel-left .auth-tagline p {
    color: rgba(255,255,255,0.65);
    font-size: 1.05rem;
    line-height: 1.7;
}

.auth-features {
    position: relative;
    z-index: 1;
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-feature-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-feature-item .feat-icon {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.auth-panel-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--body-bg);
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.auth-card-wide { max-width: 480px; }

.auth-brand {
    font-size: 1.4rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ─── Module Header ─── */
.module-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg);
    padding: 2rem 2.25rem;
    color: #fff;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.module-header::after {
    content: '';
    position: absolute;
    right: -30px; top: -30px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.module-header h2 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.module-header p  { margin: 0.5rem 0 0; opacity: 0.85; font-size: 0.9rem; }

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
}

.empty-state .empty-icon {
    width: 72px; height: 72px;
    background: rgba(0,196,140,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 2rem;
    color: var(--primary);
}

.empty-state h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.empty-state p { color: var(--text-secondary); font-size: 0.9rem; }

/* ─── List Group ─── */
.list-group-item {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* ─── Shopify Connect ─── */
.shopify-connect-badge {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #96bf48, #5e8e3e);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 8px 24px rgba(150,191,72,0.35);
}

/* ─── Page header bar ─── */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header-bar h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

/* ─── Sidebar overlay (mobile) ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ─── DataTables ─── */
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] table.dataTable { color: inherit; }

/* ─── Responsive ─── */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .app-main { margin-left: 0; }
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-panel-left { display: none; }
}

@media (max-width: 575.98px) {
    .app-content { padding: 1rem; }
    .app-header { padding: 0 1rem; }
    .stat-info h3 { font-size: 1.3rem; }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,196,140,0.3); border-radius: 3px; }

.product-card-img { object-fit: cover; width: 100%; height: 100%; }

.font-monospace { font-family: 'Courier New', monospace; }
