/**
 * BCLEM Honour Roll Plugin - Frontend Styles
 */

.bclem-honour-roll-wrapper {
    width: 100%;
    margin: 1.5rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2c3e50;
}

.honour-roll {
    position: relative;
}

/* Search Form Container */
.honour-roll-search {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease-in-out;
}

.search-main-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-input-wrap {
    position: relative;
    flex: 1;
}

.honour-roll input[type="text"].search-query {
    width: 100%;
    height: 48px;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    font-size: 1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background-color: #f8fafc;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.honour-roll input[type="text"].search-query:focus {
    border-color: #0284c7;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.search-clear-btn:hover {
    color: #ffffff !important;
}

.search-submit-btn {
    height: 48px;
    padding: 0 1.75rem;
    background: #0f172a;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.search-submit-btn:hover {
    background: #1e293b;
}

.search-submit-btn:active {
    transform: translateY(1px);
}

.filter-toggle-wrap {
    display: flex;
    justify-content: flex-end;
}

.search-filter-toggle {
    font-size: 0.9rem;
    color: #0284c7;
    text-decoration: none;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.search-filter-toggle:hover {
    background-color: #e0f2fe;
    color: #0369a1;
}

.search-filters {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #e2e8f0;
}

.filter-agency-select {
    width: 100%;
    height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1e293b;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
}

.filter-agency-select:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Spinner Loader */
.bclem-hr-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: #64748b;
    font-size: 0.95rem;
}

.bclem-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #0284c7;
    border-radius: 50%;
    animation: bclem-spin 0.8s linear infinite;
}

@keyframes bclem-spin {
    to { transform: rotate(360deg); }
}

/* Results Table */
.honour-roll-results {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.honour-roll-results th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.honour-roll-results td {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.honour-roll-results tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.honour-roll-results tbody tr:hover {
    background-color: #f0fdf4;
    color: #15803d;
}

.honour-roll-results tbody tr:hover td.col-name strong {
    color: #0284c7;
}

.honour-roll-results tbody tr:last-child td {
    border-bottom: none;
}

.honour-roll-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
}

/* Single Officer Result View */
.honour-roll-result {
    display: flex;
    flex-direction: row-reverse;
    gap: 2rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-top: 1rem;
}

.honour-roll-result .right {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
}

.honour-roll-result .portrait img {
    width: 220px;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.honour-roll-result .crest img {
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
}

.honour-roll-result .bastion {
    text-align: center;
}

.honour-roll-result .bastion a {
    display: inline-block;
    text-decoration: none;
    color: #334155;
    transition: color 0.15s ease;
}

.honour-roll-result .bastion a:hover {
    color: #0284c7;
}

.honour-roll-result .bastion img {
    max-width: 220px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.honour-roll-result .bastion a:hover img {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bastion-label {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.honour-roll-result .left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bclem-officer-header {
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0.75rem;
}

.honour-roll-result .name {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.agency-badge {
    display: inline-block;
    background: #e2e8f0;
    color: #334155;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.honour-roll-result .details {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-left: 4px solid #0284c7;
    border-radius: 0 4px 4px 0;
}

.detail-item {
    font-size: 0.95rem;
}

.detail-label {
    font-weight: 600;
    color: #475569;
}

.detail-val {
    color: #0f172a;
}

.honour-roll-result .narrative {
    font-size: 1rem;
    line-height: 1.7;
    color: #334155;
    margin-top: 0.5rem;
}

.honour-roll-result .narrative p {
    margin-bottom: 1rem;
}

.bclem-back-row {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.bclem-back-to-search-btn {
    background: #f1f5f9;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bclem-back-to-search-btn:hover {
    background: #0f172a;
    color: #ffffff !important;
}

/* Lightbox Modal */
.bclem-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bclem-modal.hidden {
    display: none;
}

.bclem-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.bclem-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bclem-modal-close {
    position: absolute;
    top: -40px;
    right: -10px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.bclem-modal-body img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.bclem-lightbox-caption {
    color: #ffffff;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    text-align: center;
}

/* jQuery UI Autocomplete styling overrides */
.ui-autocomplete {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 99999 !important;
    padding: 4px 0;
    font-family: inherit;
}

.ui-autocomplete .ui-menu-item {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    color: #1e293b;
    cursor: pointer;
    list-style: none;
}

.ui-autocomplete .ui-menu-item:hover,
.ui-autocomplete .ui-state-active,
.ui-autocomplete .ui-state-focus {
    background: #0284c7 !important;
    color: #ffffff !important;
    border: none !important;
    margin: 0 !important;
}

/* Animations */
.animate-fade-in {
    animation: bclem-fade-in 0.25s ease-out;
}

@keyframes bclem-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.is-hidden,
.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .search-input-group {
        flex-direction: column;
    }
    .search-submit-btn {
        width: 100%;
    }
    .honour-roll-result {
        flex-direction: column-reverse;
        padding: 1.25rem;
    }
    .honour-roll-result .right {
        flex: 1 1 auto;
        width: 100%;
    }
    .honour-roll-results th,
    .honour-roll-results td {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }
}
