/**
 * Sophia Business Card System - Dynamic Background System
 * 動的3D背景システム - スタイルシート
 */

/* ========== 背景コンテナ（Three.js版） ========== */
#sesc-background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -999;
    overflow: hidden;
    pointer-events: none; /* コンテナ自体はクリック不可 */
}

/* Three.jsキャンバス（パーティクル・マウストレイル） */
#sesc-background-container canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: -1; /* コンテンツより後ろ、グラデーションより前 */
    pointer-events: auto; /* マウスイベントは受け取る */
}

/* ========== Canvas（旧2D版・非推奨） ========== */
#sesc-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 2;
}

/* ========== グラデーション背景レイヤー（最奥） ========== */
#sesc-gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* パーティクルより後ろ */
    transition: background 2s ease-in-out;
    will-change: background;
    pointer-events: none;
}

/* ========== クーポン通知 ========== */
#sesc-coupon-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    z-index: 10000;
    transform: translateX(450px);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

#sesc-coupon-notification.show {
    transform: translateX(0);
}

#sesc-coupon-notification.hidden {
    display: none;
}

/* 通知のタイトル */
.sesc-notification-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sesc-notification-icon {
    font-size: 1.5rem;
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 0.8; }
}

/* 通知のメッセージ */
.sesc-notification-message {
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0 0 12px 0;
    opacity: 0.95;
}

/* クーポンコード */
.sesc-coupon-code {
    background: rgba(255, 255, 255, 0.2);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 12px;
}

.sesc-coupon-code-text {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    margin: 0;
}

.sesc-coupon-discount {
    font-size: 0.875rem;
    opacity: 0.9;
    margin: 4px 0 0 0;
}

/* ボタングループ */
.sesc-notification-buttons {
    display: flex;
    gap: 8px;
}

.sesc-btn-copy,
.sesc-btn-share,
.sesc-btn-close {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sesc-btn-copy {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
}

.sesc-btn-copy:hover {
    background: white;
    transform: translateY(-2px);
}

.sesc-btn-share {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.sesc-btn-share:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sesc-btn-close {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex: 0.5;
}

.sesc-btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* コピー成功メッセージ */
.sesc-copy-success {
    font-size: 0.8125rem;
    color: #4ade80;
    text-align: center;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sesc-copy-success.show {
    opacity: 1;
}

/* ========== レアリティバッジ ========== */
.sesc-rarity-badge {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.sesc-rarity-badge.show {
    opacity: 1;
    transform: translateY(0);
}

.sesc-rarity-badge.common {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    color: #1e293b;
}

.sesc-rarity-badge.rare {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}

.sesc-rarity-badge.super-rare {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
}

.sesc-rarity-badge.ultra-rare {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.sesc-rarity-badge.legendary {
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #ec4899);
    color: white;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.8);
    animation: legendary-glow 2s ease-in-out infinite;
}

@keyframes legendary-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(251, 191, 36, 0.8); }
    50% { box-shadow: 0 0 50px rgba(251, 191, 36, 1); }
}

/* ========== レスポンシブ ========== */
@media (max-width: 768px) {
    #sesc-coupon-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        padding: 16px 20px;
    }

    .sesc-notification-title {
        font-size: 1.125rem;
    }

    .sesc-coupon-code-text {
        font-size: 1.25rem;
    }

    .sesc-notification-buttons {
        flex-direction: column;
    }

    .sesc-btn-copy,
    .sesc-btn-share,
    .sesc-btn-close {
        width: 100%;
    }

    .sesc-rarity-badge {
        bottom: 10px;
        left: 10px;
        font-size: 0.8125rem;
        padding: 6px 12px;
    }
}

/* ========== アクセシビリティ: アニメーション削減 ========== */
@media (prefers-reduced-motion: reduce) {
    #sesc-background-container,
    #sesc-canvas,
    #sesc-gradient-bg {
        animation: none !important;
        transition: none !important;
    }

    #sesc-coupon-notification {
        transition: opacity 0.3s ease;
    }

    .sesc-notification-icon {
        animation: none;
    }

    .sesc-rarity-badge.legendary {
        animation: none;
    }
}

/* ========== ローディング状態 ========== */
.sesc-bg-loading #sesc-canvas {
    opacity: 0;
}

.sesc-bg-loaded #sesc-canvas {
    opacity: 1;
    transition: opacity 1s ease-in-out;
}
