/**
 * COA Global Search Styles
 *
 * @package COA_Archive
 * @since 1.1.0
 */

/* Wrapper */
.coa-global-search-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* Title */
.coa-global-search-title {
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #333;
}

/* Search Form */
.coa-global-search-form {
    background: #fbfaf7;
    padding: clamp(20px, 3vw, 36px);
    border: 1px solid #d9dde4;
    border-radius: 18px;
    margin-bottom: 24px;
    box-shadow: 0 18px 50px rgba(7, 22, 45, 0.08);
}

.coa-search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.coa-search-field {
    flex: 1;
    min-width: 200px;
}

.coa-search-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #07162d;
    font-size: 13px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.coa-search-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.coa-search-input:focus {
    outline: none;
    border-color: #f26a21;
    box-shadow: 0 0 0 3px rgba(242, 106, 33, 0.14);
}

.coa-search-button-field {
    flex: 0 0 auto;
    min-width: auto;
}

.coa-search-button {
    padding: 12px 30px;
    background: #f26a21;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s;
}

.coa-search-button:hover {
    background: #d95514;
}

.coa-search-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Results */
.coa-global-search-results {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 18px;
    overflow: hidden;
}

.coa-results-table th {
    color: #07162d;
    letter-spacing: .05em;
    text-transform: uppercase;
    font-size: 12px;
}

@media (max-width: 700px) {
    .coa-search-fields { display: grid; grid-template-columns: 1fr; }
    .coa-search-field { min-width: 0; }
    .coa-search-button { width: 100%; min-height: 48px; }
    .coa-results-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Public library page */
.sls-coa-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(28px, 6vw, 72px) 20px 80px;
    color: #07162d;
}

.sls-coa-hero {
    padding: clamp(28px, 5vw, 64px);
    margin-bottom: 28px;
    border-radius: 24px;
    color: #fff;
    background: radial-gradient(circle at 86% 12%, rgba(242,106,33,.32), transparent 32%), #07162d;
}

.sls-coa-eyebrow {
    margin: 0 0 12px;
    color: #ff8a4a;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.sls-coa-hero h1 {
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(38px, 6vw, 72px);
    line-height: .98;
    letter-spacing: -.05em;
}

.sls-coa-hero p:last-child {
    max-width: 720px;
    margin: 0;
    color: rgba(255,255,255,.76);
    font-size: clamp(16px, 2vw, 20px);
}

.sls-coa-browse-heading {
    margin: 48px 0 16px;
}

.sls-coa-browse-heading h2 { margin-bottom: 8px; }
.sls-coa-browse-heading p { margin: 0; color: #657084; }

.coa-all-coas-wrapper {
    color: #07162d;
}

.coa-all-coas-form {
    padding: 20px;
    border: 1px solid #d9dde4;
    border-radius: 16px;
    background: #fff;
}

.coa-all-coas-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin: 0;
}

.coa-all-coas-filters label span {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.coa-all-coas-filters input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ccd2dc;
    border-radius: 8px;
}

.coa-all-coas-filters .button {
    min-height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #f26a21;
    font-weight: 800;
}

.coa-all-coas-count { color: #657084; font-size: 14px; }
.coa-all-coas-table { width: 100%; border-collapse: collapse; background: #fff; }
.coa-all-coas-table th,
.coa-all-coas-table td { padding: 14px 12px; border-bottom: 1px solid #e3e6eb; text-align: left; }
.coa-all-coas-table th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.coa-all-coas-table a { color: #c94f0d; font-weight: 800; }
.coa-all-coas-pagination { display: flex; gap: 8px; margin-top: 24px; }
.coa-all-coas-pagination .page-numbers { padding: 8px 12px; border: 1px solid #d9dde4; border-radius: 8px; }
.coa-all-coas-pagination .current { color: #fff; border-color: #07162d; background: #07162d; }

@media (max-width: 900px) {
    .coa-all-coas-filters { grid-template-columns: 1fr 1fr; }
    .coa-all-coas-table { min-width: 700px; }
    .coa-all-coas-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 600px) {
    .sls-coa-page { padding-inline: 14px; }
    .sls-coa-hero { border-radius: 18px; }
    .coa-all-coas-filters { grid-template-columns: 1fr; }
}

.coa-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.coa-results-count {
    font-weight: 500;
    color: #333;
}

.coa-clear-results {
    padding: 5px 15px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.coa-clear-results:hover {
    background: #f0f0f0;
}

/* Results Table */
.coa-results-table-wrapper {
    overflow-x: auto;
}

.coa-results-table {
    width: 100%;
    border-collapse: collapse;
}

.coa-results-table th,
.coa-results-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.coa-results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coa-results-table tbody tr:hover {
    background: #f8f9fa;
}

.coa-results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Purity Badge */
.coa-purity-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}

.coa-purity-high {
    background: #d4edda;
    color: #155724;
}

.coa-purity-medium {
    background: #fff3cd;
    color: #856404;
}

.coa-purity-low {
    background: #f8d7da;
    color: #721c24;
}

/* View Button */
.coa-view-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.coa-view-pdf-btn:hover {
    background: #005a87;
    color: #fff;
}

.coa-view-pdf-btn svg {
    width: 14px;
    height: 14px;
}

/* Loading State */
.coa-global-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #666;
}

.coa-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: coa-spin 0.8s linear infinite;
}

@keyframes coa-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Message */
.coa-global-search-message {
    padding: 20px;
    text-align: center;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
}

.coa-global-search-message.coa-error {
    background: #f8d7da;
    color: #721c24;
}

/* Modal */
.coa-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coa-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.coa-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.coa-modal-large {
    max-width: 90%;
    width: 90%;
    height: 90vh;
}

.coa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.coa-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.coa-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coa-modal-close:hover {
    color: #000;
}

.coa-modal-body {
    padding: 0;
    height: calc(100% - 60px);
}

#coa-global-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .coa-global-search-wrapper {
        padding: 15px;
    }

    .coa-search-fields {
        flex-direction: column;
    }

    .coa-search-field {
        width: 100%;
        min-width: auto;
    }

    .coa-search-button-field {
        width: 100%;
    }

    .coa-search-button {
        width: 100%;
    }

    .coa-results-table th:nth-child(4),
    .coa-results-table td:nth-child(4) {
        display: none;
    }

    .coa-modal-large {
        width: 95%;
        height: 95vh;
    }
}
