/* BNI Arcadia — Votazioni Speaker
   Brand colors: Red #CF2030, Gold/Yellow #FFB81C, White, Charcoal #1A1A1A */

:root {
    --bni-red: #CF2030;
    --bni-red-dark: #A11724;
    --bni-yellow: #FFB81C;
    --bni-yellow-dark: #E0A013;
    --bni-charcoal: #1A1A1A;
    --bni-graphite: #333333;
    --bni-gray: #5C5C5C;
    --bni-light: #F5F5F5;
    --bni-border: #E5E5E5;
    --bni-white: #FFFFFF;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 12px 32px rgba(207, 32, 48, 0.18);
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bni-light);
    color: var(--bni-charcoal);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: var(--bni-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.bni-header {
    background: linear-gradient(135deg, var(--bni-red) 0%, var(--bni-red-dark) 100%);
    color: var(--bni-white);
    padding: 22px 20px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.bni-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, transparent 70%, var(--bni-yellow) 70%, var(--bni-yellow) 72%, transparent 72%);
    opacity: 0.5;
    pointer-events: none;
}
.bni-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.bni-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.bni-logo {
    width: 56px;
    height: 56px;
    background: var(--bni-white);
    color: var(--bni-red);
    font-weight: 900;
    font-size: 20px;
    letter-spacing: 1px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-bottom: 4px solid var(--bni-yellow);
}
.bni-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin: 0;
}
.bni-subtitle {
    margin: 2px 0 0;
    font-size: 13px;
    opacity: 0.92;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.bni-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.bni-nav a {
    color: var(--bni-white);
    background: rgba(255, 255, 255, 0.12);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.2);
    transition: background 0.15s;
}
.bni-nav a:hover {
    background: rgba(255, 255, 255, 0.25);
    text-decoration: none;
}

/* ===== Container ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.hero {
    background: var(--bni-white);
    border-radius: var(--radius);
    padding: 26px 28px;
    box-shadow: var(--shadow-sm);
    border-left: 6px solid var(--bni-red);
    margin-bottom: 24px;
}
.hero h2 {
    margin: 0 0 6px;
    font-size: 24px;
    color: var(--bni-charcoal);
}
.hero p {
    margin: 0;
    color: var(--bni-gray);
    font-size: 15px;
}
.hero .badge {
    display: inline-block;
    background: var(--bni-yellow);
    color: var(--bni-charcoal);
    font-weight: 700;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ===== Banners ===== */
.banner {
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.banner-success {
    background: #e8f7ec;
    color: #1a6b2f;
    border: 1px solid #b9e4c4;
}
.banner-warning {
    background: #fff8e1;
    color: #7a5a00;
    border: 1px solid #ffe89a;
}
.banner-error {
    background: #fdecee;
    color: #8a1320;
    border: 1px solid #f5b8c0;
}
.banner-info {
    background: #eef3fb;
    color: #1a3a6b;
    border: 1px solid #c9dafa;
}

/* ===== Speakers grid ===== */
.speakers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.speaker-card {
    background: var(--bni-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 2px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    position: relative;
}
.speaker-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.speaker-card.voted {
    border-color: var(--bni-red);
    box-shadow: var(--shadow-lg);
}
.speaker-card.voted::before {
    content: "✓ Il tuo voto";
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bni-red);
    color: var(--bni-white);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.5px;
}
.speaker-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.speaker-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bni-red) 0%, var(--bni-red-dark) 100%);
    color: var(--bni-white);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 19px;
    flex-shrink: 0;
    border: 2px solid var(--bni-yellow);
}
.speaker-info { min-width: 0; }
.speaker-name {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--bni-charcoal);
    line-height: 1.25;
}
.speaker-company {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--bni-gray);
}

