/* Public Website Styles for LG Results & Profiles */

.container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 6px 20px;
}

/* Election Header & Titles */
.results-header-box, .election-header {
    margin-bottom: 30px;
}

.election-header {
    border-bottom: 2px solid var(--ecsa-blue);
    padding-bottom: 20px;
}

.election-body-tag {
    display: inline-block;
    background-color: var(--ecsa-blue);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 12px;
    margin-top: 18px;
}

h1.main-title {
    color: var(--ecsa-dark);
    font-size: 2.2rem;
    margin: 0 0 5px 0;
    font-weight: 700;
    line-height: 1.2;
}

.election-sub {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--ecsa-blue);
    padding-bottom: 10px;
    display: block;
}

h2 {
    color: var(--ecsa-blue);
    font-size: 1.5rem;
    margin-top: 40px;
    margin-bottom: 15px;
    border-left: 5px solid var(--ecsa-blue);
    padding-left: 15px;
    font-weight: 700;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
}

.table-bordered th, .table-bordered td {
    border: 1px solid #dee2e6;
    padding: 12px 15px;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}

th[scope='row'] {
    background-color: #f1f4f9;
    width: 40%;
    font-weight: 600;
    color: var(--ecsa-dark);
    text-align: left;
}

.results-table thead tr {
    background-color: var(--ecsa-blue);
    color: white;
}

.results-table th {
    font-weight: 700;
    font-size: 14px;
}

/* Candidate Profiles */
.candidate-profile-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    display: flex;
    gap: 30px;
    padding: 30px;
    border: 1px solid #eee;
}

.profile-photo {
    flex: 0 0 200px;
}

.profile-photo img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #f9f9f9;
}

.no-photo {
    width: 100%;
    aspect-ratio: 1;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    padding: 10px;
}

.profile-content {
    flex: 1;
}

.candidate-name {
    font-size: 1.8rem;
    color: var(--ecsa-dark);
    margin: 0 0 15px 0;
    font-weight: 700;
    border-left: none;
    padding-left: 0;
}

.profile-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #444;
    white-space: pre-line;
    margin-bottom: 20px;
}

/* Badges & Buttons */
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #d1d9e6;
    background-color: #f8f9fa;
    border-radius: 4px;
    color: var(--ecsa-blue);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin: 0 4px;
}

.yt-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 0 12px 0 0;
    border-radius: 6px;
    color: #cc0000;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    font-size: 0.9rem;
    margin: 5px 0;
    overflow: hidden;
    line-height: 1;
}

.yt-button:hover {
    background: #fdfdfd;
    border-color: #cc0000;
    box-shadow: 0 2px 4px rgba(204, 0, 0, 0.1);
}

.yt-button img {
    height: 44px;
    width: auto;
    display: block;
    margin: 0;
}

/* Progress Bars */
.percent-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

progress {
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ccc;
    flex-grow: 1;
    background-color: #fff;
}

