/* ibox collapse functionality */
.collapse-link {
    cursor: pointer;
}

.ibox-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ibox-tools {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding: 0;
}

.ibox-tools a {
    cursor: pointer;
    margin-left: 5px;
}

.ibox.collapsed .ibox-content {
    display: none;
}

.ibox.collapsed .fa-chevron-up:before {
    content: "\f078";
}

/* Style h2 headings in ibox-title to maintain proper visual hierarchy */
.ibox-title h2 {
    font-size: 14px; /* Match original h5 size from previous deployment */
    margin: 0;
    line-height: 1.2;
    font-weight: bold; /* Ensure consistent font weight */
}

/* Grid styling */
#gridBallotStyles {
    width: 100%;
}

#gridBallotStyles .k-grid-header th {
    background-color: #f5f5f5;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    /* Remove bottom margin from columns to rely solely on ibox margin-bottom for consistent spacing */
    #divPPDetail .col-sm-6 {
        margin-bottom: 0;
    }
    
    /* Ensure consistent spacing between all iboxes in mobile view */
    #divPPDetail .ibox {
        margin-bottom: 25px;
    }
    
    /* Remove bottom margin from last ibox in each column to avoid extra space */
    #divPPDetail .col-sm-6:last-child .ibox:last-child {
        margin-bottom: 0;
    }
}

/* Mobile/Desktop column toggling for Sample Ballots grid */
@media (max-width: 600px) {
    #gridBallotStyles td.desktop-col,
    #gridBallotStyles th.desktop-col {
        display: none !important;
    }
    #gridBallotStyles td.mobile-combined-col,
    #gridBallotStyles th.mobile-combined-col {
        display: table-cell !important;
        width: 100% !important;
    }
    #gridBallotStyles table {
        table-layout: auto !important;
    }
    /* Hide grid column headers on mobile */
    #gridBallotStyles .k-grid-header,
    #gridBallotStyles thead,
    #gridBallotStyles .k-table-thead {
        display: none !important;
    }
}

@media (min-width: 601px) {
    #gridBallotStyles td.mobile-combined-col,
    #gridBallotStyles th.mobile-combined-col {
        display: none !important;
    }
    #gridBallotStyles td.desktop-col,
    #gridBallotStyles th.desktop-col {
        display: table-cell !important;
    }
}

/* Mobile cell styling */
.ballot-mobile-cell {
    padding: 8px 0 8px 16px;
}

/* Ballot links styling - blue color for both mobile and desktop */
#gridBallotStyles a {
    color: #0056b3 !important;
    text-decoration: underline;
}

/* Sample ballots grid styling */
#gridBallotStyles .k-grid-header th {
    background-color: #C4E2F7;
    text-align: center !important;
}

#gridBallotStyles .k-grid-header th .k-link {
    color: #000;
    font-weight: 600;
    text-align: center !important;
    justify-content: center !important;
}

#gridBallotStyles .k-grid-header .k-table-th {
    text-align: center !important;
}

#gridBallotStyles .k-grid-header .k-cell-inner {
    justify-content: center !important;
}

/* Standard rows - white background */
#gridBallotStyles tbody tr {
    background-color: #ffffff !important;
}

/* Alternate rows - light blue background */
#gridBallotStyles tbody tr.k-alt,
#gridBallotStyles tbody tr.k-table-alt-row {
    background-color: #E6F2FB !important;
}

#gridBallotStyles tbody tr td {
    background-color: inherit !important;
}

/* Float e-margins utility */
.float-e-margins {
    margin-bottom: 20px;
}

/* County image responsive styling */
.county-image {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Padding utilities */
.p-sm {
    padding: 10px;
}

.p-w-sm {
    padding: 5px 10px;
}

/* Modal styling */
.modal.inmodal .modal-content {
    background-color: transparent;
    border: 0;
    box-shadow: none;
}

.modal.inmodal .modal-body {
    background-color: #fff;
    border-radius: 4px;
    padding: 20px;
}

.modal.inmodal .close {
    z-index: 9999;
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 24px;
}

/* Prevent background scrolling when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Ensure modal is scrollable if needed */
.modal.show {
    overflow-x: hidden;
    overflow-y: auto;
}

/* search ibox-content: compact so its height matches the New Search button */
.search-ibox-content {
    display: flex !important; /* center the inner row vertically */
    align-items: center !important;
    justify-content: center !important;
    /* remove vertical padding so the container height is driven by the button */
    padding: 0 15px !important;
    box-sizing: border-box;
    /* ensure we always fit the button height (44px) */
    min-height: 44px;
    /* prevent any extra height from line-height inheritance */
    line-height: 1;
    /* remove white background */
    background-color: transparent !important;
    border: none !important;
}

/* Ensure the row inside search-ibox-content is also vertically centered */
.search-ibox-content #divPPSearch {
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Center the button container vertically */
.search-ibox-content .ibox {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 420px) {
    .search-ibox-content {
        padding: 0 10px !important;
        min-height: 40px;
    }
}
