/* ZyWeb — améliorations globales UI/UX */

:root {
    --bg-deep: #060a12;
    --glow-primary: rgba(99, 102, 241, .35);
    --glow-accent: rgba(34, 211, 238, .2);
    --transition: .22s cubic-bezier(.4, 0, .2, 1);
    --radius-lg: 16px;
    --header-h: 68px;
}

::selection {
    background: rgba(99, 102, 241, .35);
    color: #fff;
}

body.site-body {
    background-color: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 90% 55% at 50% -15%, var(--glow-primary), transparent 55%),
        radial-gradient(ellipse 50% 35% at 100% 20%, var(--glow-accent), transparent),
        radial-gradient(ellipse 40% 30% at 0% 80%, rgba(245, 158, 11, .06), transparent);
}

/* Header */
.site-header {
    height: var(--header-h);
    transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.site-header.is-scrolled {
    background: rgba(6, 10, 18, .92);
    border-bottom-color: rgba(99, 102, 241, .25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
}

.header-inner { height: var(--header-h); }

.logo:hover { color: var(--text); }
.logo-text {
    background: linear-gradient(135deg, #fff 30%, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-mark.sm { width: 28px; height: 28px; border-radius: 8px; }

.logo-mark.sm .logo-img { width: 28px; height: 28px; }

.main-nav a {
    position: relative;
    padding: .35rem 0;
    transition: color var(--transition);
}

.main-nav a.active {
    color: var(--text);
    font-weight: 600;
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.main-nav a.nav-cta {
    color: var(--accent);
    font-weight: 600;
}

.main-nav a.nav-admin {
    color: var(--vote);
}

.nav-user {
    display: inline-flex !important;
    align-items: center;
    gap: .45rem;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Buttons */
.btn {
    border-radius: 10px;
    letter-spacing: .01em;
}

.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    box-shadow: 0 4px 20px rgba(99, 102, 241, .35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(99, 102, 241, .45);
}

/* Cards */
.card {
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: rgba(99, 102, 241, .35);
}

/* Page hero (sous-pages) */
.page-hero {
    position: relative;
    padding: 2.5rem 0 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(99, 102, 241, .08) 0%, transparent 100%);
}

.page-hero-inner { max-width: 640px; margin: 0 auto; }

.page-hero-icon {
    display: inline-flex;
    font-size: 2.5rem;
    margin-bottom: .75rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .3));
}

.page-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    margin-bottom: .5rem;
    letter-spacing: -.02em;
}

.page-hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Auth split */
.auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - var(--header-h) - 120px);
    gap: 0;
    margin: 0 -1.25rem;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    background: linear-gradient(145deg, rgba(99, 102, 241, .12), rgba(34, 211, 238, .06));
    border-right: 1px solid var(--border);
}

.auth-panel h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 1rem 0 .75rem;
    line-height: 1.2;
}

.auth-panel p { color: var(--text-muted); max-width: 360px; }

.auth-panel-list {
    list-style: none;
    margin-top: 2rem;
}

.auth-panel-list li {
    padding: .5rem 0;
    color: var(--text-muted);
    font-size: .95rem;
}

.auth-panel-list li::before {
    content: '✓';
    color: var(--success);
    margin-right: .5rem;
    font-weight: 700;
}

.auth-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.25rem;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    border: 1px solid rgba(99, 102, 241, .2);
}

.auth-card h1 { margin-top: 1rem; }

.auth-card input:focus,
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

/* Category cards */
.category-card {
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, .08), transparent);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.category-card { position: relative; }
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}

.category-card:hover::before { opacity: 1; }

.category-icon {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, .4);
}

/* Server rows */
.server-row {
    transition: transform var(--transition), background var(--transition);
}

.server-row:hover {
    background: rgba(99, 102, 241, .04);
}

/* Footer */
.site-footer {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, transparent, rgba(6, 10, 18, .8));
}

.footer-glow {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 120px;
    background: radial-gradient(ellipse, rgba(99, 102, 241, .15), transparent 70%);
    pointer-events: none;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: .9rem;
    margin: .75rem 0 1rem;
    max-width: 280px;
}

.footer-social { display: flex; flex-wrap: wrap; gap: .5rem; }

.footer-stat {
    color: var(--text-muted);
    font-size: .9rem;
    padding: .25rem 0;
}

.footer-stat strong { color: var(--accent); }

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem;
}

.footer-made { opacity: .7; }

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeUp .5s ease both;
}

.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .1s; }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .2s; }
.stagger > *:nth-child(5) { animation-delay: .25s; }
.stagger > *:nth-child(6) { animation-delay: .3s; }

/* Flash */
.flash-container {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 1rem;
    z-index: 200;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.flash-container .alert {
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
    animation: fadeUp .35s ease;
}

/* Tables admin polish */
.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, .06);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

@media (max-width: 768px) {
    .auth-layout {
        grid-template-columns: 1fr;
        margin: 0;
    }
    .auth-panel {
        padding: 2rem 1.25rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        text-align: center;
    }
    .auth-panel p { margin: 0 auto; }
    .auth-panel-list { text-align: left; max-width: 320px; margin: 1.5rem auto 0; }
    .main-nav {
        display: none;
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(6, 10, 18, .98);
        padding: 1rem 1.25rem 2rem;
        overflow-y: auto;
        border-bottom: none;
        z-index: 99;
    }
    .main-nav.open { display: flex; }
    .main-nav a {
        padding: .85rem 0;
        border-bottom: 1px solid var(--border);
        font-size: 1rem;
    }
    .main-nav a.active::after { display: none; }
    .main-nav a.active { color: var(--accent); }
    .nav-toggle { display: flex; }
    .footer-bottom { flex-direction: column; text-align: center; }
}

