/**
 * Election module - Apple-style UI
 * JCI Sibu Member Management System
 *
 * Location: members/election/election.css
 * Scoped to .ap so the sidebar, header and other modules are untouched.
 */

/* Page background behind the election pages */
.content-wrapper:has(> .ap) { background: #f5f5f7; }

.ap,
.ap-modal {
    --ap-bg: #f5f5f7;
    --ap-card: #ffffff;
    --ap-text: #1d1d1f;
    --ap-text-2: #6e6e73;
    --ap-text-3: #86868b;
    --ap-sep: #e5e5ea;
    --ap-field: #d2d2d7;
    --ap-fill: rgba(120, 120, 128, .08);
    --ap-fill-2: rgba(120, 120, 128, .14);

    --ap-blue: #0071e3;
    --ap-blue-hover: #0077ed;
    --ap-blue-text: #0066cc;
    --ap-blue-tint: rgba(0, 113, 227, .10);
    --ap-green: #34c759;
    --ap-green-text: #1d7f36;
    --ap-green-tint: rgba(52, 199, 89, .14);
    --ap-orange: #ff9f0a;
    --ap-orange-text: #a35200;
    --ap-orange-tint: rgba(255, 159, 10, .16);
    --ap-red: #ff3b30;
    --ap-red-text: #d70015;
    --ap-red-tint: rgba(255, 59, 48, .10);
    --ap-purple: #af52de;
    --ap-purple-text: #8944ab;
    --ap-purple-tint: rgba(175, 82, 222, .12);

    --ap-radius-lg: 18px;
    --ap-radius: 14px;
    --ap-radius-sm: 10px;

    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.47;
    letter-spacing: -.01em;
    color: var(--ap-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.ap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 8px 0 56px;
}
.ap *, .ap *::before, .ap *::after { box-sizing: border-box; }
.ap a { color: var(--ap-blue-text); text-decoration: none; }
.ap a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------
   Page header
   --------------------------------------------------------------- */
.ap-back {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 6px;
    font-size: 15px;
    color: var(--ap-blue-text);
}
.ap-back::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border: solid currentColor;
    border-width: 0 0 2px 2px;
    transform: rotate(45deg);
}
.ap-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 28px;
}
.ap-title {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -.025em;
}
.ap-subtitle {
    margin: 6px 0 0;
    font-size: 17px;
    color: var(--ap-text-2);
}
.ap-header-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------
   Buttons (pill)
   --------------------------------------------------------------- */
.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 18px;
    border: 0;
    border-radius: 980px;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color .15s ease, transform .1s ease;
}
.ap-btn:active { transform: scale(.97); }
.ap-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(0, 113, 227, .35); }

.ap-btn-primary        { background: var(--ap-blue); color: #fff !important; }
.ap-btn-primary:hover  { background: var(--ap-blue-hover); }
.ap-btn-tinted         { background: var(--ap-blue-tint); color: var(--ap-blue-text) !important; }
.ap-btn-tinted:hover   { background: rgba(0, 113, 227, .16); }
.ap-btn-gray           { background: var(--ap-fill-2); color: var(--ap-text) !important; }
.ap-btn-gray:hover     { background: rgba(120, 120, 128, .2); }
.ap-btn-green          { background: #248a3d; color: #fff !important; }
.ap-btn-green:hover    { background: #1f7a35; }
.ap-btn-orange         { background: var(--ap-orange-tint); color: var(--ap-orange-text) !important; }
.ap-btn-orange:hover   { background: rgba(255, 159, 10, .24); }
.ap-btn-danger         { background: var(--ap-red-tint); color: var(--ap-red-text) !important; }
.ap-btn-danger:hover   { background: rgba(255, 59, 48, .16); }
.ap-btn-danger-solid   { background: var(--ap-red); color: #fff !important; }
.ap-btn-danger-solid:hover { background: #e6352b; }

.ap-btn-sm { height: 30px; padding: 0 14px; font-size: 14px; }
.ap-btn-lg { height: 44px; padding: 0 24px; font-size: 17px; }
.ap-btn[disabled], .ap-btn.is-disabled { opacity: .4; pointer-events: none; }

/* ---------------------------------------------------------------
   Cards and panels
   --------------------------------------------------------------- */
.ap-card {
    background: var(--ap-card);
    border-radius: var(--ap-radius-lg);
    overflow: hidden;
}
.ap-card + .ap-card { margin-top: 20px; }
.ap-card-body { padding: 24px 28px; }
.ap-card-body + .ap-card-body { padding-top: 0; }
.ap-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 24px 28px 0;
}
.ap-card-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.02em;
}
.ap-card-sub { margin: 4px 0 0; font-size: 15px; color: var(--ap-text-2); }
.ap-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    border-top: 1px solid var(--ap-sep);
}

/* Grey inset panel inside a white card */
.ap-panel {
    height: 100%;
    padding: 18px 20px;
    border-radius: var(--ap-radius);
    background: var(--ap-bg);
    display: flex;
    flex-direction: column;
}
.ap-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.ap-panel-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.ap-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

.ap-section-title {
    margin: 32px 0 10px;
    padding: 0 4px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.02em;
}

/* ---------------------------------------------------------------
   Rows (iOS Settings style)
   --------------------------------------------------------------- */
.ap-rows { list-style: none; margin: 0; padding: 0; }
.ap-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ap-sep);
    font-size: 15px;
}
.ap-row:last-child { border-bottom: 0; }
.ap-row-label { color: var(--ap-text); flex-shrink: 0; }
.ap-row-value { color: var(--ap-text-2); text-align: right; overflow-wrap: anywhere; }
.ap-row-value s { color: var(--ap-text-3); }
.ap-row-value .is-warning { color: var(--ap-orange-text); font-weight: 500; }
.ap-muted { color: var(--ap-text-3); }

