@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables (Design Tokens) ─────────────────────────── */
:root {
    --bg: #fafafa;
    --fg: #1e293b;
    --white: #ffffff;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-active: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --destructive: #ef4444;
    --destructive-hover: #dc2626;
    --destructive-light: #fef2f2;
    --emerald: #10b981;
    --emerald-light: #ecfdf5;
    --amber: #f59e0b;
    --amber-light: #fffbeb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --border: #e5e7eb;
    --ring: #3b82f6;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── Typography ────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
h2 { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); }
h3 { font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.capitalize { text-transform: capitalize; }

/* ─── Utility Classes ───────────────────────────────────────── */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 0.25rem; }
.gap-1-5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.max-w-md { max-width: 28rem; }
.max-w-sm { max-width: 24rem; }
.max-w-6xl { max-width: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-auto { margin-top: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-8 { margin-top: 2rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-64 { margin-left: 16rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-16 { padding-top: 4rem; }
.pb-16 { padding-bottom: 4rem; }
.rounded { border-radius: var(--radius); }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.text-white { color: #fff; }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-900 { color: var(--gray-900); }
.text-blue-600 { color: var(--primary); }
.text-blue-700 { color: #1d4ed8; }
.text-red-600 { color: var(--destructive); }
.text-red-700 { color: #b91c1c; }
.text-amber-600 { color: var(--amber); }
.text-emerald-600 { color: var(--emerald); }
.bg-white { background: var(--white); }
.bg-gray-50 { background: var(--gray-50); }
.bg-gray-100 { background: var(--gray-100); }
.bg-blue-50 { background: #eff6ff; }
.bg-blue-100 { background: #dbeafe; }
.bg-blue-600 { background: var(--primary); }
.bg-red-50 { background: var(--destructive-light); }
.bg-amber-50 { background: var(--amber-light); }
.bg-emerald-50 { background: var(--emerald-light); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.whitespace-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }
.select-none { user-select: none; }
.transition-all { transition: all 0.2s ease; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.transition-opacity { transition: opacity 0.15s ease; }
.opacity-0 { opacity: 0; }
.opacity-80 { opacity: 0.8; }
.font-mono { font-family: 'SF Mono', Monaco, monospace; }
.leading-relaxed { line-height: 1.625; }
.tracking-tight { letter-spacing: -0.025em; }
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 500; font-size: 0.875rem; line-height: 1.25rem;
    padding: 0.5rem 1.25rem; border-radius: var(--radius);
    border: 1px solid transparent; cursor: pointer;
    transition: all 0.15s ease; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: var(--primary); color: #fff; box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover); box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { background: var(--primary-active); transform: translateY(0); }
.btn-outline {
    background: var(--white); color: var(--gray-700); border-color: var(--gray-300);
}
.btn-outline:hover:not(:disabled) {
    background: var(--gray-50); border-color: var(--gray-400);
}
.btn-ghost {
    background: transparent; color: var(--gray-600); border: none; padding: 0.375rem;
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--gray-900); }
.btn-destructive {
    background: var(--destructive); color: #fff;
}
.btn-destructive:hover:not(:disabled) { background: var(--destructive-hover); }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.375rem; width: 2rem; height: 2rem; }
.btn-icon-sm { padding: 0.25rem; width: 1.75rem; height: 1.75rem; }

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-hover:hover {
    box-shadow: var(--shadow-md); border-color: var(--gray-300);
    transition: all 0.2s ease;
}
.card-header { padding: 1.25rem 1.5rem 0.75rem; }
.card-content { padding: 0.75rem 1.5rem 1.25rem; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.card-desc { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.125rem; }

/* ─── Inputs ────────────────────────────────────────────────── */
.input {
    display: flex; width: 100%; height: 2.5rem;
    border-radius: var(--radius); border: 1px solid var(--gray-300);
    background: var(--white); padding: 0.5rem 0.75rem;
    font-size: 0.875rem; color: var(--gray-900);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
    outline: none; border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}
.input::placeholder { color: var(--gray-400); }
.input-icon { padding-left: 2.5rem; }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed; left: 0; top: 0; height: 100%;
    width: 16rem; background: var(--white);
    border-right: 1px solid var(--border);
    padding: 1.5rem; z-index: 20;
    display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; }
.sidebar-brand-icon {
    width: 2.5rem; height: 2.5rem; background: var(--primary);
    border-radius: var(--radius-lg); display: flex;
    align-items: center; justify-content: center;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0.75rem; border-radius: var(--radius);
    color: var(--gray-600); font-size: 0.875rem; font-weight: 400;
    transition: all 0.15s; border: none; background: none;
    cursor: pointer; width: 100%; text-align: left;
}
.sidebar-link:hover { color: var(--gray-900); background: var(--gray-100); }
.sidebar-link.active { color: var(--primary); background: var(--primary-light); font-weight: 500; }
.sidebar-user {
    background: var(--gray-50); padding: 0.75rem;
    border-radius: var(--radius-lg); margin-bottom: 0.75rem;
    border: 1px solid var(--gray-100);
}
.main-content { margin-left: 16rem; padding: 2rem; }

/* ─── Tables ────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { border-bottom: 1px solid var(--border); background: var(--gray-50); }
th { padding: 0.75rem 1rem; text-align: left; font-weight: 500; color: var(--gray-500); }
td { padding: 0.75rem 1rem; }
tbody tr { border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--gray-50); transition: background 0.15s; }

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.125rem 0.5rem; border-radius: var(--radius);
    font-size: 0.75rem; font-weight: 500; border: 1px solid;
}
.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.badge-green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-indigo { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.badge-purple { background: #faf5ff; color: #7c3aed; border-color: #ddd6fe; }
.badge-teal { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }

/* ─── Modal / Dialog ────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 50; padding: 1rem;
}
.modal-overlay.dark-bg { background: rgba(0,0,0,0.9); }

/* ─── Grid Layouts ──────────────────────────────────────────── */
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Icon Helper ───────────────────────────────────────────── */
.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon svg { width: 1.25rem; height: 1.25rem; }
.icon-sm svg { width: 1rem; height: 1rem; }
.icon-xs svg { width: 0.875rem; height: 0.875rem; }
.icon-lg svg { width: 1.5rem; height: 1.5rem; }
.icon-xl svg { width: 3rem; height: 3rem; }

/* ─── Aspect Ratio ──────────────────────────────────────────── */
.aspect-square { aspect-ratio: 1; }

/* ─── Icon Box ──────────────────────────────────────────────── */
.icon-box {
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-box-sm { width: 2.25rem; height: 2.25rem; border-radius: var(--radius); }
.icon-box-lg { width: 3.5rem; height: 3.5rem; border-radius: var(--radius-xl); }

/* ─── Alert ─────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem; border-radius: var(--radius);
    font-size: 0.875rem; border: 1px solid;
}
.alert-error { background: var(--destructive-light); border-color: #fecaca; color: var(--red-700, #b91c1c); }

/* ─── Group Hover ───────────────────────────────────────────── */
.group:hover .group-hover-visible { opacity: 1; }
.group-hover-visible { opacity: 0; transition: opacity 0.15s; }
.group { position: relative; }

/* ─── Landing Page Hero ─────────────────────────────────────── */
.hero-gradient { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.gradient-text {
    background: linear-gradient(to right, #3b82f6, #60a5fa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dot-pattern {
    background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
    background-size: 24px 24px;
}
.backdrop-blur { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ─── Animations ────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out forwards; }

@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* ─── Feature Cards (Landing) ───────────────────────────────── */
.feature-card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}
.feature-card:hover {
    box-shadow: var(--shadow-lg); transform: translateY(-6px);
}
.feature-card .feature-icon {
    width: 2.75rem; height: 2.75rem;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem; transition: transform 0.3s;
}
.feature-card:hover .feature-icon { transform: scale(1.1); }

/* ─── Navbar (Landing) ──────────────────────────────────────── */
.navbar {
    border-bottom: 1px solid var(--gray-100);
    background: rgba(255,255,255,0.8); backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 50;
}
.navbar-inner {
    max-width: 72rem; margin: 0 auto; padding: 0 1.5rem;
    height: 4rem; display: flex; align-items: center; justify-content: space-between;
}

/* ─── Media Preview ─────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.media-card { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--white); }
.media-thumb {
    aspect-ratio: 1; position: relative; cursor: pointer;
    background: var(--gray-50); overflow: hidden;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb-overlay {
    position: absolute; inset: 0; background: transparent;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.media-card:hover .media-thumb-overlay { background: rgba(0,0,0,0.2); }

/* ─── Lightbox ──────────────────────────────────────────────── */
.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,0.9);
    z-index: 50; display: flex; align-items: center;
    justify-content: center; padding: 1rem;
}
.lightbox-inner {
    position: relative; max-width: 80rem; max-height: 90vh;
    width: 100%; display: flex; align-items: center; justify-content: center;
}
.lightbox-close {
    position: absolute; top: 0; right: 0; z-index: 10;
    padding: 0.5rem; color: rgba(255,255,255,0.8); background: rgba(0,0,0,0.5);
    border-radius: var(--radius-lg); border: none; cursor: pointer;
    transition: color 0.15s;
}
.lightbox-close:hover { color: #fff; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 85vh; object-fit: contain; border-radius: var(--radius-lg); }
.lightbox-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    text-align: center; color: rgba(255,255,255,0.8);
    font-size: 0.875rem; padding: 0.5rem; background: rgba(0,0,0,0.3);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .lg-grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .media-grid { grid-template-columns: repeat(3, 1fr); }
    .lg-hidden { display: none; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
    .media-grid { grid-template-columns: repeat(2, 1fr); }
    .md-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    h1 { font-size: 1.25rem; }
    .sm-flex-col { flex-direction: column; }
    .sm-w-full { width: 100%; }
    .sm-text-center { text-align: center; }
    .navbar-inner { padding: 0 1rem; }
    .mobile-menu-btn { display: flex !important; }
}
@media (min-width: 769px) {
    .mobile-menu-btn { display: none !important; }
    .mobile-overlay { display: none !important; }
}
@media (min-width: 640px) {
    .sm-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .lg-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .lg-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg-block { display: block; }
}

/* ─── Checkbox / Radio ──────────────────────────────────────── */
input[type="radio"] { accent-color: var(--primary); }
input[type="checkbox"] { accent-color: var(--primary); }

/* ─── Upload label as button ────────────────────────────────── */
.upload-btn {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius); font-weight: 500; font-size: 0.875rem;
    background: var(--primary); color: #fff; box-shadow: var(--shadow-sm);
    padding: 0.5rem 1.25rem; cursor: pointer;
    transition: all 0.15s;
}
.upload-btn:hover { background: var(--primary-hover); box-shadow: var(--shadow); }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
