/* Base custom styles to complement Tailwind */

/* ── Marquee ─────────────────────────────────────── */
@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
.animate-marquee {
    display: inline-block;
    white-space: nowrap;
    width: max-content;
    animation: marquee 25s linear infinite;
    will-change: transform;
}

/* Card entrance animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbar for a polished look */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* Ensure inputs remove default Safari styling */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

/* ── Swipe Stack ─────────────────────────────────────────── */
.card-stack {
    position: relative;
    width: 260px;
    height: 320px;
    margin: 0 auto;
    overflow: visible;
}

.swipe-card {
    position: absolute;
    inset: 0;
    background: #1e293b;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.30);
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
    will-change: transform;
}

.swipe-card:active { cursor: grabbing; }

@keyframes cardEnter {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
}

.swipe-card[data-pos="0"] {
    z-index: 3;
    transform: translateX(0px) translateY(0px) rotate(0deg) scale(1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.40);
    animation: cardEnter 0.16s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.swipe-card[data-pos="1"] {
    z-index: 2;
    transform: translateX(-44px) translateY(0px) rotate(0deg) scale(0.92);
}

.swipe-card[data-pos="2"] {
    z-index: 1;
    transform: translateX(44px) translateY(0px) rotate(0deg) scale(0.92);
}

.swipe-card-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swipe-card-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.swipe-card-initials {
    font-size: 3rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.03em;
}

.swipe-card-dun-badge {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.05em;
}

.swipe-card-party-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.08em;
}

.swipe-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    padding: 40px 16px 18px;
}

.swipe-card-overlay-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: white;
    line-height: 1.35;
}

.swipe-card-overlay-dun {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 3px;
}

/* Stack nav buttons */
.stack-nav-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1.5px solid #e2e8f0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    color: #94a3b8;
}

.stack-nav-btn:hover {
    border-color: #60a5fa;
    color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 4px 14px rgba(96, 165, 250, 0.15);
}

/* ── Candidate Modal ─────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-wrapper {
    position: relative;
    width: 300px;
}

.modal-card {
    border-radius: 24px;
    overflow: hidden;
    background: white;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
}

.modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.modal-photo-area {
    position: relative;
    height: 300px;
}

.modal-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
}

.modal-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.modal-photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    padding: 40px 16px 16px;
}

.modal-overlay-name {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    line-height: 1.35;
}

.modal-overlay-dun {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 3px;
}

.modal-dun-badge {
    position: absolute;
    top: 12px;
    left: 14px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    letter-spacing: 0.05em;
}

.modal-party-badge {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    letter-spacing: 0.08em;
}

.modal-details {
    padding: 16px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.modal-detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    flex-shrink: 0;
    padding-top: 1px;
}

.modal-detail-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: #111827;
    text-align: right;
}

/* ── Theme Toggle Button ─────────────────────────────── */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    color: #111827;
}

/* ── Dark Mode ──────────────────────────────────────── */

/* Base */
html.dark body {
    background-color: #111827;
    color: #f9fafb;
}

/* Announcement bar - keep dark */
html.dark .bg-gray-900 {
    background-color: #030712;
}

/* Header */
html.dark header {
    background-color: #1f2937;
    border-color: #374151;
}

html.dark header h1 {
    color: #f9fafb;
}

html.dark header p.text-gray-500,
html.dark header p.text-gray-400 {
    color: #9ca3af;
}

/* Lang toggle container */
html.dark header .bg-gray-200 {
    background-color: #374151;
}

html.dark #lang-en,
html.dark #lang-ms {
    color: rgba(255, 255, 255, 0.55);
}

html.dark #lang-en.bg-white,
html.dark #lang-ms.bg-white {
    background-color: #ffffff;
    color: #111827;
}

/* Theme toggle in dark mode */
html.dark .theme-toggle-btn {
    background: none;
    color: #9ca3af;
}

html.dark .theme-toggle-btn:hover {
    color: #f9fafb;
}

/* Swipe section */
html.dark section.py-12 {
    background-color: #1f2937;
    border-color: #374151;
}

html.dark section.py-12 h2,
html.dark section.py-12 p {
    color: #d1d5db;
}

html.dark #stack-indicator {
    color: #9ca3af;
}

html.dark .stack-nav-btn {
    background-color: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

html.dark .stack-nav-btn:hover {
    background-color: #374151;
    border-color: #60a5fa;
    color: #60a5fa;
}

/* Sticky search bar */
html.dark .sticky {
    background-color: rgba(17, 24, 39, 0.92) !important;
    border-color: #374151;
}

html.dark #search-input {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

html.dark #search-input::placeholder {
    color: #6b7280;
}

html.dark #search-input:focus {
    border-color: #14b8a6;
    background-color: #1f2937;
}

/* Filter & sort icon buttons */
html.dark #filter-toggle,
html.dark #sort-toggle {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #9ca3af;
}

html.dark #filter-toggle:hover,
html.dark #sort-toggle:hover {
    border-color: #14b8a6;
    color: #14b8a6;
}

/* Filter panel dropdowns */
html.dark #party-filter-btn,
html.dark #race-filter-btn,
html.dark #parliament-filter-btn,
html.dark #status-filter-btn {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #9ca3af;
}

html.dark #party-filter-btn:hover,
html.dark #race-filter-btn:hover,
html.dark #parliament-filter-btn:hover,
html.dark #status-filter-btn:hover {
    border-color: #14b8a6;
}

html.dark #party-dropdown,
html.dark #race-dropdown,
html.dark #parliament-dropdown,
html.dark #status-dropdown,
html.dark #sort-dropdown {
    background-color: #1f2937;
    border-color: #374151;
}

html.dark #party-options label,
html.dark #race-options label,
html.dark #parliament-options label,
html.dark #status-options label {
    color: #d1d5db;
}

html.dark #party-options label:hover,
html.dark #race-options label:hover,
html.dark #parliament-options label:hover,
html.dark #status-options label:hover {
    background-color: #374151;
}

html.dark .sort-option {
    color: #d1d5db;
}

html.dark .sort-option:hover {
    background-color: #374151;
}

html.dark #clear-filters-panel {
    color: #6b7280;
}

html.dark #clear-filters-panel:hover {
    color: #14b8a6;
}

/* Main area */
html.dark main {
    background-color: #111827;
}

html.dark #rosterTitle,
html.dark [data-i18n="rosterTitle"] {
    color: #d1d5db;
}

html.dark #result-count {
    background-color: #1f2937;
    color: #9ca3af;
}

/* Candidate cards */
html.dark [data-id] {
    background-color: #1f2937;
    border-color: #374151;
}

html.dark [data-id] .text-gray-900 {
    color: #f9fafb;
}

html.dark [data-id] .text-gray-400 {
    color: #9ca3af;
}

/* Empty state */
html.dark #empty-state h3 {
    color: #f9fafb;
}

html.dark #empty-state p {
    color: #9ca3af;
}

html.dark #clear-filters {
    background-color: #134e4a;
    color: #5eead4;
}

/* Footer */
html.dark footer {
    background-color: #1f2937;
    border-color: #374151;
}

html.dark footer a {
    color: #6b7280;
}

html.dark footer a:hover {
    color: #d1d5db;
}

/* Modal */
html.dark .modal-card {
    background-color: #1f2937;
}

html.dark .modal-close {
    background-color: #374151;
    color: #d1d5db;
}

html.dark .modal-close:hover {
    background-color: #4b5563;
    color: #f9fafb;
}

html.dark .modal-detail-row {
    border-color: #374151;
}

html.dark .modal-detail-value {
    color: #f9fafb;
}

/* Scrollbar in dark */
html.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

