/**
 * 大都會篩選系統樣式表
 *
 * 嚴格按照 Figma 設計稿實作
 * - 桌機版: 924px × 116px
 * - 手機版: 393px × 310px
 *
 * @package RsCitySearch
 * @since 1.0.0
 */

/* ==========================================================================
   主容器樣式
   ========================================================================== */

.rscitysearch-container {
    width: 924px;
    height: 116px;
    background: #FFFFFF;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 8px 32px;
    box-sizing: border-box;
    margin: 0 auto;
    position: relative;
    font-family: 'Noto Sans CJK TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rscitysearch-form {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

/* ==========================================================================
   欄位容器樣式
   ========================================================================== */

.rscitysearch-field {
    width: 215px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.rscitysearch-field-continent {
    order: 1;
}

.rscitysearch-field-country {
    order: 2;
}

.rscitysearch-field-category {
    order: 3;
}

.rscitysearch-button-wrapper {
    width: 215px;
    height: 100px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    order: 4;
}

/* ==========================================================================
   標籤樣式
   ========================================================================== */

.rscitysearch-label {
    font-family: 'Noto Sans CJK TC', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 22.4px;
    color: #A1A1A1;
    margin-bottom: 4px;
    padding: 0 15px;
    display: block;
}

/* ==========================================================================
   下拉選單樣式
   ========================================================================== */

.rscitysearch-select {
    width: 185px;
    height: 34px;
    background: #F3F3F3;
    border: none;
    border-radius: 4px;
    padding: 0 40px 0 15px;
    font-family: 'Noto Sans CJK TC', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 22.4px;
    color: #333333;
    margin: 0 15px;
    box-sizing: border-box;
    cursor: pointer;
    outline: none;

    /* 移除預設箭頭 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* 自訂箭頭 */
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSI2IiB2aWV3Qm94PSIwIDAgMTMgNiIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTYuNSA2TDAuODcwODM1IC0xLjA2NjkxZS0wN0wxMi4xMjkyIDguNzc1NDRlLTA3TDYuNSA2WiIgZmlsbD0iIzMzMzMzMyIvPjwvc3ZnPgo=');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 13px 6px;
}

.rscitysearch-select:hover {
    background-color: #EEEEEE;
}

.rscitysearch-select:focus {
    background-color: #E8E8E8;
    box-shadow: 0 0 0 2px rgba(242, 147, 69, 0.2);
}

.rscitysearch-select:disabled {
    background-color: #F8F8F8;
    color: #CCCCCC;
    cursor: not-allowed;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSI2IiB2aWV3Qm94PSIwIDAgMTMgNiIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTYuNSA2TDAuODcwODM1IC0xLjA2NjkxZS0wN0wxMi4xMjkyIDguNzc1NDRlLTA3TDYuNSA2WiIgZmlsbD0iI0NDQ0NDQyIvPjwvc3ZnPgo=');
    background-size: 13px 6px;
}

/* ==========================================================================
   搜尋按鈕樣式
   ========================================================================== */

.rscitysearch-submit {
    width: 185px;
    height: 38px;
    background: #F29345;
    border: none;
    border-radius: 4px;
    color: #FFFFFF;
    font-family: 'Noto Sans CJK TC', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 22.4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s ease-in-out;
    outline: none;
}

.rscitysearch-submit:hover:not(:disabled) {
    background: #E08635;
}

.rscitysearch-submit:focus {
    box-shadow: 0 0 0 2px rgba(242, 147, 69, 0.4);
}

.rscitysearch-submit:active:not(:disabled) {
    background: #D07C2A;
    transform: translateY(1px);
}

.rscitysearch-submit:disabled {
    background: #F29345;
    cursor: not-allowed;
}

.rscitysearch-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rscitysearch-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.rscitysearch-text {
    font-size: 14px;
    font-weight: 400;
    line-height: 22.4px;
}

/* ==========================================================================
   載入和錯誤狀態
   ========================================================================== */

.rscitysearch-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.rscitysearch-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #F29345;
    border-radius: 50%;
    animation: rscitysearch-spin 1s linear infinite;
}

@keyframes rscitysearch-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rscitysearch-loading-text {
    font-size: 14px;
    color: #333333;
}

.rscitysearch-error {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #FF4444;
    color: #FFFFFF;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

.rscitysearch-error::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #FF4444;
}

.rscitysearch-error-container {
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    border-radius: 8px;
    padding: 15px;
    margin: 20px auto;
    max-width: 600px;
}

.rscitysearch-error-message {
    color: #E53E3E;
    font-size: 14px;
    margin: 0;
}

/* ==========================================================================
   手機版樣式 (RWD)
   ========================================================================== */

@media (max-width: 767px) {
    .rscitysearch-container {
        width: 100%;
        height: auto;
        min-height: 310px;
        padding: 32px 16px;
    }

    .rscitysearch-form {
        flex-direction: column;
        gap: 8px;
        justify-content: flex-start;
        align-items: stretch;
    }

    .rscitysearch-field {
        width: 100%;
        height: 54px;
        flex-direction: column;
        justify-content: flex-start;
        gap: 0;
        margin-bottom: 8px;
    }

    .rscitysearch-field-continent {
        order: 1;
    }

    .rscitysearch-field-country {
        order: 2;
    }

    .rscitysearch-field-category {
        order: 3;
    }

    .rscitysearch-button-wrapper {
        width: 100%;
        height: 60px;
        justify-content: center;
        align-items: flex-start;
        margin-top: 8px;
        order: 4;
    }

    .rscitysearch-label {
        display: none; /* 手機版不顯示標籤 */
    }

    .rscitysearch-select {
        width: 100%;
        height: 54px;
        margin: 0;
        font-size: 14px;
        padding: 16px 40px 16px 15px;
        box-sizing: border-box;
    }

    .rscitysearch-submit {
        width: 100%;
        height: 60px;
        font-size: 14px;
        gap: 10px;
        box-sizing: border-box;
    }

    .rscitysearch-error {
        bottom: -50px;
        left: 16px;
        right: 16px;
        transform: none;
        text-align: center;
    }
}

/* ==========================================================================
   平板樣式
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1024px) {
    .rscitysearch-container {
        width: 100%;
        max-width: 600px;
        height: auto;
        min-height: 200px;
        padding: 24px;
    }

    .rscitysearch-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 16px;
        align-items: center;
        justify-content: center;
    }

    .rscitysearch-field {
        width: 100%;
        height: auto;
        min-height: 60px;
        justify-content: flex-start;
        gap: 6px;
    }

    .rscitysearch-field-continent {
        grid-column: 1;
        grid-row: 1;
    }

    .rscitysearch-field-country {
        grid-column: 2;
        grid-row: 1;
    }

    .rscitysearch-field-category {
        grid-column: 1;
        grid-row: 2;
    }

    .rscitysearch-button-wrapper {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        height: auto;
        justify-content: flex-start;
        align-items: flex-end;
    }

    .rscitysearch-label {
        margin-bottom: 6px;
        font-size: 13px;
    }

    .rscitysearch-select {
        width: 100%;
        height: 40px;
        margin: 0;
        box-sizing: border-box;
    }

    .rscitysearch-submit {
        width: 100%;
        height: 44px;
        max-width: 180px;
    }
}

/* ==========================================================================
   主題變體
   ========================================================================== */

/* 緊湊主題 */
.rscitysearch-theme-compact {
    padding: 16px 24px;
    height: 80px;
}

.rscitysearch-theme-compact .rscitysearch-field {
    height: 48px;
}

.rscitysearch-theme-compact .rscitysearch-label {
    font-size: 12px;
    margin-bottom: 4px;
}

.rscitysearch-theme-compact .rscitysearch-select {
    height: 28px;
    font-size: 12px;
}

.rscitysearch-theme-compact .rscitysearch-submit {
    height: 32px;
    font-size: 12px;
}

/* 最小主題 */
.rscitysearch-theme-minimal {
    box-shadow: none;
    border: 1px solid #E2E2E2;
    background: #FAFAFA;
}

.rscitysearch-theme-minimal .rscitysearch-select {
    background: #FFFFFF;
    border: 1px solid #DDDDDD;
}

.rscitysearch-theme-minimal .rscitysearch-select:focus {
    border-color: #F29345;
}

/* ==========================================================================
   無障礙改善 (可選)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .rscitysearch-submit {
        transition: none;
    }

    .rscitysearch-spinner {
        animation: none;
    }
}

/* 高對比模式 */
@media (prefers-contrast: high) {
    .rscitysearch-container {
        border: 2px solid #000000;
    }

    .rscitysearch-select {
        border: 1px solid #000000;
    }

    .rscitysearch-submit {
        border: 2px solid #000000;
    }
}

/* ==========================================================================
   載入狀態處理
   ========================================================================== */

.rscitysearch-container.loading .rscitysearch-select,
.rscitysearch-container.loading .rscitysearch-submit {
    pointer-events: none;
    opacity: 0.7;
}

.rscitysearch-container.loading .rscitysearch-loading {
    display: flex;
}

/* ==========================================================================
   選單選項樣式
   ========================================================================== */

.rscitysearch-select option {
    padding: 8px;
    font-size: 14px;
    color: #333333;
    background: #FFFFFF;
}

.rscitysearch-select option:hover {
    background: #F29345;
    color: #FFFFFF;
}

.rscitysearch-select option:disabled {
    color: #CCCCCC;
    background: #F8F8F8;
}

/* ==========================================================================
   修復瀏覽器兼容性
   ========================================================================== */

/* Firefox 特殊處理 */
@-moz-document url-prefix() {
    .rscitysearch-select {
        background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMyIgaGVpZ2h0PSI2IiB2aWV3Qm94PSIwIDAgMTMgNiIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTYuNSA2TDAuODcwODM1IC0xLjA2NjkxZS0wN0wxMi4xMjkyIDguNzc1NDRlLTA3TDYuNSA2WiIgZmlsbD0iIzMzMzMzMyIvPjwvc3ZnPgo=');
        background-position: right 15px center;
        background-size: 13px 6px;
    }
}

/* Safari 特殊處理 */
@supports (-webkit-appearance: none) {
    .rscitysearch-select::-webkit-appearance {
        -webkit-appearance: none;
    }
}