/**
 * Main Stylesheet for Jidouka Tool System Theme
 * @version 2.2.5 (Layout Fix Edition)
 */

/* --- 1. Variables & Globals --- */
:root {
    /* Colors */
    --color-background-start: #11131A;
    --color-background-end: #0c0d12;
    --color-surface: rgba(22, 25, 35, 0.5);
    --color-glass-border: rgba(255, 255, 255, 0.1);
    --color-text: #E0E5F0;
    --color-text-muted: #828a9b;
    --color-primary: #D4AF37;
    --color-primary-glow: rgba(212, 175, 55, 0.5);
    --color-primary-dark: #b89b31;
    --color-accent-blue: #37AEEF;
    --color-accent-glow: rgba(55, 174, 239, 0.4);
    --color-success: #37ef94;
    --color-error: #ef375a;

    /* Gradients */
    --gradient-primary: linear-gradient(45deg, var(--color-primary), var(--color-primary-dark));
    --gradient-accent: linear-gradient(45deg, var(--color-accent-blue), #2a86b5);
    
    /* Typography */
    --font-primary: 'Cormorant Garamond', serif;
    --font-secondary: 'Noto Sans JP', sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.8;

    /* Layout */
    --header-height: 70px;
    --mobile-nav-height: 65px;
    --border-radius: 12px;
    --transition-speed: 0.4s;
    --transition-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-background-start);
    background-image: linear-gradient(180deg, var(--color-background-start) 0%, var(--color-background-end) 100%);
    color: var(--color-text);
    font-family: var(--font-secondary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content {
    flex-grow: 1;
    width: 100%;
    padding-top: var(--header-height);
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    text-shadow: 0 2px 15px rgba(0,0,0,0.5);
}
h1 { font-size: 4rem; letter-spacing: -1px; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; }
p { margin-bottom: 1.5em; color: var(--color-text-muted); }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-speed) var(--transition-ease); }
a:hover { color: white; }
img { max-width: 100%; height: auto; display: block; }

/* --- 2. Animations & Keyframes --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 10px 0 var(--color-accent-glow), inset 0 0 5px 0 rgba(55, 174, 239, 0.3); } 50% { box-shadow: 0 0 25px 5px var(--color-accent-glow), inset 0 0 10px 2px rgba(55, 174, 239, 0.3); } 100% { box-shadow: 0 0 10px 0 var(--color-accent-glow), inset 0 0 5px 0 rgba(55, 174, 239, 0.3); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 3. Reusable Components --- */
.glass-surface { background: var(--color-surface); border: 1px solid var(--color-glass-border); border-radius: var(--border-radius); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); padding: 2rem; transition: all var(--transition-speed) var(--transition-ease); }
.jidouka-button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; font-family: var(--font-secondary); font-weight: 700; font-size: 1rem; padding: 14px 32px; border-radius: 8px; border: 1px solid transparent; text-decoration: none; transition: all var(--transition-speed) var(--transition-ease); position: relative; overflow: hidden; z-index: 1; }
.jidouka-button.primary { background: var(--gradient-primary); color: #111; border-color: var(--color-primary-dark); box-shadow: 0 4px 15px 0 var(--color-primary-glow); }
.jidouka-button.primary:hover { box-shadow: 0 6px 25px 0 var(--color-primary-glow); transform: translateY(-3px); color: black; }
.jidouka-button.secondary { background: transparent; color: var(--color-text); border-color: var(--color-glass-border); }
.jidouka-button.secondary:hover { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-primary); }
.jidouka-button.full-width { width: 100%; }
.jidouka-button.small { padding: 8px 16px; font-size: 0.9rem; }
.jidouka-button.large { padding: 18px 40px; font-size: 1.1rem; }
.jidouka-button svg { vertical-align: middle; }

