/* ============================================================
   TorrentSite — Stylesheet (Light theme)
   ============================================================ */

/* ---- Variables ---- */
:root {
    --bg:          #f8fafc;
    --bg-card:     #ffffff;
    --bg-alt:      #f1f5f9;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-muted:  #64748b;
    --accent:      #2563eb;
    --accent-hover:#1d4ed8;
    --accent-light:#dbeafe;
    --success:     #16a34a;
    --success-bg:  #dcfce7;
    --warning:     #d97706;
    --warning-bg:  #fef9c3;
    --danger:      #dc2626;
    --danger-bg:   #fee2e2;
    --seeder:      #15803d;
    --leecher:     #b45309;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --font:        system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.main-content { padding: 2rem 1.25rem; min-height: calc(100vh - 120px); }

/* ---- Header ---- */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex; align-items: center; gap: 1.5rem;
    height: 60px; flex-wrap: wrap;
}
.site-logo {
    display: flex; align-items: center; gap: .5rem;
    font-size: 1.15rem; font-weight: 700; color: var(--text);
    text-decoration: none; white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }
.main-nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.main-nav a {
    padding: .35rem .75rem; border-radius: var(--radius);
    color: var(--text-muted); font-size: .9rem; font-weight: 500;
}
.main-nav a:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: .5rem; }

/* ---- User dropdown ---- */
.user-menu { position: relative; }
.user-toggle {
    background: none; border: 1px solid var(--border); border-radius: var(--radius);
    padding: .35rem .75rem; cursor: pointer; font-size: .9rem; font-family: var(--font);
    color: var(--text);
}
.user-toggle:hover { background: var(--bg-alt); }
.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,.1); min-width: 160px; z-index: 200;
}
.user-dropdown a {
    display: block; padding: .6rem 1rem; color: var(--text); font-size: .9rem;
}
.user-dropdown a:hover { background: var(--bg-alt); text-decoration: none; }
.user-menu.open .user-dropdown { display: block; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .5rem 1.1rem; border-radius: var(--radius);
    font-size: .9rem; font-weight: 500; cursor: pointer;
    border: none; transition: background .15s, box-shadow .15s;
    text-decoration: none; font-family: var(--font);
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-alt); }
.btn-success  { background: var(--success); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-block    { width: 100%; justify-content: center; }
.btn-sm  { padding: .35rem .8rem;  font-size: .85rem; }
.btn-xs  { padding: .2rem  .5rem;  font-size: .8rem; }

/* ---- Alerts ---- */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius);
    margin-bottom: 1rem; font-size: .92rem;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #f87171; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde047; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], input[type="file"],
