/* Voter Auth Pages — extends tokens.css */

.voter-page {
    background: #f5f6fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    max-width: none;
    padding: 0;
}

.voter-header {
    height: 40px;
    background: #0055a4;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.voter-header-navbar {
    justify-content: flex-start;
    height: 44px;
}

.voter-header-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 16px;
    gap: 16px;
}

.voter-header-brand {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.voter-header-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voter-header-link {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.voter-header-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.voter-header-logout {
    opacity: 0.85;
}

.voter-header-logout:hover {
    opacity: 1;
}

.voter-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.voter-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 40px 36px;
    max-width: 420px;
    width: 100%;
}

.voter-logo {
    text-align: center;
    margin-bottom: 16px;
}

.voter-title {
    font-size: 26px;
    font-weight: 600;
    color: #0055a4;
    margin: 0 0 4px 0;
    text-align: center;
}

.voter-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 32px 0;
    line-height: 1.5;
    text-align: center;
}

.voter-footer {
    height: 36px;
    background: #f5f6fa;
    color: #6b7280;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-error {
    background: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: #d97706;
    color: #854d0e;
}

.alert-success {
    background: #f0fdf4;
    border-color: #16a34a;
    color: #166534;
}

.token-success {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}

.token-success-icon {
    font-size: 24px;
    color: #16a34a;
}

.token-message {
    font-size: 16px;
    color: #374151;
    text-align: center;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.token-hero {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 80px 24px;
    text-align: center;
    margin-bottom: 16px;
}

.token-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    user-select: all;
    word-break: break-all;
    line-height: 1.4;
}

.token-instruction {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.token-notice {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
    padding: 8px;
    background: #fffbeb;
    border-radius: 6px;
}

.token-notice strong {
    color: #d97706;
}

@media (max-width: 768px) {
    .voter-body {
        padding: 12px;
    }

    .voter-card {
        padding: 24px;
    }

    .token-hero {
        padding: 48px 16px;
    }

    .token-code {
        font-size: 18px;
    }
}

/* ============================================================
   Voter Topbar — unified header + navigation
   ============================================================ */

.voter-topbar {
    background: #0055a4;
    height: 44px;
    width: 100%;
    flex-shrink: 0;
}

.voter-topbar-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
}

