/* CalWhat Calculator Platform - Currency Converter Specific Styles */
/* 匯率換算計算器專用樣式 */


/* ========================================
   4. 幣別快捷按鈕
======================================== */

.currency-shortcuts {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.currency-btn {
    flex: 0 0 auto; /* 不自動擴展，保持固定寬度 */
    width: 80px; /* 固定寬度（移除國旗後縮小） */
    padding: 8px 6px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.currency-btn:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.currency-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.currency-btn.active .currency-code,
.currency-btn.active .currency-name {
    color: white;
}

.currency-flag {
    font-size: 1.8rem;
}

.currency-code {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: #667eea;
    letter-spacing: 1px;
}

.currency-name {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
}

/* ========================================
   5. 輸入欄位
======================================== */

.input-group-custom {
    margin-bottom: 12px;
}

/* Currency Input Wrapper with Buttons */
.currency-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* 自定義下拉選單 */
.currency-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
    margin-top: -2px;
}

.currency-dropdown-list {
    padding: 0;
}

.currency-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    gap: 10px;
}

.currency-dropdown-item:last-child {
    border-bottom: none;
}

.currency-dropdown-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.currency-dropdown-item .currency-code-dropdown {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 45px;
    color: #667eea;
    font-family: 'Roboto Mono', monospace;
}

.currency-dropdown-item:hover .currency-code-dropdown {
    color: white;
}

.currency-dropdown-item .currency-name-dropdown {
    font-size: 0.85rem;
    color: #718096;
    flex: 1;
}

.currency-dropdown-item:hover .currency-name-dropdown {
    color: rgba(255, 255, 255, 0.9);
}

/* Scrollbar styling for dropdown */
.currency-dropdown::-webkit-scrollbar {
    width: 8px;
}

.currency-dropdown::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 0 0 12px 0;
}

.currency-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.currency-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.currency-input-with-buttons {
    padding-right: 75px; /* 為兩個按鈕預留空間 */
}

.currency-input-with-buttons-favorite {
    padding-right: 110px; /* 為三個按鈕預留空間 (最愛+清空+下拉) */
}

.input-favorite-btn,
.input-clear-btn,
.input-dropdown-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #718096;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.input-favorite-btn {
    right: 75px; /* 最愛按鈕在最左側 */
}

.input-clear-btn {
    right: 40px; /* 清空按鈕在中間 */
}

.input-dropdown-btn {
    right: 6px; /* 下拉按鈕在最右側 */
}

.input-favorite-btn:hover {
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
}

.input-favorite-btn.active {
    color: #f59e0b;
}

.input-favorite-btn.active i {
    font-weight: 900; /* 使用 fas (實心) 圖示 */
}

.input-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.input-dropdown-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.input-favorite-btn:active,
.input-clear-btn:active,
.input-dropdown-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Amount Input Wrapper with Currency Symbol */
.amount-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    pointer-events: none;
}

.amount-input-with-symbol {
    padding-left: 35px; /* 為貨幣符號預留空間 */
    text-align: right; /* 文字靠右對齊，避免與 $ 符號重疊 */
}

.input-label {
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-size: 0.7rem;
    cursor: help;
    margin-left: 5px;
    position: relative;
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2d3748;
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: opacity 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-weight: 400;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2d3748 transparent transparent transparent;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #48bb78;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Roboto Mono', monospace;
    transition: all 0.3s ease;
    background: #f0fff4;
}

.form-input:focus {
    outline: none;
    border-color: #38a169;
    box-shadow: 0 0 0 4px rgba(72, 187, 120, 0.2);
    transform: translateY(-2px);
}

.input-range {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 4px;
}

/* ========================================
   6. 快速金額按鈕
======================================== */

.quick-amount-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.7rem !important;
}

.quick-amount-btn:hover {
    border-color: #48bb78;
    background: #f0fff4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.2);
}

.quick-amount-btn:active {
    transform: translateY(0);
}



/* ========================================
   8. 結果顯示
======================================== */

.result-main {
    padding: 20px;
    text-align: center;
}

.result-item {
    margin-bottom: 20px;
}

.result-label {
    font-size: 1rem;
    font-weight: 500;
    color: #718096;
    margin-bottom: 8px;
}

.result-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeIn 0.5s ease;
}