/* ---------------------------------------------------------------
   Status pills
   --------------------------------------------------------------- */
.ap-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 9px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--ap-fill-2);
    color: var(--ap-text-2);
}
.ap-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.ap-pill-green  { background: var(--ap-green-tint);  color: var(--ap-green-text); }
.ap-pill-orange { background: var(--ap-orange-tint); color: var(--ap-orange-text); }
.ap-pill-red    { background: var(--ap-red-tint);    color: var(--ap-red-text); }
.ap-pill-blue   { background: var(--ap-blue-tint);   color: var(--ap-blue-text); }
.ap-pill-purple { background: var(--ap-purple-tint); color: var(--ap-purple-text); }
.ap-pill-plain::before { display: none; }

/* ---------------------------------------------------------------
   Segmented progress bar
   --------------------------------------------------------------- */
.ap-progress { display: flex; gap: 4px; }
.ap-progress span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--ap-fill-2);
}
.ap-progress span.is-done    { background: var(--ap-green); }
.ap-progress span.is-current { background: var(--ap-blue); }
.ap-progress span.is-waiting { background: var(--ap-orange); }
.ap-progress-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    margin-top: 10px;
    font-size: 15px;
}
.ap-progress-meta strong { font-weight: 600; }
.ap-progress-meta span { color: var(--ap-text-2); }

/* ---------------------------------------------------------------
   Stats
   --------------------------------------------------------------- */
