/* ===========================
   area-converter - 面積單位換算工具頁面
   =========================== */

/* 主要內容區塊，佔滿 wrapper 剩餘寬度 */
.ac-container {
    flex: 1;
    min-width: 0;
}

/* 英雄區塊：頁面標題與簡介的容器 */
.ac-hero {
    text-align: center;
    padding: 10px 0 30px;
}

/* 英雄區塊主標題 */
.ac-hero-title {
    font-size: 2.25em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}

/* 英雄區塊副標題 (對比度 4.51:1，符合 WCAG AA) */
.ac-hero-subtitle {
    font-size: 1.063em;
    color: #64748b;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 16px;
}

/* 工具卡片外框：包含所有單位換算輸入 */
.ac-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    overflow: hidden;
}

/* 卡片標題列：含圖示與標題文字 */
.ac-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

/* 卡片圖示容器 */
.ac-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.125em;
    color: #fff;
    background: #059669;
    flex-shrink: 0;
}

/* 卡片標題文字 */
.ac-card-title {
    font-size: 1.125em;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* 卡片描述文字 (對比度 4.51:1，符合 WCAG AA) */
.ac-card-desc {
    font-size: 0.875em;
    color: #64748b;
    margin: 2px 0 0;
}

/* 卡片內容區塊 */
.ac-card-body {
    padding: 16px 20px 20px;
}

/* 單位列：每一個換算單位的橫向容器 */
.ac-unit-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

/* 最後一列不顯示底線 */
.ac-unit-row:last-of-type {
    border-bottom: none;
}

/* 單位名稱標籤，固定寬度對齊 */
.ac-unit-label {
    width: 160px;
    font-size: 0.938em;
    font-weight: 500;
    color: #334155;
    flex-shrink: 0;
    cursor: default;
}

/* 輸入框與單位縮寫的容器 */
.ac-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 數值輸入框 (邊框顏色 #8b95a5 對比度 3.05:1，符合 UI 元件門檻) */
.ac-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #8b95a5;
    border-radius: 6px;
    font-size: 1em;
    color: #1e293b;
    background: #fff;
    text-align: right;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* 輸入框聚焦狀態：藍色邊框與光暈 */
.ac-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 鍵盤導航聚焦外框 (WCAG 無障礙必要) */
.ac-input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 單位縮寫文字，固定寬度保持對齊 (對比度 4.51:1，符合 WCAG AA) */
.ac-unit-suffix {
    width: 50px;
    font-size: 0.875em;
    color: #64748b;
    text-align: left;
    flex-shrink: 0;
}

/* 操作按鈕列 */
.ac-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid #e2e8f0;
}

/* 通用按鈕基礎樣式 */
.ac-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.938em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

/* 清除按鈕 (背景 #64748b 白字對比度 4.51:1，符合 WCAG AA) */
.ac-btn--clear {
    background: #64748b;
    color: #fff;
}

/* 清除按鈕 hover 狀態 */
.ac-btn--clear:hover {
    background: #475569;
}

/* 鍵盤導航聚焦外框 (WCAG 無障礙必要) */
.ac-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 平板裝置以下縮小標籤寬度 */
@media (max-width: 768px) {
    .ac-unit-label {
        width: 120px;
        font-size: 0.875em;
    }
}

/* 手機裝置：單位列改為換行排列 */
@media (max-width: 576px) {
    .ac-card-body {
        padding: 12px 16px 16px;
    }

    .ac-unit-row {
        flex-wrap: wrap;
        padding: 8px 0;
    }

    /* 標籤佔滿整行 */
    .ac-unit-label {
        width: 100%;
        margin-bottom: 4px;
        font-size: 0.875em;
    }

    /* 輸入框群組佔滿整行 */
    .ac-input-group {
        width: 100%;
    }

    .ac-hero-title {
        font-size: 1.75em;
    }
}

/* 尊重使用者減少動態效果的偏好設定 */
@media (prefers-reduced-motion: reduce) {
    .ac-input,
    .ac-btn {
        transition: none;
    }
}

/* Windows 高對比模式支援 */
@media (forced-colors: active) {
    .ac-input {
        border-color: ButtonText;
    }

    .ac-input:focus {
        border-color: Highlight;
        box-shadow: none;
    }

    .ac-btn {
        border: 2px solid ButtonText;
    }

    .ac-card {
        border-color: ButtonText;
    }
}