.btn {
    display: inline-block;
    padding: 11px 18px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
    font-family: inherit;
    letter-spacing: 0.3px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--bni-red);
    color: var(--bni-white);
    box-shadow: 0 3px 10px rgba(207,32,48,0.35);
}
.btn-primary:hover:not(:disabled) {
    background: var(--bni-red-dark);
    box-shadow: 0 4px 14px rgba(207,32,48,0.45);
}
.btn-primary:disabled {
    background: #cccccc;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-secondary {
    background: var(--bni-charcoal);
    color: var(--bni-white);
}
.btn-secondary:hover { background: #000; }
.btn-yellow {
    background: var(--bni-yellow);
    color: var(--bni-charcoal);
}
.btn-yellow:hover { background: var(--bni-yellow-dark); }
.btn-outline {
    background: transparent;
    color: var(--bni-red);
    border: 2px solid var(--bni-red);
}
.btn-outline:hover { background: var(--bni-red); color: var(--bni-white); }
.btn-danger {
    background: #fff;
    color: #b91c1c;
    border: 1px solid #f5b8c0;
}
.btn-danger:hover { background: #fdecee; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

.empty-state {
    background: var(--bni-white);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    color: var(--bni-gray);
    border: 2px dashed var(--bni-border);
}

/* ===== Results ===== */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.result-row {
    background: var(--bni-white);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 16px;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--bni-border);
}
.result-row.leader {
    border-left-color: var(--bni-yellow);
    background: linear-gradient(90deg, #fffaeb 0%, var(--bni-white) 50%);
}
.result-row.leader .result-rank { background: var(--bni-yellow); color: var(--bni-charcoal); }
.result-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bni-charcoal);
    color: var(--bni-white);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 16px;
}
.result-info { min-width: 0; }
.result-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--bni-charcoal);
    margin: 0 0 6px;
}
.result-bar {
    height: 8px;
    background: var(--bni-light);
    border-radius: 999px;
    overflow: hidden;
}
.result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bni-red) 0%, var(--bni-red-dark) 100%);
    transition: width 0.4s ease;
}
.result-row.leader .result-bar-fill {
    background: linear-gradient(90deg, var(--bni-yellow) 0%, var(--bni-yellow-dark) 100%);
}
.result-votes {
    font-size: 24px;
    font-weight: 800;
    color: var(--bni-red);
    min-width: 60px;
    text-align: right;
}
.result-row.leader .result-votes { color: var(--bni-yellow-dark); }
.result-votes-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--bni-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Stats ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    background: var(--bni-white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--bni-red);
}
.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--bni-gray);
    font-weight: 700;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--bni-charcoal);
}
.stat.gold { border-top-color: var(--bni-yellow); }

/* ===== Admin ===== */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
@media (min-width: 800px) {
    .admin-grid { grid-template-columns: 1fr 2fr; }
}
.card {
    background: var(--bni-white);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.card h3 {
    margin: 0 0 14px;
    font-size: 17px;
    color: var(--bni-charcoal);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bni-border);
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--bni-graphite);
}
.form-control {
    padding: 10px 12px;
    border: 1.5px solid var(--bni-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bni-white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--bni-red);
    box-shadow: 0 0 0 3px rgba(207,32,48,0.12);
}
textarea.form-control { resize: vertical; min-height: 100px; }

.admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bni-light);
    border-radius: 8px;
    border-left: 3px solid var(--bni-red);
}
.admin-list-info { min-width: 0; }
.admin-list-name { font-weight: 700; }
.admin-list-meta { font-size: 12px; color: var(--bni-gray); }
.admin-list-actions { display: flex; gap: 6px; flex-shrink: 0; }

.toggle-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bni-light);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: #999; }
.dot.live { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.18); animation: pulse 2s infinite; }
.dot.closed { background: #ef4444; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(34,197,94,0.18); }
    50%      { box-shadow: 0 0 0 8px rgba(34,197,94,0.06); }
}

/* ===== Login ===== */
.login-wrap {
    max-width: 380px;
    margin: 60px auto;
}

/* ===== Modal HTML ===== */
.bni-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.55);
    display: grid;
    place-items: center;
    z-index: 1000;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.15s ease;
    backdrop-filter: blur(2px);
}
.bni-modal-overlay.open { opacity: 1; }
.bni-modal {
    background: var(--bni-white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.15s ease;
    border-top: 5px solid var(--bni-red);
}
.bni-modal-overlay.open .bni-modal { transform: scale(1); }
.bni-modal-header {
    padding: 16px 20px;
    font-weight: 800;
    font-size: 17px;
    color: var(--bni-charcoal);
    border-bottom: 1px solid var(--bni-border);
    background: var(--bni-light);
}
.bni-modal-body {
    padding: 20px;
    color: var(--bni-graphite);
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-line;
}
.bni-modal-footer {
    padding: 14px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--bni-border);
    background: #fafafa;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    color: var(--bni-gray);
    font-size: 12px;
    padding: 24px 16px 36px;
}
.footer strong { color: var(--bni-red); }

/* ===== Responsive ===== */
@media (max-width: 540px) {
    .bni-title { font-size: 18px; }
    .bni-subtitle { font-size: 11px; }
    .bni-logo { width: 46px; height: 46px; font-size: 16px; }
    .hero { padding: 20px; }
    .hero h2 { font-size: 20px; }
    .result-row { grid-template-columns: 36px 1fr auto; padding: 12px 14px; gap: 10px; }
    .result-rank { width: 32px; height: 32px; font-size: 13px; }
    .result-votes { font-size: 20px; }
    .stat-value { font-size: 24px; }
}
