/* Terra Search Styles */

/* Button Styles */
.terra-search-wrapper {
    display: inline-block;
}

.terra-search-button {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: #ffffff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.terra-search-button:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.terra-search-button:active {
    background: #f3f4f6;
}

.terra-search-icon {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.5rem;
    color: #6b7280;
}

.terra-search-kbd {
    margin-left: 0.75rem;
    padding: 0.125rem 0.375rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-family: ui-monospace, monospace;
    color: #6b7280;
    font-weight: 500;
}

/* Modal Styles */
.terra-search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    overflow-y: auto;
}

.terra-search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.terra-search-modal-wrapper {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    padding-top: 5rem;
}

.terra-search-modal-content {
    position: relative;
    width: 100%;
    max-width: 42rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Input Styles */
.terra-search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 1.5rem 2rem;
    gap: 1rem;
    background: #ffffff;
}

.terra-search-input-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: #6b7280;
    flex-shrink: 0;
}

.terra-search-input {
    width: 100%;
    padding: 0;
    font-size: 1.125rem;
    font-weight: 400;
    color: #111827;
    border: none;
    outline: none;
    background: transparent;
}

.terra-search-input::placeholder {
    color: #9ca3af;
    font-weight: 300;
}

.terra-search-close {
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.terra-search-close:hover {
    color: #4b5563;
    background: #f3f4f6;
}

.terra-search-close-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Results Styles */
.terra-search-results {
    max-height: 60vh;
    overflow-y: auto;
}

.terra-search-state {
    padding: 3rem 2rem;
    text-align: center;
}

.terra-search-spinner {
    width: 2rem;
    height: 2rem;
    margin: 0 auto;
    color: #9ca3af;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.terra-search-state-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto;
    color: #d1d5db;
}

.terra-search-state-title {
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
}

.terra-search-state-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.terra-search-results-list {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.terra-search-item {
    display: block;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    transition: all 0.15s ease;
    text-decoration: none;
    border: 1px solid transparent;
}

.terra-search-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.terra-search-item-selected {
    background: #f0f9ff !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.terra-search-item-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.terra-search-item-text {
    flex: 1;
    min-width: 0;
}

.terra-search-item-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
    line-height: 1.4;
}

.terra-search-item-selected .terra-search-item-title {
    color: #1e40af;
}

.terra-search-item:hover .terra-search-item-title {
    color: #1e40af;
}

.terra-search-item-subtitle {
    font-size: 0.8125rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0.25rem 0 0 0;
    line-height: 1.4;
}

.terra-search-item-arrow {
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
    margin-left: 0.5rem;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.terra-search-item-selected .terra-search-item-arrow {
    color: #2563eb;
}

.terra-search-item:hover .terra-search-item-arrow {
    color: #4b5563;
}

/* Footer Styles */
.terra-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 0 0 1rem 1rem;
}

.terra-search-hints {
    display: flex;
    gap: 0.75rem;
}

.terra-search-hint {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: #6b7280;
    gap: 0.25rem;
}

.terra-search-kbd-small {
    padding: 0.125rem 0.375rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-family: monospace;
}

/* Body lock when modal is open */
body.terra-search-open {
    overflow: hidden;
}

/* Transitions */
.terra-search-modal {
    transition: opacity 0.2s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .terra-search-modal-wrapper {
        padding-top: 2rem;
    }
    
    .terra-search-button {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .terra-search-kbd {
        display: none;
    }
}
