/**
 * Custom Search Writer - Frontend Styles
 * Modern, responsive styling for the search interface
 */

/* Reset and base styles */
.csw-search-container * {
    box-sizing: border-box;
}

/* Search Form Styles */
.csw-search-form-wrapper {
    margin-bottom: 2rem;
}

.csw-search-form {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.csw-search-form:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.csw-search-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.csw-search-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #ffffff;
}

.csw-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.csw-search-button {
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
    justify-content: center;
}

.csw-search-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.csw-search-button:active {
    transform: translateY(0);
}

.csw-search-button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.csw-loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.csw-search-options {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.csw-search-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.csw-search-options input[type="checkbox"] {
    margin: 0;
}

/* Status Messages */
.csw-search-status {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.csw-search-status.loading {
    background: #e7f3ff;
    color: #0073aa;
    border-left: 4px solid #0073aa;
}

.csw-search-status.error {
    background: #ffeaea;
    color: #d63638;
    border-left: 4px solid #d63638;
}

.csw-search-status.success {
    background: #eafaf1;
    color: #00a32a;
    border-left: 4px solid #00a32a;
}

/* Results Section */
.csw-results-section {
    margin-top: 2rem;
    padding-top: 2rem;
}

.csw-results-separator {
    margin-bottom: 2rem;
    text-align: center;
}

.csw-results-separator h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

.csw-separator-line {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #007cba 50%, transparent 100%);
    margin: 0 auto;
    width: 100px;
}

/* Results Header */
.csw-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.csw-results-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.csw-results-count {
    font-weight: 600;
    color: #333;
}

.csw-results-actions {
    display: flex;
    gap: 0.5rem;
}

.csw-export-button {
    padding: 0.5rem 1rem;
    background: #ffffff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.csw-export-button:hover {
    background: #f0f0f0;
    border-color: #999;
}

/* Cards View */
.csw-results-cards {
    display: grid;
    gap: 1.5rem;
}

.csw-result-card {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.csw-result-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.csw-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e1e5e9;
}

.csw-site-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.csw-site-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.csw-result-number {
    background: #007cba;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.csw-toggle-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.csw-toggle-content:hover {
    background: #f0f0f0;
}

.csw-toggle-icon {
    transition: transform 0.3s ease;
}

.csw-toggle-content.expanded .csw-toggle-icon {
    transform: rotate(180deg);
}

.csw-card-body {
    padding: 1.25rem;
}

.csw-result-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
    line-height: 1.4;
}

.csw-result-title a {
    color: #007cba;
    text-decoration: none;
    transition: color 0.3s ease;
}

.csw-result-title a:hover {
    color: #005a87;
    text-decoration: underline;
}

.csw-result-url {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    color: #666;
    word-break: break-all;
}

.csw-result-snippet {
    margin: 0 0 1rem 0;
    color: #555;
    line-height: 1.5;
}

.csw-content-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #888;
}

.csw-word-count {
    font-weight: 500;
}

.csw-extraction-method {
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.csw-card-content {
    border-top: 1px solid #e1e5e9;
    background: #fafbfc;
}

.csw-content-actions {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.csw-copy-content {
    padding: 0.5rem 1rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.csw-copy-content:hover {
    background: #218838;
}

.csw-full-content {
    padding: 1.25rem;
    line-height: 1.6;
    color: #333;
    /* Removed height restrictions for unlimited content display */
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* List View */
.csw-results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.csw-result-item {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.25rem;
    transition: box-shadow 0.3s ease;
}

.csw-result-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csw-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.csw-item-number {
    font-weight: 600;
    color: #007cba;
}

.csw-item-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.csw-item-title a {
    color: #007cba;
    text-decoration: none;
}

.csw-item-title a:hover {
    text-decoration: underline;
}

.csw-item-url {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    color: #666;
    word-break: break-all;
}

.csw-item-snippet {
    margin: 0 0 1rem 0;
    color: #555;
    line-height: 1.5;
}

.csw-item-content details {
    margin-top: 1rem;
}

.csw-item-content summary {
    cursor: pointer;
    font-weight: 500;
    color: #007cba;
    padding: 0.5rem 0;
}

.csw-item-content summary:hover {
    color: #005a87;
}

/* Error messages */
.csw-error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 4px;
    border-left: 4px solid #f44336;
    margin: 10px 0;
    font-weight: 500;
}

.csw-debug-info {
    background: #e3f2fd;
    color: #1565c0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin: 5px 0;
    font-family: monospace;
}

/* Table View */
.csw-results-table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
}

.csw-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.csw-results-table th,
.csw-results-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.csw-results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.csw-results-table tr:hover {
    background: #f8f9fa;
}

.csw-url-cell {
    max-width: 200px;
    word-break: break-all;
    font-size: 0.8rem;
}

.csw-view-content {
    padding: 0.375rem 0.75rem;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.csw-view-content:hover {
    background: #005a87;
}

.csw-table-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

/* No Results */
.csw-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .csw-search-input-group {
        flex-direction: column;
    }
    
    .csw-search-button {
        width: 100%;
    }
    
    .csw-results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .csw-results-actions {
        justify-content: center;
    }
    
    .csw-card-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .csw-site-info {
        justify-content: space-between;
    }
    
    .csw-table-content {
        max-width: 95vw;
        max-height: 90vh;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .csw-search-form {
        padding: 1rem;
    }
    
    .csw-card-body {
        padding: 1rem;
    }
    
    .csw-content-actions,
    .csw-full-content {
        padding: 1rem;
    }
}