/* Contact */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 1.5rem;
    align-items: start;
    max-width: 900px;
    margin: 0 auto;
}

.contact-info h2,
.contact-form-card h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.contact-email {
    margin: 1rem 0;
    font-size: 1.05rem;
}

.contact-label {
    display: block;
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .25rem;
}

.contact-form-card { max-width: none; }

.contact-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.contact-form textarea {
    width: 100%;
    padding: .7rem .95rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: .95rem;
    resize: vertical;
    min-height: 140px;
}

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

/* Vote page */
.vote-page {
    display: flex;
    justify-content: center;
    padding: 2rem 0 4rem;
}

.vote-card-large {
    max-width: 480px;
    width: 100%;
    text-align: center;
    border-color: rgba(245, 158, 11, .3);
    box-shadow: 0 20px 60px rgba(245, 158, 11, .12);
}

.vote-card-large h1 {
    font-size: 1.5rem;
    margin: 1rem 0 .5rem;
}

.vote-server-ip {
    font-family: 'JetBrains Mono', monospace;
    font-size: .95rem;
    color: var(--accent);
    margin-bottom: 1.25rem;
}

.vote-success {
    padding: 1.5rem 0;
}

.vote-success-icon {
    display: inline-flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(16, 185, 129, .15);
    color: var(--success);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.vote-counts {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: .88rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .contact-layout { grid-template-columns: 1fr; }
}

/* Server status badge */
.server-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    vertical-align: middle;
}

.server-status.is-loading .status-dot {
    animation: statusPulse 1s ease infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.server-status.is-online {
    border-color: rgba(16, 185, 129, .4);
    color: var(--success);
    background: rgba(16, 185, 129, .1);
}

.server-status.is-online .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, .6);
}

.server-status.is-offline {
    border-color: rgba(239, 68, 68, .35);
    color: #fca5a5;
    background: rgba(239, 68, 68, .08);
}

.server-status.is-offline .status-dot {
    background: var(--danger);
}

.server-status.is-unknown {
    opacity: .7;
}

.server-detail-header .server-status {
    margin-left: .5rem;
    margin-bottom: .5rem;
}

.captcha-wrap {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.forgot-spam-hint {
    margin-top: 1rem;
    text-align: left;
}

.forgot-spam-hint p {
    margin: .5rem 0 0;
    font-size: .9rem;
    line-height: 1.55;
}

@keyframes statusPulse {
    0%, 100% { opacity: .4; }
    50% { opacity: 1; }
}

/* ========== Profile page ========== */
.profile-page {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

.profile-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    border-color: rgba(99, 102, 241, .25);
    background: linear-gradient(135deg, rgba(99, 102, 241, .1) 0%, var(--bg-card) 50%);
}

.profile-hero-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 24px rgba(99, 102, 241, .35);
}

.profile-hero h1 {
    font-size: 1.65rem;
    font-weight: 800;
    margin: 0 0 .35rem;
    letter-spacing: -.02em;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin: 0;
    font-size: .88rem;
}

.profile-since {
    color: var(--text-muted);
}

.profile-role.role-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-role.role-admin {
    background: rgba(239, 68, 68, .2);
    color: #fca5a5;
}

.profile-role.role-client {
    background: rgba(99, 102, 241, .2);
    color: var(--primary-hover);
}

.profile-role.role-user {
    background: rgba(139, 157, 195, .2);
    color: var(--text-muted);
}

.profile-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(240px, 280px) 1fr;
    gap: 1.5rem;
    align-items: start;
}

.profile-stat-cards {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1rem;
}

.profile-stat-card {
    padding: 1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    text-align: center;
}

.profile-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
}

.profile-stat-label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

.profile-nav,
.profile-tip {
    padding: 1.15rem 1.25rem;
    margin-bottom: 1rem;
}

.profile-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.profile-nav a {
    display: block;
    padding: .55rem 0;
    font-size: .9rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.profile-nav a:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-nav a:hover {
    color: var(--accent);
}

.profile-tip p {
    margin: 0;
    font-size: .85rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.profile-form-card,
.profile-votes-card {
    padding: 1.35rem 1.5rem;
}

.profile-form-desc {
    margin: -.5rem 0 1.25rem;
    font-size: .9rem;
}

.profile-form label {
    display: block;
    margin: .85rem 0 .35rem;
    font-size: .88rem;
    color: var(--text-muted);
}

.profile-form label:first-of-type {
    margin-top: 0;
}

.profile-form input {
    width: 100%;
    padding: .7rem .95rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: .95rem;
    transition: border-color .15s, box-shadow .15s;
}

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

.profile-form-actions {
    margin-top: 1.35rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.profile-votes-card .card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile-votes-card .profile-card-title {
    margin-bottom: 0;
}

.profile-vote-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.profile-vote-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-vote-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-vote-list a {
    font-weight: 600;
    color: var(--text);
}

.profile-vote-list a:hover {
    color: var(--accent);
}

.profile-vote-list time {
    font-size: .82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.profile-empty {
    text-align: center;
    padding: 1.5rem 1rem;
}

.profile-empty p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

html[data-theme="light"] .profile-hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, .06) 0%, #fff 100%);
}

@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-stat-cards {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 560px) {
    .profile-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-hero-actions {
        width: 100%;
    }

    .profile-hero-actions .btn {
        flex: 1;
        text-align: center;
    }

    .profile-vote-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: .25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
