/**
 * 用户账户页面样式
 * My Account Page Styles
 *
 * @package Laifen_Russia
 * @since 1.0.0
 */

/* ========== 页面容器 ========== */
.laifen-my-account-page {
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    min-height: 100vh;
    padding: 40px 0;
}

.laifen-account-wrapper {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

/* WooCommerce 账户页面固定宽度 */
.woocommerce-account .woocommerce,
.woocommerce-account .woocommerce-MyAccount-content {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
}

/* 隐藏默认的页面标题 */
.woocommerce-account .entry-header,
.woocommerce-account .page-title {
    display: none;
}

/* ========== 账户头部 ========== */
.laifen-account-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.laifen-account-user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.laifen-account-avatar img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.laifen-account-greeting h1 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.laifen-account-greeting p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
}

/* ========== 主体布局 ========== */
.laifen-account-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 30px;
    align-items: start;
}

/* ========== 侧边导航 ========== */
.laifen-account-nav {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 100px;
}

/* 重置 WooCommerce 默认的 float 布局 */
.woocommerce-account .woocommerce-MyAccount-navigation {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
}

.woocommerce-MyAccount-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-MyAccount-navigation li {
    margin: 0 0 8px 0;
}

.woocommerce-MyAccount-navigation li:last-child {
    margin-bottom: 0;
}

.woocommerce-MyAccount-navigation a {
    display: block;
    width: 100%;
    padding: 12px 16px;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
}

.woocommerce-MyAccount-navigation a:hover {
    background-color: #e7f1ff;
    color: #007bff;
}

.woocommerce-MyAccount-navigation li.is-active a {
    background-color: #e7f1ff;
    color: #007bff;
    font-weight: 600;
    border-left: 4px solid #007bff;
    padding-left: 12px;
}

/* ========== 内容区域 ========== */
.laifen-account-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-height: 400px;
}

.woocommerce-MyAccount-content {
    color: #333;
}

.woocommerce-MyAccount-content p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.woocommerce-MyAccount-content a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.woocommerce-MyAccount-content a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ========== 订单表格 ========== */
.woocommerce-orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.woocommerce-orders-table thead {
    background-color: #f8f9fa;
}

.woocommerce-orders-table th {
    padding: 15px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e0e0e0;
}

.woocommerce-orders-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.woocommerce-orders-table tbody tr {
    transition: background-color 0.2s ease;
}

.woocommerce-orders-table tbody tr:hover {
    background-color: #f8f9fa;
}

.woocommerce-orders-table .woocommerce-orders-table__cell-order-number a {
    color: #007bff;
    font-weight: 600;
    text-decoration: none;
}

.woocommerce-orders-table .woocommerce-orders-table__cell-order-number a:hover {
    text-decoration: underline;
}

.woocommerce-orders-table .order-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.order-status.processing {
    background-color: #fff3cd;
    color: #856404;
}

.order-status.completed {
    background-color: #d4edda;
    color: #155724;
}

.order-status.cancelled,
.order-status.failed {
    background-color: #f8d7da;
    color: #721c24;
}

.order-status.on-hold {
    background-color: #d1ecf1;
    color: #0c5460;
}