progress::-webkit-progress-bar { background-color: #eee; }
progress::-webkit-progress-value { background-color: var(--ecsa-blue); }
progress::-moz-progress-bar { background-color: var(--ecsa-blue); }

/* Results specific */
.status-elected { color: #28a745; font-weight: 700; }
.status-excluded { color: #333; font-weight: 400; font-style: normal; }
.footer-note { font-size: 0.85rem; color: var(--text-muted); font-style: italic; margin-top: 5px; }
.outcome-box {
    background-color: var(--bg-gray);
    padding: 20px;
    border-radius: 4px;
    border-left: 4px solid #28a745;
    font-size: 1.1rem;
}

/* Navigation */
.back-nav { margin: 20px 0; padding-bottom: 5px; padding-left: 20px; }
.back-nav a { text-decoration: none; color: var(--ecsa-blue); font-weight: 700; }
.back-nav a:hover { text-decoration: underline; }

/* Financial Returns */
.financial-returns-section {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

.financial-return-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ecsa-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 20px;
    margin-bottom: 8px;
}

.financial-return-link:hover {
    text-decoration: underline;
}

/* Collapsible Sections */
.section-header {
    color: var(--ecsa-blue);
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
    border-left: 5px solid var(--ecsa-blue);
    padding: 5px 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f4f9;
    transition: background 0.2s;
}
.section-header:hover {
    background: #e6f0fa;
}
.section-header::after {
    content: '\25BC';
    font-size: 0.9rem;
    transition: transform 0.3s;
}
.section-header.collapsed::after {
    transform: rotate(-90deg);
}
.section-content {
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}
.section-content.collapsed {
    display: none;
}

/* Profiles Listing specific */
.intro-text { font-size: 1.1rem; color: #555; margin-bottom: 30px; line-height: 1.6; }
.compact-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    transition: all 0.2s;
}
.compact-row.is-draft {
    background-color: #cbd5e1 !important;
    border-color: #94a3b8 !important;
}
.compact-row.is-draft:hover {
    background-color: #94a3b8 !important;
    border-color: #64748b !important;
}
.compact-row:hover:not(.is-draft) { 
    border-color: #a5d6a7 !important; 
    background: #d0edd2 !important; 
}
.view-link-inline { font-weight: 700; color: var(--ecsa-blue); text-decoration: none; font-size: 0.9rem; }

/* Chart Styling */
.chart-container { 
    background: #eef6ff; 
    border: 1px solid #d1e3f8; 
    border-radius: 8px; 
    padding: 20px; 
    margin-bottom: 25px; 
    position: relative; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); 
}

/* Utility & Layout Classes */
.election-notice {
    margin: 0;
    color: var(--ecsa-dark);
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 600;
}

.council-logo-container {
    margin-top: 15px;
}

.council-logo {
    max-height: 100px;
    width: auto;
    display: block;
}

.content-box {
    background: white;
    padding: 25px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 30px;
    line-height: 1.6;
}

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.attachment-item {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.attachment-link {
    font-weight: 600;
    color: var(--ecsa-blue);
    text-decoration: none;
    font-size: 1.05rem;
}

.attachment-link:hover {
    text-decoration: underline;
}

/* Listing & Year Sections */
.election-year-section {
    margin-bottom: 40px;
}

.year-title {
    color: var(--ecsa-dark);
    border-bottom: 3px solid var(--ecsa-blue);
    padding-bottom: 6px;
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
}

.type-subtitle {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
}

.type-subtitle.periodic {
    color: #15803d;
}

.compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
}

/* Standalone Profile Page */
.profile-container {
    max-width: 800px;
    margin: 40px auto;
    background: #fff;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.profile-info {
    flex: 1;
    min-width: 300px;
}

.election-context {
    color: var(--ecsa-blue);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 20px;
    display: block;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.back-link {
    display: inline-block;
    margin-top: 30px;
    color: var(--ecsa-blue);
    text-decoration: none;
    font-weight: 700;
}

.back-link:hover {
    text-decoration: underline;
}

/* Responsive */
.show-mobile { display: none; }

@media (max-width: 992px) {
    .compact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
        margin: 15px auto;
    }

    .election-header {
        flex-direction: column-reverse !important;
        align-items: center !important;
        text-align: center;
        gap: 15px !important;
    }

    .council-logo {
        max-height: 160px !important;
    }

    h1.main-title {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .section-header {
        font-size: 1.05rem;
    }

    .candidate-name {
        font-size: 1.5rem;
    }

    .logo-img {
        height: 45px;
    }

    .row-content-text {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .breadcrumb-container {
        font-size: 0 !important;
        color: transparent !important;
        line-height: 1.4;
    }

    .breadcrumb-container a:not(:nth-last-of-type(1)) {
        display: none !important;
    }

    .breadcrumb-container span {
        display: none !important;
    }

    .breadcrumb-container a:nth-last-of-type(1) {
        display: inline-flex !important;
        align-items: center;
        font-size: 13px !important;
        color: var(--ecsa-blue) !important;
        font-weight: 600;
        text-decoration: none;
        padding: 6px 0;
    }

    .breadcrumb-container a:nth-last-of-type(1)::before {
        content: "←";
        margin-right: 8px;
        font-size: 15px;
        font-weight: bold;
    }

    .view-link-inline {
        background: var(--ecsa-blue);
        color: white !important;
        padding: 6px 10px;
        border-radius: 4px;
        font-size: 12px;
        text-decoration: none;
    }

    .hide-mobile { display: none !important; }
    .show-mobile { display: inline !important; }

    /* Make tables fit screen width on mobile without scrolling */
    .section-content {
        width: 100%;
    }

    .table {
        display: table !important;
        width: 100% !important;
        table-layout: auto !important;
        min-width: 0 !important;
        border-collapse: collapse !important;
    }

    .table tbody {
        display: table-row-group !important;
    }
    
    .table tr {
        display: table-row !important;
    }
    
    .table th,
    .table td {
        display: table-cell !important;
        width: auto !important;
        padding: 5px 6px !important;
        font-size: 11px !important;
        line-height: 1.3 !important;
        word-break: break-word !important;
        box-sizing: border-box;
    }

    /* Key data / additional data tables (no thead) style */
    .table:not(:has(thead)) th[scope="row"] {
        width: 50% !important;
        background-color: #f1f4f9;
        font-weight: 600;
        text-align: left;
    }

    /* Reduce cell padding on mobile */
    .table-bordered th, .table-bordered td {
        padding: 5px 6px !important;
        font-size: 11px !important;
    }
    
    .results-table td, .results-table th {
        padding: 5px 6px !important;
        font-size: 11px !important;
    }

    .candidate-profile-card {
        padding: 15px;
        gap: 15px;
    }

    .percent-cell {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .percent-cell progress {
        width: 100%;
    }
}

@media (max-width: 650px) {
    .candidate-profile-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px;
    }
    .profile-photo {
        flex: 0 0 180px;
        width: 180px;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .section-header {
        padding: 5px 10px;
        font-size: 0.95rem;
    }

    .table-bordered th, .table-bordered td {
        padding: 6px 8px;
    }
    
    .results-table td, .results-table th {
        padding: 4px 6px;
        font-size: 12px;
    }

    .content-box, .outcome-box {
        padding: 15px;
    }

    .candidate-profile-card {
        padding: 12px;
    }

    .profile-text {
        font-size: 0.95rem;
    }
}

@media print {
    .top-bar, header, footer, .back-nav, .breadcrumb-bg, .hero { display: none; }
    body { background: white; }
    .container { margin: 0; max-width: 100%; }
}

/* Nominations mode overrides to reduce size and padding */
.candidate-profile-card.nominations-mode {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.nominations-mode .candidate-name {
    font-size: 1.15rem;
    margin: 0;
    padding: 0;
}

/* Layout Switches & Toggle Styles */
.layout-btn:hover {
    border-color: #002664 !important;
    background-color: #f1f5f9 !important;
}

.layout-btn.active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hidden-row {
    display: none !important;
}

/* Default List styling fixes (using colon separator on list mode) */
.view-list .council-label::after {
    content: ": ";
    font-weight: normal;
}

/* TABLE VIEW STYLES */
.table-header-row {
    display: none;
}

/* Table view cells display styles */
.vacancy-label-cell, .candidate-label-cell {
    display: none;
}

.view-table .table-header-row {
    display: grid;
    grid-template-columns: 280px 1fr 100px 100px 130px;
    padding: 12px 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-bottom: 2px solid #cbd5e1;
    border-radius: 8px 8px 0 0;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: -1px;
}

.view-table .compact-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 25px;
}

.view-table .compact-row {
    display: grid;
    grid-template-columns: 280px 1fr 100px 100px 130px;
    align-items: center;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    background: #ffffff !important;
    padding: 12px 20px;
    box-shadow: none;
}

.view-table .compact-row:last-child {
    border-bottom: none;
}

.view-table .compact-row:hover:not(.is-draft) {
    background: #f8fafc !important;
}

.view-table .vacancy-label-cell, .view-table .candidate-label-cell {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: #475569;
    font-weight: 600;
}

.view-table .compact-row .row-content-text {
    display: contents;
}

/* CARDS VIEW STYLES */
.view-cards .compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.view-cards .compact-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 16px;
    min-height: auto;
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    gap: 6px 12px;
}

.view-cards .compact-row:hover:not(.is-draft) {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1 !important;
}

.view-cards .compact-row.periodic {
    border-top: 4px solid #16a34a;
}

.view-cards .compact-row:not(.periodic) {
    border-top: 4px solid #004a99;
}

.view-cards .compact-row .row-content-text {
    display: contents;
}

.election-details {
    display: none;
}

.view-cards .election-details {
    grid-column: 1;
    display: flex;
    gap: 15px;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #475569;
    width: 100%;
}

.view-cards .detail-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.view-cards .detail-label {
    color: #64748b;
    font-weight: 600;
}

.view-cards .detail-val {
    font-weight: 700;
    color: var(--ecsa-dark);
}



.view-cards .council-label {
    font-size: 0.85rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    grid-column: 1 / -1;
}

.view-cards .election-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ecsa-dark);
    grid-column: 1 / -1;
}

.view-cards .compact-row .view-link-inline {
    grid-column: 2;
    align-self: center;
    background: #004a99;
    color: white !important;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0;
    display: inline-block;
    transition: background-color 0.2s;
}

.view-cards .compact-row.periodic .view-link-inline {
    background: #16a34a;
}

.view-cards .compact-row .view-link-inline:hover {
    opacity: 0.95;
}

@media (max-width: 768px) {
    .view-table .table-header-row {
        display: none !important;
    }
    .view-table .compact-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        border: none;
        border-radius: 0;
        background: transparent;
    }
    .view-table .compact-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        background: #ffffff !important;
        padding: 12px;
        gap: 8px;
    }
    .view-table .compact-row .row-content-text {
        display: block;
    }
    .view-table .vacancy-label-cell, .view-table .candidate-label-cell {
        display: none !important;
    }
    .view-table .compact-row .view-link-inline {
        align-self: flex-end;
    }
    .view-table .council-label::after {
        content: ": ";
        font-weight: normal;
    }
}

