/**
 * Hero Search - Frontend Styles
 * 
 * NextGenTel-style hero search section with modern, responsive design.
 * 
 * @package Devora_KB_Hub
 * @since 1.0.0
 */

/* ===================================================================
   Accessibility - Screen Reader Only Elements
   =================================================================== */

/* Visually hidden label and hint (accessible to screen readers) */
.kb-hero-search__label,
.kb-hero-search__hint.screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border-width: 0 !important;
}

/* ===================================================================
   Hero Search Container
   =================================================================== */

/* Hero Search Container */
.kb-hero-search {
    padding: 80px 20px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 40px;
    position: relative;
    /* Allow suggestions dropdown to escape container bounds */
    overflow: visible;
}

.kb-hero-search__container {
    max-width: var(--dkh-kb-width, 1200px);
    margin: 0 auto;
}

.kb-hero-search__content {
    max-width: var(--dkh-kb-width, 1200px);
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Typography */
.kb-hero-search__title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    margin: 0 0 20px;
    line-height: 1.2;
    color: inherit !important; /* Inherit from parent .kb-hero-search */
}

.kb-hero-search__subtitle {
    font-size: clamp(16px, 2.5vw, 20px);
    margin: 0 0 40px;
    opacity: 0.95;
    font-weight: 400;
    line-height: 1.5;
    color: inherit !important; /* Inherit from parent .kb-hero-search */
}

/* Search Form */
.kb-hero-search__form {
    position: relative;
}

.kb-hero-search__input-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.kb-hero-search__input {
    width: 100%;
    padding: 18px 60px 18px 24px;
    font-size: 16px;
    border: 1px solid var(--dkh-search-input-border, var(--kb-hero-search-input-border, #e0e0e0));
    border-radius: 50px;
    background-color: var(--dkh-search-input-bg, var(--kb-hero-search-input-bg, #ffffff)) !important;
    color: var(--dkh-search-input-text, var(--kb-hero-search-input-color, #333333)) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    font-family: inherit;
}

/* Ensure placeholder color respects text color */
.kb-hero-search__input::placeholder {
    color: rgba(var(--kb-hero-search-input-color-rgb, 51, 51, 51), 0.6) !important;
    opacity: 0.6;
}

.kb-hero-search__input:focus {
    outline: none;
    border-color: var(--dkh-search-input-focus, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 6px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.kb-hero-search__button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.kb-hero-search__button:hover,
.kb-hero-search__button:focus {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.kb-hero-search__button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.kb-hero-search__button:focus:not(:focus-visible) {
    outline: none;
}

.kb-hero-search__button:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.kb-hero-search__icon {
    display: block;
}

/* Search Suggestions Dropdown */
.kb-hero-search__suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    margin-top: 6px;
    /* Height will be set dynamically by JavaScript */
    max-height: min(85vh, 700px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: none;
    padding: 8px 0;
}

/* Override dynamic height when explicitly set */
.kb-hero-search__suggestions[style*="max-height"] {
    max-height: inherit !important;
}

.kb-hero-search__suggestions[style*="overflow-y: visible"] {
    overflow-y: visible !important;
}

.kb-hero-search__suggestions[aria-hidden="false"] {
    display: block;
}

.kb-hero-search__suggestion-item {
    display: block;
    padding: 12px 20px;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    text-decoration: none;
    color: inherit;
    white-space: normal;
}

.kb-hero-search__suggestion-item:last-child {
    border-bottom: none;
}

.kb-hero-search__suggestion-item:hover,
.kb-hero-search__suggestion-item:focus,
.kb-hero-search__suggestion-item.kb-suggestion--selected {
    background: #F5F7FA;
    outline: none;
}

.kb-hero-search__suggestion-item:focus {
    box-shadow: inset 0 0 0 2px #0073aa;
}

.kb-hero-search__suggestion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.kb-hero-search__suggestion-title {
    flex: 1;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.kb-suggestion-type {
    flex-shrink: 0;
    padding: 2px 8px;
    background: #e7f5ff;
    color: #0073aa;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.kb-hero-search__suggestion-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    margin-top: 4px;
}

.kb-hero-search__show-all {
    padding: 12px 20px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
    background: #fff;
}

.kb-hero-search__show-all-link {
    color: #0073aa;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
}

.kb-hero-search__show-all-link:hover,
.kb-hero-search__show-all-link:focus {
    color: #005a87;
    text-decoration: underline;
    outline: none;
}

/* Loading and Error States */
.kb-hero-search__loading,
.kb-hero-search__error,
.kb-hero-search__no-results {
    padding: 12px 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.kb-hero-search__error {
    color: #dc3545;
}

.kb-hero-search__no-results {
    color: #6c757d;
}

/* Style Presets */

/* Teal Style - Professional Teal Gradient */
.kb-hero-search--teal {
    background: linear-gradient(135deg, #0a4f5f 0%, #1a6f7a 100%);
}

/* Modern Style - Purple Gradient */
.kb-hero-search--modern {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Minimal Style - Light Background */
.kb-hero-search--minimal {
    background: #f8f9fa;
}

.kb-hero-search--minimal .kb-hero-search__title,
.kb-hero-search--minimal .kb-hero-search__subtitle {
    color: #333;
}

/* Corporate Style - Dark Gray */
.kb-hero-search--corporate {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* Ocean Style - Blue Gradient */
.kb-hero-search--ocean {
    background: linear-gradient(135deg, #0077be 0%, #00a8e8 100%);
}

/* Forest Style - Green Gradient */
.kb-hero-search--forest {
    background: linear-gradient(135deg, #2d6a4f 0%, #40916c 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .kb-hero-search {
        padding: 60px 20px;
        border-radius: 0;
    }
    
    .kb-hero-search__title {
        margin-bottom: 16px;
    }
    
    .kb-hero-search__subtitle {
        margin-bottom: 30px;
    }
    
    .kb-hero-search__input {
        padding: 16px 50px 16px 20px;
        font-size: 15px;
    }
    
    .kb-hero-search__suggestions {
        max-height: 50vh; /* Smaller on mobile */
        border-radius: 8px;
    }
    
    .kb-hero-search__suggestion-item {
        padding: 10px 16px; /* Slightly less padding on mobile */
    }
}

@media (max-width: 480px) {
    .kb-hero-search {
        padding: 40px 16px;
    }
    
    .kb-hero-search__input {
        border-radius: 12px;
    }
    
    .kb-hero-search__suggestions {
        max-height: 40vh; /* Even smaller on very small screens */
        margin-top: 4px;
    }
}

/* Accessibility */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
}

@media (prefers-reduced-motion: reduce) {
    .kb-hero-search__input,
    .kb-hero-search__button,
    .kb-hero-search__suggestion-item {
        transition: none;
    }
}