.woocommerce-orders-table .woocommerce-button {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.woocommerce-orders-table .woocommerce-button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* ========== 地址管理 ========== */
/* 重置 WooCommerce 默认的 float 布局 */
.woocommerce-Addresses.col2-set,
.u-columns.woocommerce-Addresses {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
    margin-top: 20px;
}

.woocommerce-Addresses.col2-set::before,
.woocommerce-Addresses.col2-set::after {
    display: none !important;
}

.woocommerce-Address.u-column1,
.woocommerce-Address.u-column2,
.woocommerce-Address.col-1,
.woocommerce-Address.col-2 {
    background-color: #ffffff !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
    transition: all 0.3s ease;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.woocommerce-Address:hover {
    border-color: #007bff !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15) !important;
    transform: translateY(-2px);
}

.woocommerce-Address-title,
.woocommerce-Address header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    margin: 0;
    background-color: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.woocommerce-Address-title h3,
.woocommerce-Address-title h2,
.woocommerce-Address header h2,
.woocommerce-Address header h3 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 !important;
}

.woocommerce-Address-title .edit,
.woocommerce-Address header .edit {
    color: #007bff !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    transition: all 0.3s ease;
    background-color: white;
    border: 1px solid #007bff;
}

.woocommerce-Address-title .edit:hover,
.woocommerce-Address header .edit:hover {
    background-color: #007bff !important;
    color: white !important;
}

.woocommerce-Address address {
    font-style: normal !important;
    line-height: 1.8 !important;
    color: #666 !important;
    font-size: 14px !important;
    flex: 1;
    padding: 24px !important;
    margin: 0 !important;
}

/* 空地址提示 */
.woocommerce-Address address:empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-style: italic;
    min-height: 120px;
}

.woocommerce-Address address:empty::before {
    content: 'Вы ещё не указали адрес этого типа.';
}

/* ========== 表单样式 ========== */
.woocommerce-EditAccountForm,
.woocommerce-address-fields,
.edit-account {
    max-width: 100%;
}

/* 重置 WooCommerce 默认样式 - 针对 p 标签 */
.woocommerce .woocommerce-EditAccountForm p.form-row,
.woocommerce .edit-account p.form-row,
.woocommerce form p.form-row,
.woocommerce-page form p.form-row {
    padding: 0 !important;
    margin: 0 0 24px 0 !important;
}

/* 表单行基础样式 - 覆盖 grid 布局，使用 block */
.woocommerce .woocommerce-form-row,
.woocommerce .form-row,
.woocommerce form .form-row,
.woocommerce form p.form-row,
.woocommerce-page form p.form-row {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    margin-bottom: 24px !important;
    overflow: visible !important;
}

/* 表单行布局 - 支持半宽（左右并排） */
.woocommerce .woocommerce-form-row--first,
.woocommerce .woocommerce-form-row--last,
.woocommerce .form-row-first,
.woocommerce .form-row-last,
.woocommerce form .form-row-first,
.woocommerce form .form-row-last,
.woocommerce form p.form-row-first,
.woocommerce form p.form-row-last,
.woocommerce-page form p.form-row-first,
.woocommerce-page form p.form-row-last {
    width: 48% !important;
    float: left !important;
    margin-bottom: 24px !important;
    clear: none !important;
}

.woocommerce .woocommerce-form-row--last,
.woocommerce .form-row-last,
.woocommerce form .form-row-last,
.woocommerce form p.form-row-last,
.woocommerce-page form p.form-row-last {
    float: right !important;
}

/* 全宽表单行 */
.woocommerce .woocommerce-form-row--wide,
.woocommerce .form-row-wide,
.woocommerce form .form-row-wide,
.woocommerce form p.form-row-wide,
.woocommerce-page form p.form-row-wide {
    width: 100% !important;
    clear: both !important;
    float: none !important;
}

/* 清除浮动 */
.woocommerce-EditAccountForm::after,
.edit-account::after,
.woocommerce-address-fields::after,
.woocommerce form::after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

