/**
 * Lampira AI - Search Component
 * Search box, controls, model selector, and attachments
 */

/* ============ Search Box ============ */
.search-container {
    width: 100%;
    max-width: 560px;
}

.search-box {
    background-color: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: #a8a29e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-box.loading {
    opacity: 0.7;
    pointer-events: none;
}

.search-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    color: #111111;
    background: transparent;
    font-family: inherit;
    resize: none;
}

.search-input::placeholder {
    color: #a8a29e;
}

.search-input:disabled {
    cursor: not-allowed;
}

.search-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
}

.search-left-controls,
.search-right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ Control Buttons ============ */
.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: none;
    border: 1px solid #e7e5e4;
    cursor: pointer;
    font-size: 13px;
    color: #57534e;
    font-family: inherit;
    transition: background-color 0.15s ease;
}

.control-btn:hover {
    background-color: #f5f5f4;
}

.control-btn svg {
    width: 16px;
    height: 16px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: none;
    border: 1px solid #e7e5e4;
    cursor: pointer;
    color: #57534e;
    transition: background-color 0.15s ease;
}

.icon-btn:hover {
    background-color: #f5f5f4;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Web Search Toggle Button */
.web-search-btn.active {
    background-color: #1c1917;
    border-color: #1c1917;
    color: #ffffff;
}

.web-search-btn.active:hover {
    background-color: #292524;
    border-color: #292524;
}

.voice-btn {
    background-color: #8b7355;
    border: none;
    color: #ffffff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
}

.voice-btn:hover {
    background-color: #78624a;
}

.voice-btn.recording {
    background-color: #dc2626;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ============ Stop Generation Button ============ */
.stop-btn {
    background-color: #dc2626;
    border: none;
    color: #ffffff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.stop-btn:hover {
    background-color: #b91c1c;
    transform: scale(1.05);
}

.stop-btn svg {
    width: 16px;
    height: 16px;
}

/* Send/Stop Toggle Button */
.send-stop-btn {
    background-color: #8b7355;
    border: none;
    color: #ffffff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-stop-btn:hover {
    background-color: #78624a;
    transform: scale(1.05);
}

.send-stop-btn.stop-mode {
    background-color: #dc2626;
}

.send-stop-btn.stop-mode:hover {
    background-color: #b91c1c;
}

.send-stop-btn svg {
    width: 16px;
    height: 16px;
}

/* ============ Model Selector ============ */
.model-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: none;
    border: 1px solid #e7e5e4;
    cursor: pointer;
    font-size: 13px;
    color: #57534e;
    font-family: inherit;
    transition: background-color 0.15s ease;
    position: relative;
}

.model-selector:hover,
.model-selector.active {
    background-color: #f5f5f4;
}

.model-selector svg {
    width: 14px;
    height: 14px;
}

/* ============ Model Dropdown ============ */
.model-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
}

.model-dropdown-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #78716c;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f5f5f4;
    border-bottom: 1px solid #e7e5e4;
}

.model-dropdown-header:not(:first-child) {
    border-top: 1px solid #e7e5e4;
}

.model-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-dropdown-item:hover {
    background-color: #f5f5f4;
}

.model-dropdown-item.active {
    background-color: #e7e5e4;
}

.model-dropdown-item .model-name {
    font-size: 13px;
    color: #111111;
}

.model-dropdown-item .model-desc {
    font-size: 11px;
    color: #78716c;
}

/* ============ Attachment Preview ============ */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e7e5e4;
}

.attachment-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e7e5e4;
    background: #f5f5f4;
}

.attachment-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.attachment-item:hover .attachment-remove {
    opacity: 1;
}

.attachment-remove svg {
    width: 12px;
    height: 12px;
}

.attachment-remove:hover {
    background: rgba(220, 38, 38, 0.8);
}

/* PDF Attachment Styles */
.attachment-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
}

.attachment-pdf .pdf-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-pdf .pdf-icon svg {
    width: 32px;
    height: 32px;
    color: #dc2626;
}

.attachment-pdf .pdf-name {
    font-size: 10px;
    color: #57534e;
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============ Search Responsive ============ */
@media (max-width: 768px) {

    /* Search box adjustments */
    .search-box {
        padding: 12px 16px;
    }

    .search-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-left-controls {
        flex-wrap: wrap;
    }

    .model-selector .model-name-text {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .search-input {
        font-size: 14px;
    }
}