select, textarea {
    width: 100%; padding: .55rem .85rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: .95rem; font-family: var(--font); color: var(--text);
    background: var(--bg-card);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
textarea { resize: vertical; min-height: 100px; }
small { color: var(--text-muted); font-size: .82rem; }
.form-note { color: var(--text-muted); margin-bottom: 1.5rem; font-size: .9rem; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.form-card { max-width: 600px; margin: 0 auto; }
.form-card h1 { margin-bottom: .5rem; }
.auth-card {
    max-width: 400px; margin: 3rem auto;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 2rem; box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 1.5rem; font-size: 1.4rem; }
.auth-switch { margin-top: 1.25rem; text-align: center; color: var(--text-muted); font-size: .9rem; }

/* ---- Page header ---- */
.page-header {
    display: flex; align-items: center; flex-wrap: wrap; gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }
.search-bar { display: flex; gap: .5rem; flex: 1; max-width: 480px; }
.search-bar input { flex: 1; }

/* ---- Toolbar ---- */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem;
}
.result-count { font-size: .9rem; color: var(--text-muted); }
.sort-links { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .85rem; }
.sort-link { padding: .25rem .6rem; border-radius: 4px; color: var(--text-muted); }
.sort-link.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.sort-link:hover { background: var(--bg-alt); text-decoration: none; }

/* ---- Torrent table ---- */
.torrent-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
}
.torrent-table th {
    background: var(--bg-alt); padding: .65rem 1rem;
    text-align: left; font-size: .83rem; color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.torrent-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
.torrent-table tr:last-child td { border-bottom: none; }
.torrent-table tr:hover td { background: var(--bg-alt); }
.torrent-name a { font-weight: 600; }
.torrent-name .by { display: block; color: var(--text-muted); font-size: .8rem; margin-top: .1rem; }
.seeder  { color: var(--seeder);  font-weight: 600; }
.leecher { color: var(--leecher); font-weight: 600; }
.nowrap  { white-space: nowrap; }
.text-center { text-align: center; }

/* ---- Badges ---- */
.badge {
    display: inline-block; padding: .15rem .45rem;
    border-radius: 4px; font-size: .75rem; font-weight: 600;
}
.badge-ok      { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-featured { background: #fef3c7; color: #d97706; }
.cat-badge {
    display: inline-block; padding: .2rem .55rem;
    background: var(--bg-alt); border-radius: 4px;
    font-size: .82rem; color: var(--text-muted);
}

/* ---- Torrent detail ---- */
.torrent-detail { max-width: 860px; }
.torrent-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.torrent-header h1 { font-size: 1.5rem; margin-top: .3rem; }
.torrent-meta { color: var(--text-muted); font-size: .9rem; margin-top: .4rem; }
.stats-row {
    display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.stat {
    flex: 1; min-width: 100px; text-align: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
}
.stat span { display: block; font-size: 1.8rem; font-weight: 700; }
.stat-seed span   { color: var(--seeder); }
.stat-leech span  { color: var(--leecher); }
.stat-dl span     { color: var(--accent); }
.torrent-description { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; }
.torrent-description h2 { margin-bottom: .75rem; font-size: 1.1rem; }
.desc-content { white-space: pre-wrap; font-size: .92rem; line-height: 1.7; }
.tags-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tag { background: var(--accent-light); color: var(--accent); padding: .2rem .65rem; border-radius: 20px; font-size: .82rem; font-weight: 500; }
.tag:hover { background: var(--accent); color: #fff; text-decoration: none; }
.admin-actions { background: #fef3c7; border: 1px solid #fde047; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ---- Comments ---- */
.comments-section { margin-top: 2rem; }
.comments-section h2 { margin-bottom: 1rem; }
.comments-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.comment { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: .4rem; }
.comment-header strong { font-size: .93rem; }
.comment-date { color: var(--text-muted); font-size: .82rem; }
.comment-body { font-size: .9rem; line-height: 1.6; }
.comment-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.comment-form h3 { margin-bottom: .75rem; font-size: 1rem; }
.comment-form textarea { margin-bottom: .75rem; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p { margin-bottom: 1rem; }

/* ---- Pagination ---- */
.pagination { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.25rem; }
.page-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius);
    border: 1px solid var(--border); color: var(--text-muted); font-size: .88rem;
}
.page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-link:hover:not(.active) { background: var(--bg-alt); text-decoration: none; }

/* ---- Profile ---- */
.profile-page h1 { margin-bottom: 1.5rem; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table th, .info-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); font-size: .9rem; text-align: left; }
.info-table th { color: var(--text-muted); font-weight: 500; width: 45%; }
.my-torrents { margin-top: 0; }
.my-torrents h2 { margin-bottom: 1rem; }

/* ---- Footer ---- */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); margin-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; font-size: .85rem; color: var(--text-muted); flex-wrap: wrap; gap: .5rem; }
.footer-nav { display: flex; gap: 1rem; }
.footer-nav a { color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }

/* ---- Admin ---- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.admin-sidebar {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; position: sticky; top: 80px;
}
.sidebar-title { padding: .85rem 1rem; font-size: .83rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.admin-sidebar a { display: block; padding: .7rem 1rem; color: var(--text); font-size: .9rem; border-bottom: 1px solid var(--border); }
.admin-sidebar a:last-child { border-bottom: none; }
.admin-sidebar a:hover { background: var(--bg-alt); text-decoration: none; }
.admin-sidebar a.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.admin-sidebar hr { border: none; border-top: 1px solid var(--border); }
.admin-content h1 { margin-bottom: 1.5rem; }
.admin-section { margin-bottom: 2rem; }
.admin-section h2 { margin-bottom: .75rem; font-size: 1.1rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; box-shadow: var(--shadow); }
.stat-card .stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.stat-card.stat-warn .stat-value { color: var(--warning); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th { background: var(--bg-alt); padding: .6rem .85rem; text-align: left; font-size: .8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.admin-table td { padding: .65rem .85rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-alt); }
.admin-table .actions { white-space: nowrap; }
.row-banned td { opacity: .55; }

.admin-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"] { width: 240px; }
.filter-tabs { display: flex; gap: .35rem; }
.filter-tabs a { padding: .3rem .7rem; border-radius: var(--radius); font-size: .85rem; border: 1px solid var(--border); color: var(--text-muted); }
.filter-tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-tabs a:hover:not(.active) { background: var(--bg-alt); text-decoration: none; }

/* ---- Boîte info tracker ---- */
.tracker-info-box {
    background: #eff6ff;
    border: 2px solid #93c5fd;
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.tracker-info-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1e40af;
    margin-bottom: .6rem;
}
.tracker-url-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: .6rem 1rem;
    margin-bottom: .65rem;
}
.tracker-url-row code {
    flex: 1;
    font-size: .95rem;
    font-family: 'Courier New', Courier, monospace;
    color: #1d4ed8;
    word-break: break-all;
    background: none;
}
.tracker-info-note {
    font-size: .85rem;
    color: #3b82f6;
    margin: 0;
    line-height: 1.5;
}
.tracker-info-note code {
    background: #dbeafe;
    padding: .1rem .3rem;
    border-radius: 3px;
    font-size: .85rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .header-inner { height: auto; padding: .75rem 1rem; }
    .main-nav { display: none; }
    .profile-grid { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .torrent-table { display: block; overflow-x: auto; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .search-bar { max-width: 100%; width: 100%; }
}