.woocommerce .clear,
.woocommerce form .clear,
.woocommerce-page .clear {
    clear: both !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 标签样式 - 使用最强选择器覆盖 WooCommerce */
.woocommerce .woocommerce-form-row label,
.woocommerce .form-row label,
.woocommerce form .form-row label,
.woocommerce form p.form-row label,
.woocommerce-page form .form-row label,
.woocommerce-page form p.form-row label {
    display: block !important;
    width: 100% !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.4 !important;
    text-align: left !important;
    float: none !important;
    position: static !important;
}

.woocommerce .woocommerce-form-row .required,
.woocommerce .form-row .required,
.woocommerce form .form-row .required,
.woocommerce form p.form-row .required {
    color: #dc3545 !important;
    margin-left: 2px !important;
}

/* 输入框样式 */
.woocommerce .woocommerce-form-row input[type="text"],
.woocommerce .woocommerce-form-row input[type="email"],
.woocommerce .woocommerce-form-row input[type="password"],
.woocommerce .woocommerce-form-row input[type="tel"],
.woocommerce .woocommerce-form-row select,
.woocommerce .woocommerce-form-row textarea,
.woocommerce .form-row input[type="text"],
.woocommerce .form-row input[type="email"],
.woocommerce .form-row input[type="password"],
.woocommerce .form-row input[type="tel"],
.woocommerce .form-row select,
.woocommerce .form-row textarea,
.woocommerce form .form-row input[type="text"],
.woocommerce form .form-row input[type="email"],
.woocommerce form .form-row input[type="password"],
.woocommerce form .form-row input[type="tel"],
.woocommerce form .form-row select,
.woocommerce form .form-row textarea,
.woocommerce form p.form-row input[type="text"],
.woocommerce form p.form-row input[type="email"],
.woocommerce form p.form-row input[type="password"],
.woocommerce form p.form-row input[type="tel"],
.woocommerce form p.form-row select,
.woocommerce form p.form-row textarea,
.woocommerce .woocommerce-Input,
.woocommerce .input-text {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    background-color: #fff !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
    float: none !important;
    margin: 0 !important;
}

.woocommerce .woocommerce-form-row input:focus,
.woocommerce .woocommerce-form-row select:focus,
.woocommerce .woocommerce-form-row textarea:focus,
.woocommerce .form-row input:focus,
.woocommerce .form-row select:focus,
.woocommerce .form-row textarea:focus,
.woocommerce form .form-row input:focus,
.woocommerce form .form-row select:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form p.form-row input:focus,
.woocommerce form p.form-row select:focus,
.woocommerce form p.form-row textarea:focus,
.woocommerce .woocommerce-Input:focus,
.woocommerce .input-text:focus {
    outline: none !important;
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1) !important;
}

