/**
 * COA Global Search Styles
 *
 * @package COA_Archive
 * @since 1.1.0
 */

/* Wrapper */
.coa-global-search-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Title */
.coa-global-search-title {
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #333;
}

/* Search Form */
.coa-global-search-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.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: #555;
    font-size: 14px;
}

.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: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.coa-search-button-field {
    flex: 0 0 auto;
    min-width: auto;
}

.coa-search-button {
    padding: 12px 30px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.coa-search-button:hover {
    background: #005a87;
}

.coa-search-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Results */
.coa-global-search-results {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.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;
    }
}
