/* === Good Location v1.0.3 前台樣式（仿 GoodInvoice 視覺語言） === */

/* 地址區塊容器 */
.goodlocation_fields,
#goodlocation_billing_fields,
#goodlocation_shipping_fields {
    margin-top: 24px;
    padding: 20px 0 0;
    border-top: 2px solid #F4A100;
}

.goodlocation_fields > h3,
#goodlocation_billing_fields > h3,
#goodlocation_shipping_fields > h3 {
    margin: 0 0 15px;
    font-size: 1.15em;
    font-weight: 600;
    color: #F4A100;
}

/* 各欄位區塊間距 */
.goodlocation_fields > p,
#goodlocation_billing_fields > p,
#goodlocation_shipping_fields > p {
    margin-top: 12px;
}

/* ====== 核心修復：強制關閉 Astra / 任何主題的浮動 label ====== */
.goodlocation_fields .form-row,
.goodlocation_fields p.form-row,
.woocommerce-checkout .goodlocation_fields .form-row,
.woocommerce .goodlocation_fields .form-row,
body .woocommerce-checkout .goodlocation_fields p.form-row {
    position: static !important;
    padding: 0 !important;
    margin: 0 0 12px !important;
    width: 100% !important;
    float: none !important;
}

.goodlocation_fields .form-row label,
.goodlocation_fields p.form-row label,
.woocommerce-checkout .goodlocation_fields .form-row label,
.woocommerce .goodlocation_fields .form-row label,
body .woocommerce-checkout .goodlocation_fields p.form-row > label,
body.woocommerce-checkout .goodlocation_fields label {
    position: static !important;
    display: block !important;
    margin: 0 0 5px 0 !important;
    padding: 0 !important;
    font-weight: 500 !important;
    font-size: 0.95em !important;
    color: #333 !important;
    transform: none !important;
    -webkit-transform: none !important;
    transition: none !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    top: auto !important;
    left: auto !important;
    line-height: 1.4 !important;
    background: transparent !important;
    z-index: auto !important;
}

/* 必填星號 */
.goodlocation_fields .form-row label abbr {
    color: #e2401c;
    text-decoration: none;
    border: none;
    margin-left: 2px;
}

/* optional 標記 */
.goodlocation_fields .form-row label span.optional {
    color: #888 !important;
    font-weight: 400 !important;
    margin-left: 4px;
    display: inline !important;
}

/* input wrapper */
.goodlocation_fields .woocommerce-input-wrapper,
.woocommerce-checkout .goodlocation_fields .woocommerce-input-wrapper {
    position: static !important;
    display: block !important;
    width: 100% !important;
}

/* Select 下拉 */
.goodlocation_fields select,
.woocommerce-checkout .goodlocation_fields select {
    width: 100% !important;
    height: auto !important;
    min-height: 44px !important;
    padding: 10px 35px 10px 12px !important;
    border: 1px solid #bbb !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 12px) center !important;
    background-size: 12px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    font-size: inherit !important;
    line-height: 1.4 !important;
    display: block !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    color: #333 !important;
}

/* Input 文字欄位 */
.goodlocation_fields input[type="text"],
.goodlocation_fields input[type="tel"],
.goodlocation_fields input[type="email"],
.woocommerce-checkout .goodlocation_fields input[type="text"] {
    width: 100% !important;
    height: auto !important;
    min-height: 44px !important;
    padding: 10px 12px !important;
    border: 1px solid #bbb !important;
    border-radius: 4px !important;
    font-size: inherit !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    color: #333 !important;
}

/* Focus 狀態 */
.goodlocation_fields input[type="text"]:focus,
.goodlocation_fields input[type="tel"]:focus,
.goodlocation_fields input[type="email"]:focus,
.goodlocation_fields select:focus {
    border-color: #F4A100 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(244, 161, 0, 0.2) !important;
}

/* Disabled 狀態 (還沒選縣市時的 city 下拉) */
.goodlocation_fields select:disabled,
.goodlocation_fields input[type="text"]:disabled {
    background-color: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

/* 舊地址解析警告 */
.goodlocation_fields .gl-notice {
    padding: 10px 12px;
    margin: 0 0 12px;
    border-radius: 4px;
    font-size: 0.9em;
}

.goodlocation_fields .gl-notice--warning {
    background: #FFF8E5;
    border: 1px solid #FFD97A;
    color: #8A5A00;
}

.goodlocation_fields .gl-notice__raw {
    margin-top: 6px;
    padding: 6px 8px;
    background: #fff;
    border: 1px dashed #ccc;
    font-family: Menlo, Consolas, monospace;
    font-size: 0.85em;
    color: #555;
    word-break: break-all;
}

/* 隱藏 WC 原生欄位（override_fields 會把 class 設成 gl-hidden）*/
/* v1.0.6: 加強選擇器以覆蓋 <p>、Select2 wrapper、及可能的 wrapping div */
.ga-hidden,
.gl-hidden,
p.gl-hidden,
p.form-row.gl-hidden,
.woocommerce-checkout p.gl-hidden,
.woocommerce-checkout .form-row.gl-hidden,
.woocommerce-account p.gl-hidden,
.woocommerce-account .form-row.gl-hidden,
.woocommerce-MyAccount-content p.gl-hidden,
.woocommerce-MyAccount-content .form-row.gl-hidden {
    display: none !important;
}

/* v1.1.5: textarea for generic-locale single-line address */
.goodlocation_fields .gl-textarea,
.goodlocation_fields textarea.gl-address-full {
    width: 100% !important;
    min-height: 80px !important;
    padding: 9px 12px !important;
    border: 1px solid #D0D0D0 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    font-family: inherit !important;
    resize: vertical;
    box-sizing: border-box !important;
    background: #fff !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.goodlocation_fields .gl-textarea:focus,
.goodlocation_fields textarea.gl-address-full:focus {
    border-color: #F4A100 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(244,161,0,0.15) !important;
}
.goodlocation_fields .gl-field-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

/* v1.1.5: my-account wrap subtle differentiation */
.gl-form-wrap--myaccount {
    margin-top: 0;
    margin-bottom: 16px;
}

/* v1.1.6: low-confidence legacy parse warning */
.gl-parse-warning {
    background: #FFF8E5;
    border: 1px solid #F0C36D;
    border-left: 4px solid #F4A100;
    border-radius: 6px;
    padding: 12px 14px;
    margin: 0 0 18px 0;
    font-size: 13px;
    line-height: 1.6;
    color: #5a4400;
}
.gl-parse-warning strong {
    display: block;
    margin-bottom: 4px;
    color: #5a4400;
}
.gl-parse-warning p {
    margin: 4px 0;
}
.gl-parse-warning__raw {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
    font-size: 12px;
    background: #fff;
    padding: 6px 8px;
    border-radius: 4px;
    word-break: break-all;
}

/* 清除浮動 */
.goodlocation_fields::after {
    content: '';
    display: table;
    clear: both;
}

/* 手機版 */
@media (max-width: 600px) {
    .goodlocation_fields select,
    .goodlocation_fields input[type="text"] {
        min-height: 48px !important;  /* 手機點擊目標更大 */
        font-size: 16px !important;   /* 防 iOS 自動放大 */
    }
}

/* R3 warning SVG icon — sit on text baseline */
.gl-parse-warning strong svg,
.gl-notice--warning svg {
    vertical-align: -3px;
    margin-right: 6px;
}