.ap-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0;
}
.ap-stat { padding: 2px 20px; border-left: 1px solid var(--ap-sep); }
.ap-stat:first-child { padding-left: 0; border-left: 0; }
.ap-stat strong {
    display: block;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.ap-stat span { font-size: 13px; color: var(--ap-text-2); }

.ap-meta { font-size: 13px; color: var(--ap-text-3); }

/* ---------------------------------------------------------------
   Banners (alerts, call-to-action strips)
   --------------------------------------------------------------- */
.ap-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: var(--ap-radius);
    font-size: 15px;
    background: var(--ap-card);
}
.ap-banner p { margin: 0; flex: 1 1 240px; }
.ap-banner-blue   { background: var(--ap-blue-tint);   color: #004a99; }
.ap-banner-green  { background: var(--ap-green-tint);  color: #145c27; }
.ap-banner-orange { background: var(--ap-orange-tint); color: #7a3d00; }
.ap-banner-red    { background: var(--ap-red-tint);    color: #a10010; }
.ap-banner .btn-close { margin-left: auto; font-size: 12px; }
.ap-card .ap-banner { margin: 0; border-radius: 0; }

/* ---------------------------------------------------------------
   Segmented control (works with Bootstrap tabs)
   --------------------------------------------------------------- */
.ap-segmented {
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    padding: 2px;
    border-radius: 9px;
    background: var(--ap-fill-2);
    list-style: none;
    margin: 0;
}
.ap-segmented button,
.ap-segmented a {
    flex: 1 0 auto;
    padding: 6px 16px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--ap-text) !important;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none !important;
}
.ap-segmented .active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04);
}
.ap-segmented .ap-count { margin-left: 4px; color: var(--ap-text-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------
   Forms
   --------------------------------------------------------------- */
.ap .form-label, .ap-modal .form-label { margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--ap-text); }
.ap .form-control,
.ap .form-select,
.ap-modal .form-control,
.ap-modal .form-select {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--ap-field);
    border-radius: 12px;
    background-color: #fff;
    font-size: 16px; /* 16px stops iOS from zooming in on focus */
    color: var(--ap-text);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.ap .form-select, .ap-modal .form-select { padding-right: 38px; }
.ap .form-control:focus,
.ap .form-select:focus,
.ap-modal .form-control:focus,
.ap-modal .form-select:focus {
    border-color: var(--ap-blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, .18);
}
.ap .form-control:disabled,
.ap .form-control[readonly] { background: var(--ap-bg); color: var(--ap-text-2); }
.ap .form-text, .ap-modal .form-text { margin-top: 6px; font-size: 13px; color: var(--ap-text-3); }
.ap-required { color: var(--ap-red-text); }

.ap-form-section { padding: 28px; border-bottom: 1px solid var(--ap-sep); }
.ap-form-section:last-of-type { border-bottom: 0; }
.ap-form-section h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -.015em; }
.ap-form-section > p { margin: 0 0 20px; color: var(--ap-text-2); }

/* Selectable option card */
.ap-choice {
    display: block;
    height: 100%;
    padding: 16px 18px;
    border: 1.5px solid var(--ap-field);
    border-radius: var(--ap-radius);
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.ap-choice:hover { border-color: #a1a1a6; }
.ap-choice.active { border-color: var(--ap-blue); background: var(--ap-blue-tint); }
.ap-choice input { margin-right: 8px; accent-color: var(--ap-blue); }
.ap-choice strong { font-weight: 600; }
.ap-choice small { display: block; margin: 4px 0 0 24px; font-size: 14px; color: var(--ap-text-2); }

/* ---------------------------------------------------------------
   Vertical steps (timelines)
   --------------------------------------------------------------- */
.ap-steps { list-style: none; margin: 0; padding: 0; }
.ap-step { position: relative; padding: 0 0 18px 34px; }
.ap-step:last-child { padding-bottom: 0; }
.ap-step::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 24px;
    bottom: 2px;
    width: 2px;
    border-radius: 1px;
    background: var(--ap-sep);
}
.ap-step:last-child::before { display: none; }
.ap-step.is-done::before { background: var(--ap-green); }
.ap-step-dot {
    position: absolute;
    left: 0;
    top: 1px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--ap-field);
    background: #fff;
}
.ap-step.is-done .ap-step-dot { border-color: var(--ap-green); background: var(--ap-green); }
.ap-step.is-done .ap-step-dot::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 3px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.ap-step.is-current .ap-step-dot { border-color: var(--ap-blue); box-shadow: inset 0 0 0 4px #fff; background: var(--ap-blue); }
.ap-step.is-later .ap-step-dot { border-style: dashed; }
.ap-step-title { font-weight: 600; line-height: 24px; }
.ap-step:not(.is-done):not(.is-current) .ap-step-title { color: var(--ap-text-2); font-weight: 500; }
.ap-step-text { font-size: 13px; color: var(--ap-text-2); }

/* ---------------------------------------------------------------
   Item list (rows with title, meta and trailing action)
   --------------------------------------------------------------- */
.ap-items { list-style: none; margin: 0; padding: 0; }
.ap-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--ap-sep);
}
.ap-item:last-child { border-bottom: 0; }
.ap-item-main { flex: 1 1 260px; min-width: 0; }
.ap-item-title { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.ap-item-sub { font-size: 14px; color: var(--ap-text-2); }
.ap-item-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ---------------------------------------------------------------
   Order number, meter
   --------------------------------------------------------------- */
.ap-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--ap-fill-2);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ap-text-2);
}
.ap-meter {
    width: 100px;
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--ap-fill-2);
    overflow: hidden;
}
.ap-meter span { display: block; height: 100%; border-radius: 2px; background: var(--ap-orange); }
.ap-meter span.is-met { background: var(--ap-green); }

/* ---------------------------------------------------------------
   Modal as an iOS-style sheet
   Usage: <div class="modal fade ap-modal">
   --------------------------------------------------------------- */
.ap-modal .modal-content {
    border: 0;
    border-radius: 20px;
    background: var(--ap-card);
    color: var(--ap-text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .2);
    overflow: hidden;
}
.ap-modal .modal-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ap-sep);
}
.ap-modal .modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.015em;
    text-align: center;
}
.ap-sheet-btn {
    padding: 4px 6px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 17px;
    color: var(--ap-blue-text);
    cursor: pointer;
}
.ap-sheet-btn:hover { opacity: .7; }
.ap-sheet-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 113, 227, .35); border-radius: 6px; }
.ap-sheet-btn.is-confirm { justify-self: end; font-weight: 600; }
.ap-modal .modal-body { padding: 24px; }

/* ---------------------------------------------------------------
   Empty state
   --------------------------------------------------------------- */
.ap-empty { padding: 64px 28px; text-align: center; }
.ap-empty h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.ap-empty p { max-width: 42ch; margin: 0 auto 22px; color: var(--ap-text-2); }

/* ---------------------------------------------------------------
   Layout helpers
   --------------------------------------------------------------- */
.ap-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (min-width: 992px) { .ap-sticky { position: sticky; top: 24px; } }

@media (max-width: 767.98px) {
    .ap-grid-2 { grid-template-columns: 1fr; }
    .ap-card-body, .ap-form-section { padding: 20px; }
    .ap-card-head { padding: 20px 20px 0; }
    .ap-card-foot, .ap-item { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 575.98px) {
    .ap { padding-top: 0; }
    .ap-title { font-size: 28px; }
    .ap-subtitle { font-size: 15px; }
    .ap-stat { padding: 2px 12px; }
    .ap-stat strong { font-size: 22px; }
    .ap-card-foot .ap-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .ap-btn { transition: none; }
    .ap-btn:active { transform: none; }
}