/* ============================================
   Referral Hub CMS - Main Stylesheet
   ============================================ */

:root {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --secondary: #38bdf8;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --dark: #0f172a;
    --gray-900: #f1f5f9;
    --gray-800: #e2e8f0;
    --gray-700: #cbd5e1;
    --gray-600: #94a3b8;
    --gray-500: #64748b;
    --gray-400: #475569;
    --gray-300: #334155;
    --gray-200: #1e293b;
    --gray-100: #1a2332;
    --gray-50: #0f172a;
    --white: #151e2d;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

/* ============================================
   Header & Navigation
   ============================================ */

.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(21,30,45,0.95);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.site-logo svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.site-logo:hover { color: var(--primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gray-600);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 50%, var(--secondary) 100%);
    color: var(--white);
    padding: 4rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hero p {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-search {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.hero-search input {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    background: rgba(255,255,255,0.15);
    color: var(--white);
    font-size: 1rem;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
}

.hero-search input::placeholder { color: rgba(255,255,255,0.7); }
.hero-search input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.25);
}

.hero-search svg {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: rgba(255,255,255,0.7);
}

/* ============================================
   Category Filter Bar
   ============================================ */

.category-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    overflow-x: auto;
}

.category-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

.category-pill:hover,
.category-pill.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
}

.category-pill .count {
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 50px;
    min-width: 1.25rem;
    text-align: center;
}

.category-pill.active .count {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   Referral Cards Grid
   ============================================ */

.referral-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.referral-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.referral-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.referral-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.referral-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.referral-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.referral-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.referral-card-category {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
}

.referral-card-description {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.referral-card-bonus {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(16, 185, 129, 0.15));
    color: #34d399;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.referral-card-bonus svg {
    width: 14px;
    height: 14px;
}

.referral-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.referral-card-actions .btn {
    flex: 1;
    text-align: center;
}

.referral-card-code {
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.referral-card-code code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 0.05em;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
}

.copy-btn:hover { color: var(--primary); background: rgba(99,102,241,0.08); }
.copy-btn.copied { color: var(--success); }

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    line-height: 1.4;
}

.btn svg { width: 16px; height: 16px; }

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-800); }

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover { background: #16a34a; color: var(--white); }

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }

/* ============================================
   Footer
   ============================================ */

.site-footer {
    background: #0a0f1a;
    color: #94a3b8;
    padding: 3rem 1.5rem 1.5rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

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

.footer-brand h3 {
    color: #f1f5f9;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.footer-brand p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-links h4 {
    color: #f1f5f9;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 0.4rem; }
.footer-links a { color: #94a3b8; font-size: 0.9rem; }
.footer-links a:hover { color: #f1f5f9; }

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 2.5rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    background: var(--white);
    transition: all 0.2s;
}

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

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    color: #475569;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: #151e2d;
        border-bottom: 1px solid #1e293b;
        flex-direction: column;
        padding: 0.5rem;
        box-shadow: var(--shadow-lg);
    }
    
    .nav-links.open { display: flex; }
    
    .hero h1 { font-size: 2rem; }
    .hero { padding: 3rem 1.5rem; }
    
    .referral-grid { grid-template-columns: 1fr; }
    
    .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.75rem; }
    .referral-card-actions { flex-direction: column; }
}