input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], textarea { width: 100%; background-color: rgba(0,0,0,0.3); border: 1px solid var(--color-glass-border); border-radius: 8px; padding: 12px 16px; color: var(--color-text); font-family: var(--font-secondary); font-size: 1rem; transition: all var(--transition-speed) var(--transition-ease); }
input:focus, textarea:focus { outline: none; border-color: var(--color-accent-blue); box-shadow: 0 0 15px 0 var(--color-accent-glow); }

/* --- 4. Page Loader --- */
.page-loader { display: none; }

/* --- 5. Header --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    padding: 0 24px;
    background: transparent;
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease;
    border-bottom: 1px solid transparent;
}
.site-header.scrolled {
    background: rgba(17, 19, 26, 0.8);
    border-bottom-color: var(--color-glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.header-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-branding { flex-shrink: 0; }
.site-branding .custom-logo { max-height: 35px; width: auto; display: block; }
.site-branding .site-title, .site-branding .site-title a { color: #fff; font-size: 1.5rem; text-decoration: none; margin: 0; }

.main-navigation { margin: 0 auto; }
.main-navigation ul { list-style: none; display: flex; gap: 30px; margin: 0; padding: 0; }
.main-navigation a { color: var(--color-text-muted); font-weight: 500; position: relative; padding: 5px 0; text-decoration: none; }
.main-navigation a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--gradient-primary); transform: scaleX(0); transform-origin: right; transition: transform var(--transition-speed) var(--transition-ease); }
.main-navigation a:hover,
.main-navigation .current-menu-item > a { color: #fff; }
.main-navigation a:hover::after,
.main-navigation .current-menu-item > a::after { transform: scaleX(1); transform-origin: left; }

.header-actions { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.header-actions a { display: inline-flex; align-items: center; justify-content: center; }
.header-icon { width: 24px; height: 24px; color: var(--color-text-muted); transition: all var(--transition-speed) var(--transition-ease); }
.header-actions a:hover .header-icon { color: white; transform: scale(1.1); }
.header-cart-link { position: relative; }
.cart-count { position: absolute; top: -5px; right: -10px; background: var(--gradient-primary); color: black; font-size: 10px; font-weight: bold; border-radius: 50%; width: 18px; height: 18px; display: flex; justify-content: center; align-items: center; line-height: 1; }
.login-button svg { margin-right: 8px; }

/* --- 6. Footer --- */
.site-footer { padding: 4rem 0; background: var(--color-background-end); border-top: 1px solid var(--color-glass-border); margin-top: 6rem; }
.footer-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 2rem; }
.site-info { color: var(--color-text-muted); }
.footer-nav ul { list-style: none; display: flex; gap: 2rem; margin: 0; padding: 0;}
.footer-nav a { color: var(--color-text-muted); }

/* --- 7. Page Headers & Heroes --- */
.page-header-hero { padding: 8rem 0; text-align: center; position: relative; overflow: hidden; margin-bottom: 6rem; }
.page-header-hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.1), transparent 70%); opacity: 0; animation: fadeIn 1s ease-out forwards; animation-delay: 0.2s; }
.page-title, .page-subtitle { animation: fadeInUp 1s var(--transition-ease) forwards; }
.page-title { margin-bottom: 0.5rem; animation-delay: 0.3s; }
.page-subtitle { font-size: 1.2rem; color: var(--color-text-muted); max-width: 600px; margin: 0 auto; animation-delay: 0.5s; }

