/**
 * 詢價搜尋頁面樣式
 * 色彩主題：深藍色 #004884, 淡藍色 #6CB4EE, 淺灰色 #F2F2F2
 */

:root {
    --quotation-primary: #004884;
    --quotation-secondary: #6CB4EE;
    --quotation-bg-gray: #F2F2F2;
    --quotation-white: #FFFFFF;
    --quotation-text: #333333;
}

/* 頁面容器 */
.quotation-search-page {
    background-color: var(--quotation-bg-gray);
    padding: 40px 20px;
    min-height: 60vh;
}

/* ===== 搜尋列樣式 ===== */
.quotation-search-bar {
    max-width: 1200px;
    margin: 0 auto 40px;
    background: var(--quotation-white);
    padding: 35px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

/* 預設欄位：一列兩欄 */
.search-field {
    flex: 0 1 calc(50% - 10px);
    min-width: 0;
}

/* 型號搜尋：一列一欄 */
.search-field-input {
    flex: 0 1 100%;
}

/* 價格區間：隱藏（暫時不使用）*/
.search-field-price {
    display: none;
}

/* Select 元件樣式 */
.search-field {
    position: relative;
}

.quotation-select {
    width: 100%;
    height: 50px;
    background: #FFFFFF;
    border: 2px solid #004884;
    border-radius: 8px;
    padding: 0 50px 0 18px;
    font-size: 16px;
    color: var(--quotation-text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* 右側深藍色背景 */
    background: linear-gradient(to left, #004884 40px, #FFFFFF 40px);
}

/* 下拉箭頭容器 - 添加類別以便精確控制 */
.search-field-select {
    position: relative;
}

.search-field-select::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #FFFFFF;
    pointer-events: none;
    z-index: 1;
}

.quotation-select:focus {
    outline: none;
    border-color: #6CB4EE;
    box-shadow: 0 0 0 3px rgba(108, 180, 238, 0.2);
}

/* 禁用的選項樣式（大分類） */
.quotation-select option:disabled {
    color: #999;
    font-weight: bold;
}

/* 輸入框樣式 */
.quotation-input {
    width: 100%;
    height: 50px;
    background: var(--quotation-white);
    border: 2px solid var(--quotation-primary);
    border-radius: 8px;
    padding: 0 18px;
    font-size: 16px;
    color: var(--quotation-text);
}

.quotation-input:focus {
    outline: none;
    border-color: var(--quotation-secondary);
    box-shadow: 0 0 0 3px rgba(108, 180, 238, 0.2);
}

.quotation-input::placeholder {
    color: #999;
}

/* 價格區間欄位 */
.search-field-price {
    flex: 0 1 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quotation-input-small {
    flex: 1;
    min-width: 0;
}

.price-separator {
    color: var(--quotation-text);
    font-weight: bold;
    flex-shrink: 0;
}

/* 按鈕容器 */
.search-buttons {
    flex: 0 1 100%;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    align-items: center;
}

/* 查詢按鈕 */
.quotation-search-btn,
button.quotation-search-btn {
    height: 50px !important;
    padding: 0 30px !important;
    background: var(--quotation-primary) !important;
    background-color: #004884 !important;
    color: var(--quotation-white) !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
}

.quotation-search-btn:hover,
button.quotation-search-btn:hover {
    background: var(--quotation-secondary) !important;
    background-color: #6CB4EE !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 72, 132, 0.3) !important;
}

.quotation-search-btn:active,
button.quotation-search-btn:active {
    transform: translateY(0) !important;
}

/* 清除按鈕 */
.quotation-clear-btn {
    height: 50px;
    padding: 0 30px;
    background: #FFFFFF;
    color: var(--quotation-primary);
    border: 2px solid var(--quotation-primary);
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}

.quotation-clear-btn:hover {
    background: var(--quotation-primary);
    color: var(--quotation-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 72, 132, 0.3);
}

.quotation-clear-btn:active {
    transform: translateY(0);
}

.search-icon,
.clear-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ===== 流程步驟樣式 ===== */
.quotation-process-steps {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--quotation-white);
    padding: 40px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.steps-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.process-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.step-number {
    width: 80px;
    height: 80px;
    background: var(--quotation-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0, 72, 132, 0.3);
}

.step-number span {
    color: var(--quotation-white);
    font-size: 32px;
    font-weight: bold;
}

.step-content h3 {
    font-size: 18px;
    color: var(--quotation-primary);
    margin: 0 0 5px 0;
    font-weight: bold;
}

.step-content p {
    font-size: 14px;
    color: var(--quotation-text);
    margin: 0;
}

.step-arrow {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

/* ===== 浮動購物車圖示 ===== */
.floating-cart {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cart-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: var(--quotation-primary);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 72, 132, 0.4);
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
}

.cart-icon-link:hover {
    background: var(--quotation-secondary);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 72, 132, 0.5);
}

.cart-icon-link svg {
    stroke: var(--quotation-white);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #E74C3C;
    color: var(--quotation-white);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 3px solid var(--quotation-white);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cart-text {
    margin-top: 10px;
    background: var(--quotation-white);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    color: var(--quotation-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.cart-text #cart-count-text {
    color: #E74C3C;
    margin: 0 2px;
}

/* 購物車始終顯示，即使為空 */

/* ===== 響應式設計 ===== */
/* 新增 1200px 斷點：漸進式調整 */
@media screen and (max-width: 1200px) {
    .quotation-search-bar {
        padding: 30px;
    }

    .search-fields {
        gap: 18px;
    }

    /* 保持 2 欄佈局 */
    .search-field {
        flex: 0 1 calc(50% - 9px);
    }

    /* 型號搜尋維持 100% */
    .search-field-input {
        flex: 0 1 100%;
    }
}

@media screen and (max-width: 992px) {
    .quotation-search-bar {
        padding: 25px;
    }

    .search-fields {
        gap: 15px;
    }

    /* 保持 2 欄佈局 */
    .search-field {
        flex: 0 1 calc(50% - 7.5px);
        max-width: calc(50% - 7.5px);
    }

    /* 型號搜尋維持 100% */
    .search-field-input {
        flex: 0 1 100%;
        max-width: 100%;
    }
}

@media screen and (max-width: 768px) {
    .quotation-search-page {
        padding: 20px 10px;
    }

    .quotation-search-bar,
    .quotation-process-steps {
        padding: 20px 15px;
    }

    /* 搜尋列垂直堆疊 */
    .search-fields {
        flex-direction: column;
        gap: 15px;
    }
}

/* ===== 型號自動建議樣式 ===== */
.model-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--quotation-white);
    border: 2px solid var(--quotation-primary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 72, 132, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 建議清單 */
.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 建議項目 */
.suggestion-item {
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #E8E8E8;
    font-size: 15px;
    color: var(--quotation-text);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: var(--quotation-secondary);
    color: var(--quotation-white);
}

/* 匹配文字高亮 */
.suggestion-item .match-highlight {
    font-weight: 600;
    color: var(--quotation-primary);
}

.suggestion-item:hover .match-highlight,
.suggestion-item.selected .match-highlight {
    color: var(--quotation-white);
}

/* 載入中 */
.suggestions-loading {
    padding: 16px 18px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* 無結果 */
.no-suggestions {
    padding: 16px 18px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* 錯誤訊息 */
.suggestions-error {
    padding: 16px 18px;
    text-align: center;
    color: #d9534f;
    font-size: 14px;
}

/* 搜尋欄位需要設置為 relative 定位 */
.search-field-input {
    position: relative;
}

/* 型號輸入框獲得焦點時的樣式 */
#search-keyword:focus {
    outline: none;
    border-color: var(--quotation-secondary);
    box-shadow: 0 0 0 3px rgba(108, 180, 238, 0.2);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .model-suggestions {
        max-height: 300px;
        font-size: 14px;
    }

    .suggestion-item {
        padding: 10px 15px;
        font-size: 14px;
    }

    .suggestions-loading,
    .no-suggestions,
    .suggestions-error {
        padding: 14px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .model-suggestions {
        max-height: 250px;
        border-radius: 6px;
    }

    .suggestion-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    .suggestions-loading,
    .no-suggestions,
    .suggestions-error {
        padding: 12px;
        font-size: 12px;
    }

    .search-field {
        flex: 1 0 auto;
        width: 100%;
        max-width: 100%;
    }

    /* 按鈕容器在手機上垂直排列、置中 */
    .search-buttons {
        flex-direction: column;
        width: 100%;
        justify-content: center;
        align-items: stretch;
    }

    .quotation-search-btn,
    button.quotation-search-btn,
    .quotation-clear-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* 流程步驟 2x2 排列 */
    .steps-container {
        flex-wrap: wrap;
        gap: 30px;
    }

    .process-step {
        flex: 0 0 calc(50% - 15px);
    }

    .step-arrow {
        display: none;
    }

    .step-number {
        width: 60px;
        height: 60px;
    }

    .step-number span {
        font-size: 24px;
    }

    .step-content h3 {
        font-size: 16px;
    }

    .step-content p {
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    /* 流程步驟垂直排列 */
    .steps-container {
        flex-direction: column;
    }

    .process-step {
        flex: 1 0 auto;
        width: 100%;
    }
}
