/* ========================================================================== 
   Shapesculpt Theme - Components Layer
   --------------------------------------------------------------------------
   说明：本文件用于放置“可复用组件样式”（全站通用）。
   组件特点：
   - 命名空间：ss-（避免与 Bootstrap / 插件 / WP 默认样式冲突）
   - 不包含页面布局（页面布局放在各自 page css）
   - 不包含全局地基（变量/栅格等放在 base.css）
   ========================================================================== */

/* ========================================================================== 
   Component: Buttons
   来源：front-page.php（首页多个模块复用）
   - Hero Banner 按钮（.hero-banner__buttons）
   - CTA Cards 按钮（.cta-card）
   - Design Capability CTA 按钮
   - Process Setup CTA 按钮
   - Recent Blogs 卡片按钮
   --------------------------------------------------------------------------
   用法：
   <a class="ss-btn ss-btn--primary" ...>...</a>
   <a class="ss-btn ss-btn--red" ...>...</a>
   <a class="ss-btn ss-btn--learn-more" ...>...</a>
   ========================================================================== */

.ss-btn {
    padding: 15px 30px;
    text-decoration: none;
    font-weight: 700;
    border-radius: 5px;
    transition: var(--transition);
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 16px;
    white-space: nowrap; /* 按钮文字不换行，保持一行 */
}

/* Variant: Primary (使用点缀色：用于全站主按钮) */
.ss-btn--primary {
    background: var(--accent-color);
    color: #fff;
}

.ss-btn--primary:hover {
    background: var(--accent-hover, var(--accent-color));
    transform: translateY(-2px);
}

/* Variant: Secondary */
.ss-btn--secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.ss-btn--secondary:hover {
    background: var(--primary-color);
    color: #fff;
}

/* ========================================================================== 
   Global Button Color Fallback (enforce accent/hover variables)
   --------------------------------------------------------------------------
   说明：部分页面仍使用 .btn/.btn-primary/.btn-red/.btn-learn-more。
   这里提供兜底，确保按钮背景色与 hover 始终跟随 Customizer：
   --accent-color / --accent-hover。
   ========================================================================== */