/* --- 8. Product Grid & Cards --- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px; }
.product-card { background: var(--color-surface); border: 1px solid var(--color-glass-border); border-radius: var(--border-radius); overflow: hidden; transition: all var(--transition-speed) var(--transition-ease); transform: translateZ(0); position: relative; }
.product-card:hover { transform: translateY(-10px) scale(1.02); box-shadow: 0 20px 50px rgba(0,0,0,0.5); border-color: var(--color-primary-glow); }
.product-card__link { display: block; color: inherit; text-decoration: none; }
.product-card__image-wrapper { position: relative; overflow: hidden; background-color: #000; aspect-ratio: 16 / 9; }
.product-card__image-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--transition-ease); }
.product-card:hover .product-card__image-wrapper img { transform: scale(1.1); }
.product-card__content { padding: 1.5rem; text-align: left; }
.product-card__title { font-size: 1.5rem; margin: 0 0 10px; color: #fff; }
.product-card__price { font-size: 1.4rem; font-weight: 700; color: var(--color-primary); }

/* --- 9. Single Product Page --- */
.single-product-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: flex-start; margin-top: 4rem; }
.product-gallery img { border-radius: var(--border-radius); border: 1px solid var(--color-glass-border); box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.product-summary { position: sticky; top: calc(var(--header-height) + 50px); }
.product-title { font-size: 3.5rem; line-height: 1.2; }
.product-price { font-size: 2.5rem; font-family: var(--font-primary); font-weight: 700; margin: 1rem 0 1.5rem; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.product-content { color: var(--color-text-muted); font-size: 1.1rem; line-height: 1.8; }
.purchase-buttons { margin-top: 2.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* --- 10. Cart & Checkout --- */
.cart-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; align-items: flex-start; }
.cart-item { display: flex; gap: 1.5rem; padding: 1.5rem 0; border-bottom: 1px solid var(--color-glass-border); align-items: center; }
.cart-item__image { flex-shrink: 0; width: 120px; height: 67px; overflow: hidden; border-radius: 8px; }
.cart-item__image img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__info { flex-grow: 1; }
.cart-item__info h3 { font-size: 1.2rem; margin: 0; }
.cart-item__info h3 a { color: var(--color-text); }
.cart-item__info h3 a:hover { color: var(--color-primary); }
.cart-item__price { color: var(--color-text-muted); }
.remove-from-cart-btn { background: none; border: none; color: var(--color-text-muted); font-size: 1.5rem; cursor: pointer; transition: all 0.3s ease; }
.remove-from-cart-btn:hover { color: var(--color-error); transform: scale(1.2); }
.cart-summary { position: sticky; top: calc(var(--header-height) + 50px); }
.cart-summary h2 { margin-top: 0; font-size: 1.8rem; }
.cart-summary-row { display: flex; justify-content: space-between; padding: 1rem 0; border-bottom: 1px solid var(--color-glass-border); }
.cart-summary-row.total { font-size: 1.2rem; font-weight: 700; color: #fff; }
.coupon-area { padding: 1rem 0; }
.coupon-form { display: flex; gap: 0.5rem; }
.coupon-form input { border-radius: 6px; }
.coupon-form button { padding: 12px 16px; border-radius: 6px; border: none; background: var(--gradient-accent); color: #fff; font-weight: 500; cursor: pointer; }
.applied-coupon { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); padding: 0.5rem 1rem; border-radius: 6px; }
.applied-coupon .remove-coupon-btn { background: none; border: none; color: var(--color-text-muted); cursor: pointer; }
.cart-empty { text-align: center; padding: 4rem; }
.checkout-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; align-items: flex-start; }
.checkout-section { margin-bottom: 3rem; }
.checkout-section__title { font-size: 1.8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--color-glass-border); padding-bottom: 0.5rem; }
.checkout-form .form-row { margin-bottom: 1.5rem; }
.checkout-form label { display: block; margin-bottom: .5rem; font-weight: 500; }
#payment-methods .payment-method { margin-bottom: 1rem; }
#payment-methods label { font-size: 1.1rem; font-weight: 500; display: flex; align-items: center; gap: 0.8rem; padding: 1rem; background: var(--color-surface); border: 1px solid var(--color-glass-border); border-radius: 8px; cursor: pointer; }
#payment-methods input[type="radio"] { display: none; }
#payment-methods input[type="radio"]:checked + label { border-color: var(--color-accent-blue); box-shadow: 0 0 15px 0 var(--color-accent-glow); }
.payment-method__box { padding: 1.5rem; border: 1px solid var(--color-glass-border); border-top: none; border-radius: 0 0 8px 8px; display: none; margin-top: -1rem; }
#payment-methods input[type="radio"]:checked + label + .payment-method__box { display: block; }
#stripe-card-element { margin-top: 1rem; padding: 12px; border: 1px solid var(--color-glass-border); border-radius: 6px; }
.order-summary { position: sticky; top: calc(var(--header-height) + 50px); }
#checkout-errors { display: none; background-color: rgba(239, 55, 90, 0.2); border: 1px solid var(--color-error); color: var(--color-error); padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; }

/* --- 11. My Account Pages --- */
.my-account-content .glass-surface { margin-bottom: 2rem; }
.order-item__header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.order-item__title { font-size: 1.5rem; color: #fff; margin: 0; }
.order-item__meta { display: flex; gap: 1.5rem; color: var(--color-text-muted); align-items: center; }
.order-item__total { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); }
.order-product { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; background: rgba(0,0,0,0.2); border-radius: 6px; margin-bottom: 0.5rem; }
.order-product__name { flex-grow: 1; }
.coupons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.coupon-card { text-align: center; background: linear-gradient(45deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.05)); border: 1px solid var(--color-primary-glow); padding: 1.5rem; border-radius: 8px; }

