/* ========================================
   Echange de Liens - Stylesheet principal
   Design moderne, responsive, dark/light mode
   ======================================== */

/* Variables CSS */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255,255,255,0.95);
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px 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);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-header: rgba(15,23,42,0.95);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
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: var(--transition); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { background: var(--bg-header); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; padding: 0.75rem 0; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.logo i { font-size: 1.5rem; }
.main-nav { display: flex; gap: 0.25rem; margin-left: auto; }
.nav-link { padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; transition: var(--transition); }
.nav-link:hover, .nav-link.active { background: var(--primary); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; cursor: pointer; color: var(--text); transition: var(--transition); }
.theme-toggle:hover { background: var(--primary); color: #fff; }
.user-menu { display: flex; align-items: center; gap: 0.5rem; }
.lang-switch { display: flex; gap: 0.25rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.15rem; }
.lang-switch a { padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.lang-switch a.active { background: var(--primary); color: #fff; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); }

/* Layout */
.main-layout { display: flex; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; gap: 1.5rem; min-height: calc(100vh - 180px); }

/* Sidebar */
.sidebar { width: 260px; flex-shrink: 0; }
.sidebar-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.sidebar-title { font-size: 0.85rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.75rem; letter-spacing: 0.05em; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; transition: var(--transition); }
.sidebar-link:hover { background: var(--primary); color: #fff; }
.sidebar-stats { display: flex; flex-direction: column; gap: 0.5rem; }
.stat-item { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }
.stat-value { font-weight: 700; color: var(--primary); }

/* Main Content */
.main-content { flex: 1; min-width: 0; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 1.1rem; margin: 0; }
.card-body { padding: 1.25rem; }

/* Hero */
.hero { text-align: center; padding: 3rem 1rem; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: var(--radius); color: #fff; margin-bottom: 1.5rem; }
.hero h1 { font-size: 2.5rem; margin-bottom: 0.75rem; }
.hero-subtitle { font-size: 1.15rem; opacity: 0.9; margin-bottom: 1.5rem; }
.hero-actions { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.hero .btn-outline { border-color: #fff; color: #fff; }
.hero .btn-outline:hover { background: #fff; color: var(--primary); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; background: var(--primary); color: #fff; }
.stat-icon.bg-success { background: var(--success); }
.stat-icon.bg-info { background: var(--info); }
.stat-icon.bg-warning { background: var(--warning); }
.stat-info { flex: 1; }
.stat-number { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }

/* Link List */
.link-list { display: flex; flex-direction: column; gap: 0.5rem; }
.link-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); transition: var(--transition); background: var(--bg-card); }
.link-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.link-item.link-top { border-left: 3px solid var(--warning); }
.link-rank { font-weight: 700; color: var(--text-muted); min-width: 40px; text-align: center; font-size: 0.9rem; }
.link-rank.rank-gold { color: var(--warning); font-size: 1.1rem; }
.link-info { flex: 1; min-width: 0; }
.link-url { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
.link-points { text-align: center; min-width: 80px; }
.points-badge { display: block; font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.points-label { font-size: 0.75rem; color: var(--text-muted); }
.link-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); border: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: var(--transition); text-decoration: none; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--danger); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-control { width: 100%; padding: 0.6rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; background: var(--bg); color: var(--text); transition: var(--transition); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-control-sm { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
.form-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-vertical { max-width: 600px; }
.input-group { display: flex; gap: 0.5rem; }
.inline-form { display: inline-flex; gap: 0.35rem; align-items: center; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-dismissible { display: flex; align-items: center; gap: 0.5rem; }
.alert-close { margin-left: auto; background: none; border: none; font-size: 1.25rem; cursor: pointer; opacity: 0.5; }
.alert-close:hover { opacity: 1; }

/* Auth Pages */
.auth-page { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-card h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; background: var(--primary); color: #fff; }
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table th { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
.table tr:hover { background: rgba(99,102,241,0.05); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.25rem; margin-top: 1rem; }
.page-link { padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; }
.page-link:hover, .page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Quick Actions */
.quick-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* VIP Cards */
.vip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.vip-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; transition: var(--transition); position: relative; }
.vip-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.vip-badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 0.2rem 0.8rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.vip-price { font-size: 2rem; font-weight: 700; color: var(--primary); margin: 1rem 0; }
.vip-actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* Banner Grid */
.banner-grid { display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.banner-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; text-align: center; transition: var(--transition); }
.banner-card:hover { box-shadow: var(--shadow-lg); }
.banner-img { border-radius: 4px; }
.banner-meta { display: flex; justify-content: center; gap: 1rem; margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }

/* Viewer Page */
.viewer-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: #0f172a; color: #fff; }
.viewer-header { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; background: #1e293b; border-bottom: 1px solid #334155; flex-shrink: 0; }
.viewer-header-left, .viewer-header-right { flex: 1; }
.viewer-header-center { flex: 2; text-align: center; }
.logo-sm { color: #fff; font-weight: 700; font-size: 0.9rem; }
.viewer-timer { font-size: 1.1rem; font-weight: 700; }
.viewer-progress { height: 4px; background: #334155; border-radius: 2px; margin-top: 0.25rem; overflow: hidden; }
.viewer-progress-bar { height: 100%; background: var(--primary); border-radius: 2px; transition: width 1s linear; width: 0; }
.viewer-site-name { font-size: 0.85rem; color: #94a3b8; }
.viewer-iframe-container { flex: 1; overflow: hidden; }
.viewer-iframe-container iframe { width: 100%; height: 100%; border: none; }
.viewer-footer { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; background: #1e293b; border-top: 1px solid #334155; flex-shrink: 0; }
.viewer-banner-left, .viewer-banner-right { flex: 1; text-align: center; }
.viewer-counter { text-align: center; }
.counter-circle { width: 60px; height: 60px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; margin: 0 auto; transition: var(--transition); }
.counter-circle.validated { background: var(--success); animation: pulse 0.5s; }
#counterMessage { font-size: 0.85rem; color: #94a3b8; margin-top: 0.25rem; }

/* Ad Banners */
.ad-banner { text-align: center; padding: 0.75rem; margin-bottom: 1rem; display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* Error Page */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 6rem; color: var(--primary); margin-bottom: 0.5rem; }
.error-page p { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 2rem; }

/* Footer */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 2rem 0 1rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 1.5rem; }
.footer-grid h4 { margin-bottom: 0.75rem; }
.footer-grid a { display: block; color: var(--text-muted); font-size: 0.9rem; padding: 0.2rem 0; }
.footer-grid a:hover { color: var(--primary); }
.footer-bottom { text-align: center; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.ms-2 { margin-left: 0.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.page-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Animations */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* Responsive */
@media (max-width: 768px) {
    .main-layout { flex-direction: column; }
    .sidebar { width: 100%; order: 2; }
    .main-content { order: 1; }
    .main-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .header-actions .btn { display: none; }
    .header-actions .btn-admin { display: inline-flex; }
    .hero h1 { font-size: 1.75rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .link-item { flex-wrap: wrap; }
    .link-actions { width: 100%; justify-content: flex-end; }
    .viewer-footer { flex-direction: column; gap: 0.5rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .vip-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* Grid 2 columns */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}