.result-value.main-result {
    font-size: 3rem;
    animation: pulse 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========================================
   9. 匯率資訊
======================================== */

.rate-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.rate-info-item:last-child {
    border-bottom: none;
}

.rate-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #4a5568;
}

.rate-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
}

/* ========================================
   10. SEO 內容區
======================================== */

/* ========================================
   11. 響應式設計 - 平板
======================================== */

@media (max-width: 991px) {
    .page-header h1 {
        font-size: 2.2rem;
    }

    .page-header .subtitle {
        font-size: 1rem;
    }

    .result-value {
        font-size: 2rem;
    }

    .result-value.main-result {
        font-size: 2.5rem;
    }

    .currency-shortcuts {
        gap: 8px;
    }

    .currency-btn {
        width: 70px; /* 平板固定寬度（移除國旗後縮小） */
        padding: 8px 5px;
    }

    .seo-section {
        padding: 30px;
    }

    .seo-section h2 {
        font-size: 1.6rem;
    }

    .seo-section h3 {
        font-size: 1.3rem;
    }
}

/* ========================================
   12. 響應式設計 - 手機
======================================== */

@media (max-width: 767px) {
    body {
        padding: 10px 0;
    }

    .main-container {
        padding: 0 15px;
    }

    .page-header {
        margin-bottom: 25px;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .page-header .subtitle {
        font-size: 0.9rem;
    }

    .glass-card {
        padding: 15px;
        margin-bottom: 12px;
        border-radius: 15px;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .currency-shortcuts {
        gap: 6px;
    }

    .currency-btn {
        width: 60px; /* 手機固定寬度（移除國旗後縮小） */
        padding: 6px 4px;
    }

    .currency-code {
        font-size: 0.75rem;
    }

    .currency-name {
        font-size: 0.65rem;
    }

    .result-value {
        font-size: 1.8rem;
    }

    .result-value.main-result {
        font-size: 2.2rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        min-width: auto;
    }

    .quick-amount-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .seo-section {
        padding: 20px;
        margin-top: 30px;
    }

    .seo-section h2 {
        font-size: 1.4rem;
    }

    .seo-section h3 {
        font-size: 1.2rem;
        margin-top: 20px;
    }

    .seo-section h4 {
        font-size: 1.05rem;
    }

    .seo-section p,
    .seo-section li {
        font-size: 0.95rem;
    }
}

/* ========================================
   13. 特殊動畫效果
======================================== */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 載入動畫 */
.col-lg-7 .glass-card {
    animation: slideInLeft 0.6s ease;
}

.col-lg-5 .glass-card {
    animation: slideInRight 0.6s ease;
}

/* ========================================
   14. 幣別互換按鈕
======================================== */

.btn-currency-swap {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn-currency-swap:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-currency-swap:active {
    transform: rotate(180deg) scale(0.95);
}

.btn-currency-swap i {
    transition: transform 0.3s ease;
}

.btn-currency-swap span {
    display: none;
}

@media (max-width: 768px) {
    .btn-currency-swap {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* ========================================
   15. 貨幣自動完成建議
======================================== */

.currency-autocomplete {
    position: relative;
}

.currency-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
    display: none;
}

.currency-suggestions.active {
    display: block;
}

.currency-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    gap: 10px;
}

.currency-suggestion-item:last-child {
    border-bottom: none;
}

.currency-suggestion-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.currency-suggestion-item.selected {
    background: #f7fafc;
    border-left: 3px solid #667eea;
}

.currency-suggestion-code {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 45px;
    color: #667eea;
}

.currency-suggestion-item:hover .currency-suggestion-code {
    color: white;
}

.currency-suggestion-name {
    font-size: 0.85rem;
    color: #718096;
    flex: 1;
}

.currency-suggestion-item:hover .currency-suggestion-name {
    color: rgba(255, 255, 255, 0.9);
}

.currency-suggestions-empty {
    padding: 20px;
    text-align: center;
    color: #a0aec0;
    font-size: 0.9rem;
}

/* Scrollbar styling for suggestions */
.currency-suggestions::-webkit-scrollbar {
    width: 8px;
}

.currency-suggestions::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 0 0 12px 0;
}

.currency-suggestions::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.currency-suggestions::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ========================================
   15. 列印樣式
======================================== */

@media print {
    body {
        background: white;
    }

    .glass-card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }

    .btn,
    .button-group {
        display: none;
    }

    .page-header h1 {
        color: #667eea;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
