/**
 * KURO マイアカウントページ カスタムスタイル
 * 
 * @package KURO
 * @since 0.5
 */

/* ページ全体の背景色 */
body.woocommerce-account {
    background-color: #F5F2EC !important;
}

/* マイアカウントページのメインタイトルをカスタマイズ（ログインフォームと同じスタイル） */
.woocommerce-account .entry-title,
.woocommerce-account h1.page-title {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif !important;
    font-weight: 500 !important;
    text-align: center !important;
    margin: 0 0 25px 0 !important;
    font-size: 24px !important;
    color: #333333 !important;
    border-bottom: 2px solid #f0f0f0 !important;
    padding-bottom: 15px !important;
}

/* 非ログイン時はタイトルを完全に非表示 */
body.woocommerce-account:not(.logged-in) .entry-title:empty,
body.woocommerce-account:not(.logged-in) h1.page-title:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* ログインフォーム全体のコンテナ */
.woocommerce .kuro-login-container,
.kuro-login-container {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif !important;
    font-weight: 500 !important;
    line-height: 1.4em !important;
    letter-spacing: 0.05em !important;
    max-width: 400px !important;
    margin: 40px auto !important;
    padding: 20px !important;
}

/* 2カラムレイアウト対応 */
.kuro-login-container .col2-set {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.kuro-login-container .col2-set .col-1,
.kuro-login-container .col2-set .col-2 {
    flex: 1;
    min-width: 340px;
}

/* ログインフォーム・登録フォーム共通 */
.woocommerce .kuro-login-form,
.woocommerce .kuro-register-form,
.kuro-login-form,
.kuro-register-form {
    background: #ffffff !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 30px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

/* タイトル */
.kuro-login-title {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-weight: 500;
    line-height: 1.4em;
    letter-spacing: 0.05em;
    text-align: center;
    margin: 0 0 25px 0;
    font-size: 24px;
    color: #333333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

/* フォームグループ */
.kuro-form-group {
    margin-bottom: 20px;
}

/* ラベル */
.kuro-form-label {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-weight: 500;
    line-height: 1.4em;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
    color: #555555;
    font-size: 14px;
}

.kuro-form-label .required {
    color: #ff5757;
    font-weight: 700;
    margin-left: 2px;
}

/* 入力フィールド */
.kuro-form-input {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-weight: 500;
    line-height: 1.4em;
    letter-spacing: 0.05em;
    width: 100%;
    padding: 12px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    background: #ffffff;
}

.kuro-form-input:focus {
    outline: none;
    border-color: #666666;
    box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.1);
}

/* ログインボタン */
.kuro-login-button {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-weight: 500;
    line-height: 1.4em;
    letter-spacing: 0.05em;
    width: 100%;
    padding: 14px;
    background-color: #333333;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    text-transform: none;
}

.kuro-login-button:hover {
    background-color: #555555;
    transform: translateY(-1px);
}

.kuro-login-button:active {
    transform: translateY(0);
}

/* チェックボックスグループ */
.kuro-remember-group {
    margin-bottom: 25px;
}

.kuro-checkbox-label {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-size: 14px;
    color: #666666;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.kuro-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* リンク */
.kuro-form-links {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.kuro-forgot-password {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-weight: 500;
    line-height: 1.4em;
    letter-spacing: 0.05em;
    color: #666666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.kuro-forgot-password:hover {
    color: #333333;
    text-decoration: underline;
}

/* パスワード情報 */
.kuro-password-info {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-size: 14px;
    color: #666666;
    margin-bottom: 20px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #ffc107;
}

/* WooCommerce通知のカスタマイズ */
.woocommerce-notices-wrapper {
    max-width: 900px;
    margin: 0 auto 20px;
}

.woocommerce-error,
.woocommerce-info,
.woocommerce-message {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.woocommerce-error {
    background-color: #fff5f5;
    border-left: 4px solid #ff5757;
    color: #d32f2f;
}

.woocommerce-info {
    background-color: #fff9e6;
    border-left: 4px solid #ffc107;
    color: #f57c00;
}

.woocommerce-message {
    background-color: #f0f8ff;
    border-left: 4px solid #2196f3;
    color: #1565c0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .kuro-login-container .col2-set {
        flex-direction: column;
    }
    
    .kuro-login-container .col2-set .col-1,
    .kuro-login-container .col2-set .col-2 {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .kuro-login-container {
        padding: 10px;
    }
    
    .kuro-login-form,
    .kuro-register-form {
        padding: 20px;
    }
    
    .kuro-login-title {
        font-size: 20px;
    }
    
    .kuro-form-input {
        font-size: 14px;
        padding: 10px;
    }
    
    .kuro-login-button {
        padding: 12px;
        font-size: 14px;
    }
}

/* 既存のWooCommerceスタイルの上書き */
.woocommerce-account .woocommerce-form-login,
.woocommerce-account .woocommerce-form-register {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* エラー時のフィールドハイライト */
.kuro-form-input.woocommerce-invalid {
    border-color: #ff5757;
}

.kuro-form-input.woocommerce-invalid:focus {
    border-color: #ff5757;
    box-shadow: 0 0 0 3px rgba(255, 87, 87, 0.1);
}

/* ローディング状態 */
.kuro-login-button.loading {
    position: relative;
    color: transparent;
}

.kuro-login-button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: kuro-spinner 0.6s linear infinite;
}

@keyframes kuro-spinner {
    to { transform: rotate(360deg); }
}

/* アカウントダッシュボードのカスタマイズ */
.woocommerce-account .woocommerce-MyAccount-navigation {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    padding: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul {
    margin: 0;
    padding: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li {
    border-bottom: 1px solid #e0e0e0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li:last-child {
    border-bottom: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    color: #666666;
    padding: 15px 20px;
    display: block;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover {
    background: #333333;
    color: #ffffff;
}

/* WooCommerceデフォルトのパスワード表示ボタンを非表示 */
.woocommerce form .show-password-input {
    display: none !important;
}

/* カスタムパスワードトグルボタン（WordPressスタイル） */
.kuro-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.2s ease !important;
    opacity: 0.5;
}

.kuro-password-toggle:hover {
    opacity: 0.8;
}

.kuro-password-toggle:focus {
    outline: 1px dotted #666666;
    outline-offset: 2px;
}

/* パスワードトグルアイコン（シンプルな目のアイコン） */
.kuro-password-toggle::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23666666'%3E%3Cpath d='M10 12a2 2 0 100-4 2 2 0 000 4z'/%3E%3Cpath fill-rule='evenodd' d='M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* パスワードが表示されている時のアイコン（斜線付き） */
.kuro-password-toggle.password-visible::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23666666'%3E%3Cpath fill-rule='evenodd' d='M3.707 2.293a1 1 0 00-1.414 1.414l14 14a1 1 0 001.414-1.414l-1.473-1.473A10.014 10.014 0 0019.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 00-4.512 1.074l-1.78-1.781zm4.261 4.26l1.514 1.515a2.003 2.003 0 012.45 2.45l1.514 1.514a4 4 0 00-5.478-5.478z' clip-rule='evenodd'/%3E%3Cpath d='M12.454 16.697L9.75 13.992a4 4 0 01-3.742-3.741L2.335 6.578A9.98 9.98 0 00.458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303z'/%3E%3C/svg%3E");
}

/* パスワード入力フィールドの調整 */
.kuro-form-group {
    position: relative;
}

.kuro-form-group .kuro-form-input[type="password"],
.kuro-form-group .kuro-form-input[type="text"].password-field {
    padding-right: 40px !important;
}

/* パスワード強度インジケーター */
.kuro-password-strength {
    font-size: 12px;
    margin-top: 5px;
    padding: 5px 10px;
    border-radius: 3px;
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
}

.kuro-password-strength.weak {
    background: #ffebee;
    color: #c62828;
}

.kuro-password-strength.medium {
    background: #fff3e0;
    color: #ef6c00;
}

.kuro-password-strength.strong {
    background: #e8f5e9;
    color: #2e7d32;
}

/* フィールドエラー表示 */
.kuro-field-error {
    display: block;
    color: #ff5757;
    font-size: 12px;
    margin-top: 5px;
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
}

/* カスタム通知メッセージ */
.kuro-login-notice,
.kuro-register-notice {
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-bottom: 20px;
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
    font-size: 14px;
    color: #666666;
}

.kuro-register-notice {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.kuro-register-notice p {
    margin: 0 0 10px 0;
}

.kuro-register-notice p:last-child {
    margin-bottom: 0;
}

/* カートボタン下の余白 */
.single_add_to_cart_button {
    margin-bottom: 30px !important;
}

/* 注文履歴が空の時のスタイル */
.woocommerce-account .woocommerce-message,
.woocommerce-account .woocommerce-info {
    background: #f9f9f9 !important;
    border-left: 4px solid #ccc !important;
    color: #666666 !important;
    padding: 15px !important;
    margin: 20px 0 !important;
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif !important;
}

/* 「商品を見る」ボタンや不要な要素を非表示 */
.woocommerce-account .woocommerce-message a.button,
.woocommerce-account .woocommerce-info a.button,
.woocommerce-account .woocommerce-message::before,
.woocommerce-account .woocommerce-info::before,
.woocommerce-account .woocommerce-orders-table::before,
.woocommerce-account .woocommerce-Message::before,
.woocommerce-account .woocommerce-message:before,
.woocommerce-account .woocommerce-info:before {
    display: none !important;
}

/* パスワード変更リンクのスタイル */
.woocommerce-account fieldset legend {
    color: #27ae60 !important;
    font-weight: 600 !important;
    cursor: pointer;
}

.woocommerce-account fieldset legend:hover {
    color: #229954 !important;
}

/* 住所コピーチェックボックス */
.kuro-copy-address {
    background: #f0f8ff;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    border: 1px solid #d1e7f3;
}

.kuro-copy-address label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: 'Sawarabi Mincho', 'Noto Serif JP', serif;
}

.kuro-copy-address input[type="checkbox"] {
    margin-right: 10px;
}