.voter-topbar-brand {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.voter-topbar-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voter-topbar-link {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.voter-topbar-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.voter-topbar-logout {
    opacity: 0.85;
}

.voter-topbar-logout:hover {
    opacity: 1;
}

/* ============================================================
   Voter Layout — page-level styles when using base layout
   ============================================================ */

.voter-layout {
    max-width: none;
    margin: 0;
    padding: 0;
    background: #f5f6fa;
    min-height: 100vh;
}

.voter-layout main {
    padding: 24px 16px;
    min-height: calc(100vh - 44px - 36px);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive: stack on small screens */
@media (max-width: 600px) {
    .voter-topbar-inner {
        flex-direction: column;
        gap: 4px;
        justify-content: center;
    }
    .voter-topbar {
        height: auto;
        padding: 8px 0;
    }
    .voter-layout main {
        min-height: auto;
    }
}

/* ============================================================
   Form styles — voter auth pages
   ============================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 4px;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: outline-color 150ms ease;
}

.form-control:focus {
    outline: 2px solid #0055a4;
    outline-offset: -1px;
}

/* ============================================================
   Button styles — voter pages (extending design tokens)
   ============================================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background-color 150ms ease, opacity 150ms ease;
}

.btn-primary {
    background: #0055a4;
    color: #fff;
}

.btn-primary:hover {
    background: #004080;
}

.btn-primary:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
    color: #111827;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ============================================================
   Voting Pages — election selection, ballot, confirmation
   ============================================================ */

.vote-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
}

.vote-page h1 {
    color: #111827;
}

.vote-page-title {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.vote-page-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

/* Election selection cards */
.election-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.election-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    text-decoration: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.election-card:hover {
    border-color: #0055a4;
    box-shadow: 0 2px 8px rgba(0, 85, 164, 0.1);
}

.election-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.election-card-organ {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 4px 0;
}

.election-card-type {
    font-size: 12px;
    color: #0055a4;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.election-card-arrow {
    font-size: 20px;
    color: #9ca3af;
}

/* Ballot page */
.ballot-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.ballot-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.ballot-organ {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.ballot-instruction {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    margin: 0;
    padding: 8px 12px;
    background: #f0f7ff;
    border-radius: 6px;
    border-left: 3px solid #0055a4;
}

/* List sections */
.list-section {
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.list-header {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.list-image {
    height: 32px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
}

.list-name {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.list-section-blank {
    opacity: 0.7;
    border-style: dashed;
}

.candidate-group {
    padding: 0;
}

/* Candidate cards — Single preference */
.candidate-card-single {
    border-bottom: 1px solid #f3f4f6;
}

.candidate-card-single:last-child {
    border-bottom: none;
}

.candidate-radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.candidate-radio-label:hover {
    background: #f9fafb;
}

.candidate-radio-label.selected {
    background: #eff6ff;
    border-left: 3px solid #0055a4;
}

.native-radio {
    width: 20px;
    height: 20px;
    accent-color: #0055a4;
    cursor: pointer;
    flex-shrink: 0;
}

.native-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #0055a4;
    cursor: pointer;
    flex-shrink: 0;
}

.candidate-name {
    font-size: 15px;
    color: #111827;
    font-weight: 500;
}

/* Blank vote section */
.blank-section {
    margin-bottom: 20px;
}

.blank-radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.blank-radio-label:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.blank-label {
    font-size: 15px;
    color: #6b7280;
    font-style: italic;
}

/* Candidate cards — Multiple preference */
.candidate-card-multiple {
    border-bottom: 1px solid #f3f4f6;
}

.candidate-card-multiple:last-child {
    border-bottom: none;
}

.candidate-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.candidate-checkbox-label:hover {
    background: #f9fafb;
}

.candidate-checkbox-label.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f9fafb;
}



/* List vote cards (D-14) */
.candidate-group-list {
    /* List selection is handled by the header radio, candidates below are non-interactive */
}

.list-select-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f0f7ff;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.list-select-card:hover {
    background: #dbeafe;
}

.list-select-label {
    font-size: 14px;
    font-weight: 600;
    color: #0055a4;
}

.candidate-item {
    padding: 10px 16px 10px 36px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #6b7280;
}

.candidate-item:last-child {
    border-bottom: none;
}

/* Submit section */
.ballot-submit {
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}

.counter-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 12px 0;
}

.btn-vote {
    max-width: 300px;
    margin: 0 auto;
    background: #0055a4;
    color: #fff;
}

.btn-vote:hover:not(:disabled) {
    background: #004080;
}

.btn-vote:disabled,
.btn-disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-vote:disabled:hover,
.btn-disabled:hover {
    background: #d1d5db;
    color: #9ca3af;
}

/* Confirmation page (D-18, D-19) */
.vote-confirm {
    max-width: 480px;
    margin: 60px auto;
    text-align: center;
    padding: 24px;
}

.confirm-icon {
    font-size: 48px;
    color: #16a34a;
    margin-bottom: 16px;
}

.confirm-icon-error {
    color: #dc2626;
}

.confirm-title {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.confirm-message {
    font-size: 16px;
    color: #374151;
    margin: 0 0 4px 0;
}

.confirm-thanks {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

.confirm-redirect {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 24px 0;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.confirm-error {
    max-width: 480px;
    margin: 60px auto;
    text-align: center;
    padding: 24px;
}

@media (max-width: 768px) {
    .vote-page {
        padding: 16px 12px;
    }

    .election-card {
        padding: 16px;
    }

    .vote-confirm {
        margin: 40px auto;
        padding: 16px;
    }

    .confirm-error {
        margin: 40px auto;
        padding: 16px;
    }
}