/* 禁用状态 */
.woocommerce .woocommerce-form-row input:disabled,
.woocommerce .form-row input:disabled,
.woocommerce form .form-row input:disabled,
.woocommerce form p.form-row input:disabled {
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* 密码显示/隐藏按钮容器 - 针对 span.password-input */
.woocommerce .woocommerce-form-row .password-input,
.woocommerce .form-row .password-input,
.woocommerce form .form-row .password-input,
.woocommerce form p.form-row .password-input,
.woocommerce .woocommerce-form-row .show-password-input,
.woocommerce .form-row .show-password-input,
.woocommerce form .form-row .show-password-input,
.woocommerce form p.form-row .show-password-input {
    position: relative !important;
    width: 100% !important;
    display: block !important;
}

.woocommerce .woocommerce-form-row .password-input input,
.woocommerce .form-row .password-input input,
.woocommerce form .form-row .password-input input,
.woocommerce form p.form-row .password-input input,
.woocommerce .woocommerce-form-row .show-password-input input,
.woocommerce .form-row .show-password-input input,
.woocommerce form .form-row .show-password-input input,
.woocommerce form p.form-row .show-password-input input {
    padding-right: 45px !important;
}

.woocommerce .woocommerce-form-row .password-input button,
.woocommerce .form-row .password-input button,
.woocommerce form .form-row .password-input button,
.woocommerce form p.form-row .password-input button,
.woocommerce .woocommerce-form-row .show-password-input button,
.woocommerce .form-row .show-password-input button,
.woocommerce form .form-row .show-password-input button,
.woocommerce form p.form-row .show-password-input button {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    font-size: 18px !important;
    color: #999 !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
}

/* 表单分组标题 */
.woocommerce .woocommerce-form-row legend,
.woocommerce fieldset legend,
.woocommerce form fieldset legend {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 16px !important;
    padding-bottom: 8px !important;
    border-bottom: 2px solid #e0e0e0 !important;
    width: 100% !important;
    float: none !important;
    text-align: left !important;
}

/* 密码修改区域 */
.woocommerce fieldset,
.woocommerce form fieldset {
    border: none !important;
    padding: 0 !important;
    margin: 32px 0 24px 0 !important;
    width: 100% !important;
}

/* 提示文本 - 包括 span 和 em */
.woocommerce .woocommerce-form-row em,
.woocommerce .form-row em,
.woocommerce form .form-row em,
.woocommerce form p.form-row em,
.woocommerce .woocommerce-form-row span em,
.woocommerce .form-row span em,
.woocommerce form .form-row span em,
.woocommerce form p.form-row span em {
    display: block !important;
    margin-top: 6px !important;
    font-size: 13px !important;
    color: #666 !important;
    font-style: normal !important;
    line-height: 1.5 !important;
    width: 100% !important;
    float: none !important;
    text-align: left !important;
}

/* 按钮样式 */
.woocommerce .woocommerce-Button,
.woocommerce .woocommerce-button,
.woocommerce button[type="submit"],
.woocommerce .button,
.woocommerce form button[type="submit"] {
    padding: 12px 32px !important;
    background-color: #007bff !important;
    color: white !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    line-height: 1.5 !important;
    margin-top: 10px !important;
}

.woocommerce .woocommerce-Button:hover,
.woocommerce .woocommerce-button:hover,
.woocommerce button[type="submit"]:hover,
.woocommerce .button:hover,
.woocommerce form button[type="submit"]:hover {
    background-color: #0056b3 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.woocommerce .woocommerce-Button:active,
.woocommerce .woocommerce-button:active,
.woocommerce button[type="submit"]:active,
.woocommerce form button[type="submit"]:active {
    transform: translateY(0);
}

/* 次要按钮 */
.woocommerce .woocommerce-Button--secondary {
    background-color: #f0f0f0 !important;
    color: #333 !important;
}

.woocommerce .woocommerce-Button--secondary:hover {
    background-color: #e0e0e0 !important;
}

/* ========== 消息提示 ========== */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.woocommerce-message {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.woocommerce-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.woocommerce-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
    .laifen-account-body {
        grid-template-columns: 1fr;
    }

    .laifen-account-nav {
        position: static;
    }

    .woocommerce-MyAccount-navigation ul {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .woocommerce-MyAccount-navigation a {
        text-align: center;
    }

    .woocommerce-Addresses {
        grid-template-columns: 1fr;
    }

    /* 表单响应式 - 包括 p 标签 */
    .woocommerce .woocommerce-form-row--first,
    .woocommerce .woocommerce-form-row--last,
    .woocommerce .form-row-first,
    .woocommerce .form-row-last,
    .woocommerce form .form-row-first,
    .woocommerce form .form-row-last,
    .woocommerce form p.form-row-first,
    .woocommerce form p.form-row-last,
    .woocommerce-page form p.form-row-first,
    .woocommerce-page form p.form-row-last {
        width: 100% !important;
        float: none !important;
    }
}

@media (max-width: 768px) {
    .laifen-my-account-page {
        padding: 20px 0;
    }

    .laifen-account-wrapper {
        padding: 0 15px;
    }

    .laifen-account-header {
        padding: 20px;
        margin-bottom: 20px;
    }

    .laifen-account-user-info {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .laifen-account-greeting h1 {
        font-size: 20px;
    }

    .laifen-account-content {
        padding: 20px;
    }

    .woocommerce-MyAccount-navigation ul {
        grid-template-columns: 1fr;
    }

    .woocommerce-orders-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .woocommerce-orders-table table {
        min-width: 600px;
    }

    .woocommerce-Addresses {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .laifen-account-avatar img {
        width: 48px;
        height: 48px;
    }

    .laifen-account-greeting h1 {
        font-size: 18px;
    }

    .laifen-account-greeting p {
        font-size: 13px;
    }

    .laifen-account-content {
        padding: 15px;
    }
}
