/* ============================================
   Glasanje vijećnika — GV Sinj
   ============================================ */

:root {
    --primary: #1a56db;
    --primary-dark: #1344b0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --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;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
    background: var(--gray-900);
    color: #fff;
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.nav-brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.nav-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: .25rem; }
.nav-links a {
    color: var(--gray-300);
    text-decoration: none;
    padding: .4rem .75rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-links a.active {
    background: var(--gray-700);
    color: #fff;
}

/* ── Main ───────────────────────────────────────────────────────────────── */
main { padding: 2rem 0; flex: 1; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: .875rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--gray-200);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: .25rem;
}
.form-control {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { display: flex; justify-content: center; width: 100%; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td {
    padding: .6rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
tr:hover td { background: var(--gray-50); }

/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-za      { background: #dcfce7; color: #166534; }
.badge-protiv  { background: #fef2f2; color: #991b1b; }
.badge-suzdrzan { background: #f3f4f6; color: #374151; }
.badge-active  { background: #dbeafe; color: #1e40af; }
.badge-done    { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #854d0e; }

/* ── Voting buttons ─────────────────────────────────────────────────────── */
.vote-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin: 2rem 0; }
.vote-btn {
    flex: 1;
    min-width: 160px;
    max-width: 220px;
    padding: 1.5rem 1rem;
    border: 3px solid transparent;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}
.vote-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.vote-btn .vote-icon { font-size: 2.5rem; }
.vote-btn-za     { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.vote-btn-za:hover     { border-color: var(--success); }
.vote-btn-protiv  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.vote-btn-protiv:hover  { border-color: var(--danger); }
.vote-btn-suzdrzan { background: #f9fafb; color: #374151; border-color: #e5e7eb; }
.vote-btn-suzdrzan:hover { border-color: var(--gray-400); }
.vote-btn.selected { transform: scale(1.05); box-shadow: var(--shadow-lg); border-width: 4px; }
.vote-btn-za.selected     { border-color: var(--success); background: #dcfce7; }
.vote-btn-protiv.selected  { border-color: var(--danger); background: #fee2e2; }
.vote-btn-suzdrzan.selected { border-color: var(--gray-500); background: #e5e7eb; }

/* ── Vote counter bar ───────────────────────────────────────────────────── */
.vote-bar { display: flex; height: 32px; border-radius: 8px; overflow: hidden; margin: 1rem 0; background: var(--gray-100); }
.vote-bar-za     { background: var(--success); transition: width .5s ease; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .8rem; min-width: 0; }
.vote-bar-protiv { background: var(--danger); transition: width .5s ease; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .8rem; min-width: 0; }
.vote-bar-suzdrzan { background: var(--gray-400); transition: width .5s ease; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .8rem; min-width: 0; }

/* ── Member circles (glasanje page) ─────────────────────────────────────── */
.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: .75rem;
    margin: 1.5rem 0;
}
.member-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
}
.member-dot {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    color: #fff;
    transition: background .4s, transform .3s;
    box-shadow: var(--shadow);
}
.member-dot.ne_pristut { background: var(--gray-800); }
.member-dot.za        { background: var(--success); }
.member-dot.protiv    { background: var(--danger); }
.member-dot.suzdrzan  { background: var(--gray-400); }
.member-dot.glasa     { animation: pulse-ring .6s ease-out; }
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(26,86,219,.5); }
    100% { box-shadow: 0 0 0 16px rgba(26,86,219,0); }
}
.member-name {
    font-size: .65rem;
    color: var(--gray-500);
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Active point indicator ─────────────────────────────────────────────── */
.active-point {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.active-point h2 { font-size: 1rem; font-weight: 600; opacity: .85; margin-bottom: .25rem; }
.active-point h3 { font-size: 1.3rem; font-weight: 700; }

/* ── Two-column layout ──────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .vote-btn { min-width: 120px; }
    .member-grid { grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); }
    .member-dot { width: 46px; height: 46px; font-size: .75rem; }
}

/* ── Admin: session list ────────────────────────────────────────────────── */
.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: .5rem;
    transition: background .15s;
}
.session-item:hover { background: var(--gray-50); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 0;
    text-align: center;
    font-size: .8rem;
    color: var(--gray-500);
    margin-top: auto;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-wrap {
    max-width: 420px;
    margin: 3rem auto;
}
.login-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-card h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.login-card p { color: var(--gray-500); margin-bottom: 1.5rem; font-size: .9rem; }
.login-card .member-select {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    text-align: left;
    margin-bottom: 1rem;
}
.login-card .member-select label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-600);
}

/* ── Histoirja ──────────────────────────────────────────────────────────── */
.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    transition: background .15s;
}
.session-header:hover { background: var(--gray-50); }
.session-body {
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #fff;
}

/* ── No active ──────────────────────────────────────────────────────────── */
.no-active {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}
.no-active .icon { font-size: 3rem; margin-bottom: 1rem; }
.no-active h3 { font-size: 1.1rem; color: var(--gray-500); margin-bottom: .25rem; }
.no-active p { font-size: .85rem; }