/* --- 12. Toast Notifications --- */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 20px; border-radius: 8px; color: #fff; font-weight: 500; box-shadow: 0 5px 20px rgba(0,0,0,0.4); opacity: 0; transform: translateY(20px); transition: opacity 0.5s var(--transition-ease), transform 0.5s var(--transition-ease); }
.toast.show { opacity: 1; transform: translateY(0); } /* JSでクラスを付与してアニメーション */
.toast--success { background: linear-gradient(45deg, var(--color-success), #2cb675); }
.toast--error { background: linear-gradient(45deg, var(--color-error), #c92f4a); }

/* --- 13. Mobile Bottom Navigation --- */
.mobile-bottom-nav {
    display: none; /* デフォルトは非表示 */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--color-surface);
    border-top: 1px solid var(--color-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    justify-content: space-around;
}
.mobile-bottom-nav__link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    color: var(--color-text-muted);
    padding: 5px 0;
    transition: all 0.2s ease-in-out;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}
.mobile-bottom-nav__link svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    transition: all 0.2s ease-in-out;
}
.mobile-bottom-nav__link span {
    font-size: 10px;
    font-weight: 500;
}
.mobile-bottom-nav__link:hover,
.mobile-bottom-nav__link.current {
    color: var(--color-primary);
}
.mobile-bottom-nav__link:active svg {
    transform: scale(0.9);
}

/* --- 14. Responsive Design --- */
@media (max-width: 992px) {
    h1 { font-size: 3rem; }
    .single-product-layout, .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
    .product-summary, .cart-summary, .order-summary { position: static; margin-top: 2rem; }
}

@media (max-width: 768px) {
    body {
        padding-bottom: var(--mobile-nav-height);
    }
    .site-content {
        padding-top: 60px;
    }
    
    h1 { font-size: 2.2rem; }
    .page-header-hero { padding: 6rem 0; margin-bottom: 4rem; }
    
    .site-header {
        height: 60px;
    }
    .header-container {
        justify-content: space-between;
    }
    .main-navigation {
        display: none;
    }
    .header-actions .login-button,
    .header-actions .user-account-link {
        display: none;
    }
    .site-branding .site-title {
        font-size: 1.2rem;
    }
    .purchase-buttons { grid-template-columns: 1fr; }
    .footer-container { flex-direction: column; text-align: center; }
    
    .mobile-bottom-nav {
        display: flex;
    }
    #toast-container {
        bottom: calc(var(--mobile-nav-height) + 20px);
        right: 10px;
        left: 10px;
        align-items: center;
        width: auto;
    }
}

@media (max-width: 380px) { /* 画面幅が特に狭いスマートフォン向け */
    .mobile-bottom-nav__link span {
        font-size: 9px;
        white-space: nowrap;
    }
}