:root {
    --primary: #db2777;
    --primary-dark: #be185d;
    --primary-light: #f472b6;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text);
}

.logo-icon { font-size: 1.5rem; }

.nav { display: flex; gap: 24px; }
.nav a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .95rem;
}
.nav a:hover { color: var(--primary); }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero p {
    font-size: 1.15rem;
    opacity: .9;
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .95rem;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}

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

.btn-outline { background: transparent; color: white; border: 2px solid rgba(255,255,255,.5); }
.btn-outline:hover { background: rgba(255,255,255,.1); color: white; border-color: white; }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #d97706; color: white; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-success { background: var(--success); color: white; }

/* Sections */
.section { padding: 60px 0; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.section-header a {
    font-weight: 600;
    font-size: .95rem;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    display: block;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.product-card:hover .product-image img { transform: scale(1.05); }

.badge {
    position: absolute;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
}

.badge.discount { top: 12px; left: 12px; background: var(--danger); color: white; }
.badge.featured { top: 12px; right: 12px; background: var(--accent); color: white; }

.product-info { padding: 16px; }

.platform-tag {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--primary);
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.product-info h3 {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-info h3 a { color: var(--text); }
.product-info h3 a:hover { color: var(--primary); }

.product-rating { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.star { color: #d1d5db; font-size: .85rem; }
.star.filled { color: var(--accent); }
.rating-value { font-size: .8rem; color: var(--text-muted); margin-left: 4px; }

.product-price { margin-bottom: 12px; }
.price-current { font-size: 1.1rem; font-weight: 700; color: var(--danger); }
.price-original { font-size: .85rem; color: var(--text-muted); text-decoration: line-through; margin-left: 8px; }

/* Categories */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all .2s;
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.category-card h3 { font-size: 1rem; margin-bottom: 4px; color: var(--text); }
.category-card p { font-size: .85rem; color: var(--text-muted); }

/* Product Detail */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px 0;
}

.product-detail-image {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.product-detail-image img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.product-detail-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.product-detail-price {
    background: #fef2f2;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin: 20px 0;
}

.product-detail-price .price-current { font-size: 1.75rem; }
.product-detail-price .price-original { font-size: 1rem; }

.product-content {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.product-content h2 { font-size: 1.25rem; margin-bottom: 16px; }
.product-content ul { padding-left: 20px; margin: 12px 0; }
.product-content li { margin-bottom: 8px; }

.affiliate-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .85rem;
    color: #92400e;
    margin-top: 16px;
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Footer */
.footer {
    background: var(--text);
    color: #94a3b8;
    padding: 60px 0 24px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .logo { color: white; margin-bottom: 12px; }
.footer-brand p { font-size: .9rem; line-height: 1.7; }

.footer-links h4 { color: white; font-size: .95rem; margin-bottom: 12px; }
.footer-links a {
    display: block;
    color: #94a3b8;
    font-size: .9rem;
    margin-bottom: 8px;
}
.footer-links a:hover { color: white; }

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 24px;
    text-align: center;
    font-size: .85rem;
}

/* Admin - kept for backward compatibility, new styles in auth.php */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; flex-shrink: 0; }
.admin-main { flex: 1; padding: 32px; overflow-y: auto; }
.admin-header { margin-bottom: 32px; }
.admin-header h1 { font-size: 1.5rem; font-weight: 700; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: .9rem; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .95rem;
    transition: border-color .2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

textarea.form-control { min-height: 120px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: 18px; height: 18px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { background: #f1f5f9; font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 8px; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-card h1 { text-align: center; margin-bottom: 24px; font-size: 1.5rem; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .9rem;
}

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: .9rem;
    color: var(--text-muted);
}

.pagination a:hover { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* Referral banner */
.referral-banner {
    background: linear-gradient(90deg, #fdf2f8, #fce7f3);
    color: #9d174d;
    text-align: center;
    padding: 8px 16px;
    font-size: .85rem;
    border-bottom: 1px solid #fbcfe8;
}

/* Header cart */
.header-actions { display: flex; align-items: center; gap: 12px; }
.cart-btn {
    position: relative;
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--text);
}
.cart-count {
    position: absolute;
    top: -6px; right: -10px;
    background: var(--primary);
    color: white;
    font-size: .65rem;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.hero-beauty {
    background: linear-gradient(135deg, #db2777 0%, #9333ea 100%);
}

/* Checkout */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item img {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.order-summary {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}

.order-summary h3 { margin-bottom: 16px; font-size: 1.1rem; }

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: .9rem;
}

.summary-row.total {
    font-size: 1.1rem;
    font-weight: 700;
    border-top: 2px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
}

.referral-info {
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .85rem;
    margin-top: 12px;
    color: #9d174d;
}

.qty-input { width: 70px; text-align: center; }

.btn-outline-dark {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline-dark:hover { background: var(--bg); color: var(--text); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 0;
}

.success-box {
    background: var(--bg-card);
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.success-icon { font-size: 3rem; margin-bottom: 16px; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-shipping { background: #e0e7ff; color: #3730a3; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.detail-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-card h3 { margin-bottom: 12px; font-size: 1rem; }
.detail-card p { font-size: .9rem; margin-bottom: 6px; }

/* Partner portal */
.partner-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.link-box {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 2px solid #fbcfe8;
}

.link-copy {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.link-copy .form-control { flex: 1; }

.add-cart-form { margin-top: 8px; }

/* Responsive */
@media (max-width: 768px) {
    .nav { display: none; }
    .nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        padding: 16px 20px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .mobile-menu-btn { display: block; }
    .product-detail { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .checkout-layout { grid-template-columns: 1fr; }
    .cart-item { grid-template-columns: 60px 1fr; }
}

/* Custom Content Utilities for Products */
.content-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 40px;
    align-items: center;
}
@media (max-width: 768px) {
    .content-2col { grid-template-columns: 1fr; }
}

.content-section-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e3a8a; /* Dark blue color */
    margin-bottom: 20px;
}

.content-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.content-checklist li {
    position: relative;
    padding-left: 32px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 1.05rem;
    color: #1e293b;
    line-height: 1.5;
}

.content-checklist li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 2px;
    color: #2563eb;
    font-weight: 800;
    font-size: 1.25rem;
    line-height: 1;
}

.content-image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.content-image-grid img {
    border-radius: 8px;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modern KOC Dashboard UI */
.koc-dashboard {
    background: #f9fafb;
    min-height: 100vh;
}

.koc-header-bar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.koc-filter-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.koc-filter-wrap label {
    font-size: 0.9rem;
    color: #4b5563;
    font-weight: 500;
}

.koc-date-input {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #374151;
    min-width: 160px;
    outline: none;
}

.koc-update-text {
    font-size: 0.85rem;
    color: #9ca3af;
}

.koc-main {
    padding: 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.koc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.koc-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
}

.koc-section-subtitle {
    font-size: 0.85rem;
    color: #9ca3af;
}

.koc-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.koc-metric-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    position: relative;
}

.koc-metric-card.active {
    border-top: 3px solid #ef4444; /* Red top border for active */
    padding-top: 18px; /* Adjust for border */
}

.koc-metric-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.koc-metric-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
}
.koc-metric-card.active .koc-metric-title {
    color: #ef4444;
}

.koc-metric-icon {
    color: #9ca3af;
    font-size: 0.8rem;
    cursor: help;
}

.koc-metric-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.koc-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

.koc-metric-change {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.koc-source-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
}

.koc-source-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #374151;
    font-weight: 500;
}

.koc-source-name svg {
    color: #3b82f6;
    width: 20px;
    height: 20px;
}

.koc-source-value {
    font-weight: 700;
    font-size: 1rem;
    color: #111827;
}