.btn-primary,
.btn-red,
.btn-learn-more,
.blog-card .btn-learn-more,
.ss-btn--primary,
.ss-btn--red {
    background: var(--accent-color) !important;
    background-color: var(--accent-color) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-red:hover,
.btn-learn-more:hover,
.blog-card .btn-learn-more:hover,
.ss-btn--primary:hover,
.ss-btn--red:hover {
    background: var(--accent-hover) !important;
    background-color: var(--accent-hover) !important;
}

/* ========================================================================== 
   Component: Quote Modal (Global)
   --------------------------------------------------------------------------
   说明：全站通用报价弹窗（#quote-modal）。
   触发方式：给任意按钮/链接加 class="js-open-quote-modal"。
   显示控制：默认隐藏，JS 添加 .is-open 时显示。
   ========================================================================== */

.quote-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none; /* 默认隐藏：仅在 .is-open 时显示 */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.quote-modal.is-open {
    display: flex;
}

.quote-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.quote-modal-content {
    position: relative;
    background: var(--bg-light, var(--secondary-color, #fff));
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    z-index: 10000;
    /* 优化滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.quote-modal-content::-webkit-scrollbar {
    width: 8px;
}

.quote-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.quote-modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.quote-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

.quote-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    line-height: 1;
}

.quote-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.quote-modal-title {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin-bottom: 10px;
    text-align: center;
}

.quote-modal-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

.quote-form {
    width: 100%;
}

/* ========================================================================== 
   WPForms 在弹窗中的样式优化
   ========================================================================== */

/* WPForms 容器样式 */
.quote-form .wpforms-container {
    margin: 0;
    padding: 0;
    width: 100%;
}

.quote-form .wpforms-form {
    margin: 0;
    padding: 0;
}

/* 表单字段容器 */
.quote-form .wpforms-field {
    margin-bottom: 20px;
}

.quote-form .wpforms-field:last-child {
    margin-bottom: 0;
}

/* 标签样式 */
.quote-form .wpforms-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.quote-form .wpforms-field-label.wpforms-label-hide {
    display: none;
}

/* 必填字段标记 */
.quote-form .wpforms-required-label {
    color: #e91e63;
    margin-left: 3px;
}

/* 输入框样式 */
.quote-form .wpforms-field input[type="text"],
.quote-form .wpforms-field input[type="email"],
.quote-form .wpforms-field input[type="tel"],
.quote-form .wpforms-field input[type="url"],
.quote-form .wpforms-field input[type="number"],
.quote-form .wpforms-field select,
.quote-form .wpforms-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.quote-form .wpforms-field input:focus,
.quote-form .wpforms-field select:focus,
.quote-form .wpforms-field textarea:focus {
    outline: none;
    border-color: var(--accent-color, #e91e63);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.quote-form .wpforms-field textarea {
    resize: vertical;
    min-height: 120px;
}

/* 下拉选择框 */
.quote-form .wpforms-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* 错误提示样式 */
.quote-form .wpforms-error {
    color: #d63638;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

.quote-form .wpforms-field.wpforms-has-error input,
.quote-form .wpforms-field.wpforms-has-error select,
.quote-form .wpforms-field.wpforms-has-error textarea {
    border-color: #d63638;
}

.quote-form .wpforms-field.wpforms-has-error input:focus,
.quote-form .wpforms-field.wpforms-has-error select:focus,
.quote-form .wpforms-field.wpforms-has-error textarea:focus {
    border-color: #d63638;
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.1);
}

/* 成功提示样式 */
.quote-form .wpforms-confirmation-container {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    color: #155724;
    font-size: 14px;
}

/* 提交按钮容器 */
.quote-form .wpforms-submit-container {
    margin-top: 30px;
    text-align: center;
}

/* 提交按钮样式 */
.quote-form .wpforms-submit {
    min-width: 200px;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    background: var(--accent-color, #e91e63);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.quote-form .wpforms-submit:hover {
    background: var(--accent-hover, #c2185b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.quote-form .wpforms-submit:active {
    transform: translateY(0);
}

.quote-form .wpforms-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 隐藏 WPForms 默认的标题和描述（因为弹窗已有标题） */
.quote-form .wpforms-title {
    display: none;
}

.quote-form .wpforms-description {
    display: none;
}

/* 复选框和单选框样式优化 */
.quote-form .wpforms-field-checkbox .wpforms-field-label,
.quote-form .wpforms-field-radio .wpforms-field-label {
    font-weight: 600;
    margin-bottom: 12px;
}

.quote-form .wpforms-field-checkbox ul,
.quote-form .wpforms-field-radio ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quote-form .wpforms-field-checkbox li,
.quote-form .wpforms-field-radio li {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
}

.quote-form .wpforms-field-checkbox input[type="checkbox"],
.quote-form .wpforms-field-radio input[type="radio"] {
    width: auto;
    margin-right: 10px;
    margin-top: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.quote-form .wpforms-field-checkbox label,
.quote-form .wpforms-field-radio label {
    font-weight: normal;
    margin: 0;
    cursor: pointer;
    line-height: 1.5;
}

/* 文件上传字段 */
.quote-form .wpforms-field-file-upload input[type="file"] {
    padding: 8px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
}

.quote-form .wpforms-field-file-upload input[type="file"]:hover {
    border-color: var(--accent-color, #e91e63);
    background: #fff;
}

/* 日期选择器 */
.quote-form .wpforms-field-date-time input[type="date"],
.quote-form .wpforms-field-date-time input[type="time"] {
    cursor: pointer;
}

/* 加载状态优化 */
.quote-form .wpforms-submit-container .wpforms-submit.wpforms-submitting {
    position: relative;
    color: transparent;
}

.quote-form .wpforms-submit-container .wpforms-submit.wpforms-submitting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 隐藏 WPForms 的 "Powered by" 链接（可选，如果需要显示可以删除） */
.quote-form .wpforms-container .wpforms-powered-by {
    display: none;
}

/* 确保表单在弹窗中正确对齐 */
.quote-form .wpforms-container-full {
    width: 100%;
}

/* 优化字段描述文字 */
.quote-form .wpforms-field-description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 0;
    line-height: 1.4;
}

/* 优化字段帮助文字 */
.quote-form .wpforms-field-help {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    font-style: italic;
}

.quote-form-group {
    margin-bottom: 20px;
}

.quote-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.quote-form-group input[type="text"],
.quote-form-group input[type="email"],
.quote-form-group input[type="tel"],
.quote-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.quote-form-group input:focus,
.quote-form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color, #e91e63);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.quote-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.quote-form-submit {
    margin-top: 30px;
    text-align: center;
}

.quote-form-submit .btn {
    min-width: 200px;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
    .quote-modal-content {
        padding: 30px 20px;
        width: 95%;
        max-height: 95vh;
    }

    .quote-modal-title {
        font-size: 24px;
    }

    .quote-modal-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .quote-form-submit .btn {
        width: 100%;
        min-width: auto;
    }

    /* 移动端 WPForms 样式优化 */
    .quote-form .wpforms-field {
        margin-bottom: 18px;
    }

    .quote-form .wpforms-field input[type="text"],
    .quote-form .wpforms-field input[type="email"],
    .quote-form .wpforms-field input[type="tel"],
    .quote-form .wpforms-field input[type="url"],
    .quote-form .wpforms-field input[type="number"],
    .quote-form .wpforms-field select,
    .quote-form .wpforms-field textarea {
        padding: 10px 12px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }

    .quote-form .wpforms-submit {
        width: 100%;
        min-width: auto;
        padding: 12px 20px;
    }

    .quote-form .wpforms-field-checkbox li,
    .quote-form .wpforms-field-radio li {
        margin-bottom: 8px;
    }
}

/* ========================================================================== 
   Component: Floating Actions (WhatsApp + Back to Top)
   说明：右下角浮动按钮，全站通用（所有页面都需要）
   位置：footer.php 中定义
   ========================================================================== */
.floating-actions {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.floating-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}

.floating-whatsapp {
    background: #25D366;
    text-decoration: none;
}

.floating-whatsapp-icon {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

.floating-backtop {
    background: var(--primary-color, #e54b4d);
    border: none;
    display: none;
    font-size: 22px;
    font-weight: 700;
}

.floating-backtop.show {
    display: inline-flex;
}

/* ========================================================================== 
   Component: Floating Actions (WhatsApp + Back to Top)
   全站通用浮动按钮组件
   - WhatsApp 联系按钮
   - 返回顶部按钮
   ========================================================================== */

.floating-actions {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.floating-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}

.floating-whatsapp {
    background: #25D366;
    text-decoration: none;
}

.floating-whatsapp-icon {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

.floating-backtop {
    background: var(--primary-color, #e54b4d);
    border: none;
    display: none;
    font-size: 22px;
    font-weight: 700;
}

.floating-backtop.show {
    display: inline-flex;
}