/* TIMELINE VIEW STYLES */
.view-timeline .election-year-section {
    position: relative;
    padding-left: 45px;
    margin-bottom: 50px;
}

/* Vertical timeline track line */
.view-timeline .election-year-section::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 25px;
    bottom: -35px;
    width: 4px;
    background: #e2e8f0;
    border-radius: 2px;
}

.view-timeline .election-year-section:last-of-type::before {
    bottom: 0;
    height: calc(100% - 25px);
}

/* Year Milestone Node */
.view-timeline .year-title {
    position: relative;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 30px;
    font-size: 1.6rem;
    color: var(--ecsa-dark);
}

.view-timeline .year-title::before {
    content: "";
    position: absolute;
    left: -38px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #004a99;
    border: 4px solid #fff;
    box-shadow: 0 0 0 4px #e6f0fa;
    z-index: 2;
}

/* Type Subtitles on the timeline */
.view-timeline .type-subtitle {
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Timeline Cards List */
.view-timeline .compact-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.view-timeline .compact-row {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

/* Connector dots for each timeline item */
.view-timeline .compact-row::before {
    content: "";
    position: absolute;
    left: -35px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 3px solid #fff;
    z-index: 2;
    transition: background-color 0.2s, transform 0.2s;
}

.view-timeline .compact-row:hover::before {
    background: #004a99;
    transform: translateY(-50%) scale(1.2);
}

.view-timeline .compact-row.periodic:hover::before {
    background: #16a34a;
}

.view-timeline .compact-row:hover:not(.is-draft) {
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: #cbd5e1 !important;
}

/* Hide table headers in timeline view */
.view-timeline .table-header-row {
    display: none !important;
}

.view-timeline .council-label::after {
    content: ": ";
    font-weight: normal;
}

@media (max-width: 576px) {
    .view-timeline .election-year-section {
        padding-left: 25px;
    }
    .view-timeline .election-year-section::before {
        left: 8px;
    }
    .view-timeline .year-title::before {
        left: -25px;
        width: 16px;
        height: 16px;
    }
    .view-timeline .compact-row::before {
        left: -22px;
        width: 8px;
        height: 8px;
    }
    .view-timeline .compact-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .view-timeline .compact-row .view-link-inline {
        align-self: flex-end;
    }
}

/* Force Draft rows to show grey background in all layout views (List, Cards, Table, Timeline) */
.view-list .compact-row.is-draft,
.view-table .compact-row.is-draft,
.view-cards .compact-row.is-draft,
.view-timeline .compact-row.is-draft {
    background-color: #cbd5e1 !important;
    border-color: #94a3b8 !important;
    transform: none !important; /* Disable hover lift effects on timeline/cards for drafts */
    box-shadow: none !important; /* Disable card shadows for drafts */
}

.view-list .compact-row.is-draft:hover,
.view-table .compact-row.is-draft:hover,
.view-cards .compact-row.is-draft:hover,
.view-timeline .compact-row.is-draft:hover {
    background-color: #94a3b8 !important;
    border-color: #64748b !important;
}


