/**
 * Zeronebit Search Panel Styles
 * Modern, accessible, and responsive search interface
 */

/* === Search Panel Overlay === */
.zn-search-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.zn-search-panel.is-active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 1;
    pointer-events: auto;
}

.zn-search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1;
    opacity: 1;
    cursor: pointer;
}

/* === Search Container === */
.zn-search-container {
    position: relative;
    width: 90%;
    max-width: 680px;
    margin-top: 10vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: znSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

/* === Header === */
.zn-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.zn-search-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.zn-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zn-search-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.zn-search-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* === Search Input === */
.zn-search-input-wrapper {
    position: relative;
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.zn-search-icon {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.zn-search-input {
    width: 100%;
    padding: 14px 48px 14px 44px;
    font-size: 16px;
    font-weight: 400;
    color: #111827;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.zn-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.zn-search-input::placeholder {
    color: #9ca3af;
}

/* === Loader === */
.zn-search-loader {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.zn-search-loader.is-active {
    display: block;
}

.zn-loader-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: znSpin 0.6s linear infinite;
}

/* === Results Wrapper === */
.zn-search-results-wrapper {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.zn-search-results-wrapper::-webkit-scrollbar {
    width: 8px;
}

.zn-search-results-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.zn-search-results-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.zn-search-results-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* === Results === */
.zn-search-results {
    padding: 8px;
}

.zn-search-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: #9ca3af;
    text-align: center;
}

.zn-search-placeholder svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.zn-search-placeholder p {
    margin: 0;
    font-size: 15px;
}

.zn-search-no-results {
    padding: 40px 24px;
    text-align: center;
    color: #6b7280;
}

.zn-search-no-results p {
    margin: 8px 0 0;
    font-size: 14px;
}

/* === Result Items === */
.zn-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.zn-result-item:hover,
.zn-result-item.is-focused {
    background: #f3f4f6;
}

.zn-result-item.is-focused {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.zn-result-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border-radius: 8px;
    color: #3b82f6;
}

.zn-result-icon svg {
    width: 20px;
    height: 20px;
}

.zn-result-content {
    flex: 1;
    min-width: 0;
}

.zn-result-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zn-result-excerpt {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zn-result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.zn-result-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
}

.zn-result-date {
    font-size: 12px;
    color: #9ca3af;
}

/* === Result Items Enhanced === */
.zn-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.zn-result-thumbnail-wrapper {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
}

.zn-result-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zn-result-price {
    font-size: 13px;
    font-weight: 600;
    color: #10b981;
}

.zn-result-stock {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.zn-result-stock.out-of-stock {
    background: #fee2e2;
    color: #dc2626;
}

.zn-result-categories {
    font-size: 11px;
    color: #9ca3af;
}

mark {
    background-color: #fef3c7;
    color: #92400e;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

/* === Category Sections === */
.zn-result-category {
    padding: 12px 12px 8px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
}

.zn-result-category:first-child {
    margin-top: 0;
}

/* === Footer === */
.zn-search-footer {
    padding: 12px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.zn-search-shortcuts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.zn-shortcut-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.zn-shortcut-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* === Animations === */
@keyframes znFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes znSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes znSpin {
    to {
        transform: rotate(360deg);
    }
}

/* === ONLY Search Button Styles (No Header Conflicts) === */
.menu-item-search {
    list-style: none !important;
}

.menu-item-search a {
    display: none !important;
}

.zn-header-search-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    margin: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.zn-header-search-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.zn-header-search-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.zn-header-search-btn:active {
    transform: translateY(0);
}

.zn-header-search-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .zn-search-container {
        width: 95%;
        margin-top: 5vh;
        border-radius: 12px;
    }

    .zn-search-header {
        padding: 16px 20px;
    }

    .zn-search-title {
        font-size: 16px;
    }

    .zn-search-input-wrapper {
        padding: 12px 20px;
    }

    .zn-search-input {
        font-size: 15px;
        padding: 12px 42px 12px 40px;
    }

    .zn-search-icon {
        left: 32px;
    }

    .zn-search-loader {
        right: 32px;
    }

    .zn-search-results-wrapper {
        max-height: 50vh;
    }
    .zn-search-loader {
        right: 32px;
    }

    .zn-search-results-wrapper {
        max-height: 50vh;
    }

    .zn-search-shortcuts {
        gap: 12px;
    }

    .zn-shortcut-hint {
        font-size: 11px;
    }

    .zn-search-shortcut {
        display: none;
    }
    
    .zn-header-search-btn {
        padding: 8px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .zn-search-container {
        width: 100%;
        margin-top: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .zn-result-title {
        font-size: 14px;
    }

    .zn-result-excerpt {
        font-size: 12px;
    }
}

/* === Dark Mode Support === */
@media (prefers-color-scheme: dark) {
    .zn-search-panel {
        background: rgba(0, 0, 0, 0.78);
    }
    
    .zn-search-overlay {
        background: rgba(0, 0, 0, 0.82);
    }
    
    .zn-search-container {
        background: #1f2937;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    }

    .zn-search-header {
        border-bottom-color: #374151;
    }

    .zn-search-title {
        color: #f9fafb;
    }

    .zn-search-close:hover {
        background: #374151;
        color: #f9fafb;
    }

    .zn-search-input-wrapper {
        background: #111827;
        border-bottom-color: #374151;
    }

    .zn-search-input {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }

    .zn-search-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
    }

    .zn-result-item:hover,
    .zn-result-item.is-focused {
        background: #374151;
    }

    .zn-result-title {
        color: #f9fafb;
    }

    .zn-result-excerpt,
    .zn-result-date {
        color: #9ca3af;
    }

    .zn-search-footer {
        background: #111827;
        border-top-color: #374151;
    }

    .zn-shortcut-hint kbd {
        background: #1f2937;
        border-color: #4b5563;
    }
}

/* === Print Styles === */
@media print {
    .zn-search-panel {
        display: none !important;
    }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .zn-search-panel,
    .zn-search-container,
    .zn-search-close,
    .zn-search-input,
    .zn-result-item {
        animation: none !important;
        transition: none !important;
    }
}

/* === Header Styles === */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.site-branding .site-logo {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
}

.main-navigation {
    flex: 1;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li a {
    color: #6b7280;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-menu li a:hover {
    color: #111827;
}

/* Header Actions (Search Button) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zn-header-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zn-header-search-btn:hover {
    background: #ffffff;
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.zn-header-search-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.zn-header-search-btn:active {
    transform: translateY(0);
}

.zn-header-search-btn svg {
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-container {
        padding: 0 16px;
        gap: 16px;
    }

    .nav-menu {
        gap: 20px;
    }

    .nav-menu li a {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .site-branding .site-logo {
        font-size: 20px;
    }

    .nav-menu {
        gap: 16px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .site-header {
        background: #1f2937;
        border-bottom-color: #374151;
    }

    .site-branding .site-logo {
        color: #f9fafb;
    }

    .nav-menu li a {
        color: #9ca3af;
    }

    .nav-menu li a:hover {
        color: #f9fafb;
    }

    .zn-header-search-btn {
        background: #1f2937;
        border-color: #374151;
        color: #9ca3af;
    }

    .zn-header-search-btn:hover {
        background: #374151;
        border-color: #60a5fa;
        color: #60a5fa;
    }
}

/* === Section Results Styles === */
.zn-result-parent {
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
}

.zn-result-parent::before {
    content: "📄 ";
}

.zn-result-heading-level {
    font-size: 10px;
    padding: 2px 6px;
    background: #e0e7ff;
    color: #4f46e5;
    border-radius: 3px;
    font-weight: 600;
}

.zn-result-item[data-result-id*="section"] .zn-result-icon {
    background: #fef3c7;
    color: #92400e;
}

.zn-result-item[data-result-id*="card"] .zn-result-icon {
    background: #dbeafe;
    color: #2563eb;
}

.zn-result-item[data-result-id*="tier"] .zn-result-icon {
    background: #fef3c7;
    color: #d97706;
}

.zn-result-item[data-result-id*="modal"] .zn-result-icon {
    background: #e0e7ff;
    color: #6366f1;
}

.zn-result-item[data-result-id*="lens"] .zn-result-icon {
    background: #d1fae5;
    color: #059669;
}

.zn-result-tier-level {
    font-size: 10px;
    padding: 2px 6px;
    background: #fef3c7;
    color: #d97706;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Enhanced result badges */
.zn-result-brand {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 3px;
}

.zn-result-tier {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
}

.zn-result-tier:contains("Budget") {
    background: #dcfce7;
    color: #166534;
}

.zn-result-tier:contains("Mid-Range") {
    background: #dbeafe;
    color: #1e40af;
}

.zn-result-tier:contains("Premium") {
    background: #fef3c7;
    color: #92400e;
}

.zn-result-tier:contains("Elite") {
    background: #fce7f3;
    color: #9f1239;
}

/* Camera card specific styling */
.zn-result-camera-card .zn-result-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.zn-result-camera-card:hover .zn-result-icon {
    transform: scale(1.1);
}

/* Section result styling */
.zn-result-section .zn-result-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
}

.zn-result-section:hover .zn-result-icon {
    transform: scale(1.1) rotate(5deg);
}

.zn-result-section .zn-result-excerpt {
    font-size: 12px;
    line-height: 1.6;
}

/* Section badge in results */
.zn-result-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    margin-right: 8px;
}

.zn-result-badge:contains("PREMIUM"),
.zn-result-badge:contains("ELITE") {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.zn-result-badge:contains("MID-RANGE") {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
}

.zn-result-badge:contains("BUDGET") {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}

/* Why Choose result styling */
.zn-result-why-choose .zn-result-icon {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
}

.zn-result-why-choose:hover .zn-result-icon {
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(67, 233, 123, 0.3);
}

.zn-result-why-choose .zn-result-title::before {
    content: "❓ ";
    opacity: 0.7;
}

.zn-result-why-choose .zn-result-excerpt {
    font-size: 13px;
    line-height: 1.5;
    color: #059669;
}
