/* ==========================================================================
   Card Crow - Search Page Styles
   ========================================================================== */

/* Search Page Layout */
.search-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background-color: var(--bg-primary);
}

.card-browser-full {
    flex: 1;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.75rem 1rem;
}

/* Search Header */
.search-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.search-header-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
}

.search-header h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0;
    flex: 1;
}

.search-box input {
    flex: 1;
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.btn-help {
    padding: 0.5rem 0.75rem;
    font-weight: 700;
    min-width: 36px;
}

.btn-save-search {
    padding: 0.5rem 0.75rem;
    font-size: 1.1rem;
    min-width: 36px;
    line-height: 1;
}

.btn-save-search.saved {
    color: #22d3ee;
}

/* Search Status */
.search-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.25rem 0 0;
    min-height: 0;
}

.search-status:empty {
    display: none;
}

.search-status.error {
    color: var(--accent-danger);
}

.search-status.loading {
    color: var(--accent-warning);
}

/* Search Results Container */
.search-results-full {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 0 0.75rem 0.75rem;
}

/* Search Results Table */
.search-results-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.search-results-table th,
.search-results-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-results-table th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: 0 1px 0 var(--border-color);
}

.search-results-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.search-results-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.search-results-table .col-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-results-table .col-mana {
    white-space: nowrap;
    color: var(--accent-warning);
}

.search-results-table .col-type {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.search-results-table .col-pt {
    text-align: center;
    white-space: nowrap;
}

.search-results-table .col-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: normal;
    line-height: 1.4;
    word-break: break-word;
}

/* Column Resize Handles */
.col-resize {
    position: absolute;
    top: 0;
    right: -2px;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
}

.col-resize:hover,
.col-resize:active {
    background-color: var(--accent-secondary);
    opacity: 0.6;
}

/* Search Image Grid */
.search-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 280px);
    gap: 1rem;
    padding: 0;
    justify-content: center;
}

/* Card Status Highlighting - Table View */
.search-results-table tr.card-status-in-deck {
    background-color: rgba(74, 222, 128, 0.12);
    border-left: 3px solid var(--accent-success);
}

.search-results-table tr.card-status-proposed {
    background-color: rgba(124, 107, 245, 0.12);
    border-left: 3px solid var(--accent-secondary);
}

.search-results-table tr.card-status-maybe {
    background-color: rgba(245, 158, 11, 0.12);
    border-left: 3px solid var(--accent-warning);
}

.search-results-table tr.card-status-nope {
    background-color: rgba(100, 100, 120, 0.12);
    border-left: 3px solid var(--text-muted);
    opacity: 0.6;
}

/* Card Status Highlighting - Image View */
.search-card-image.card-status-in-deck {
    box-shadow: 0 0 0 3px var(--accent-success);
}

.search-card-image.card-status-proposed {
    box-shadow: 0 0 0 3px var(--accent-secondary);
}

.search-card-image.card-status-maybe {
    box-shadow: 0 0 0 3px var(--accent-warning);
}

.search-card-image.card-status-nope {
    box-shadow: 0 0 0 3px var(--text-muted);
    opacity: 0.5;
}

/* Search Card Images */
.search-card-image {
    position: relative;
    aspect-ratio: 63/88;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.search-card-image:hover {
    transform: scale(1.03);
    z-index: 1;
}

.search-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Search Card Wrapper (for DFC turn-over) */
.search-card-wrapper {
    display: flex;
    flex-direction: column;
}

.search-card-wrapper .turn-over-btn {
    margin-top: 0.35rem;
}

/* Pagination */
.search-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.search-pagination button {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Syntax Help Modal */
.syntax-help-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.syntax-section {
    background-color: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.syntax-section-full {
    grid-column: 1 / -1;
}

.syntax-section h4 {
    font-size: 0.85rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.syntax-section code {
    background-color: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--accent-warning);
}

.syntax-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.syntax-link a {
    color: var(--accent-primary);
    text-decoration: none;
}

.syntax-link a:hover {
    text-decoration: underline;
}

/* Bookmark Indicators - Table View */
.bookmark-icon {
    color: #22d3ee;
    margin-right: 0.35rem;
    font-size: 0.85em;
}

.search-results-table tr.bookmarked {
    background-color: rgba(34, 211, 238, 0.06);
}

/* If a card has both bookmark and deck status, deck status border wins,
   but the star icon still shows */
.search-results-table tr.bookmarked:not([class*="card-status-"]) {
    border-left: 3px solid #22d3ee;
}

/* Bookmark Badge - Image View */
.bookmark-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    color: #22d3ee;
    font-size: 1.3rem;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
    pointer-events: none;
}

/* Search Responsive */
@media (max-width: 900px) {
    .search-page {
        grid-template-columns: 1fr;
    }
}
