/* ============================================================
   QUERIチャットボット スタイルシート
   ============================================================ */

/* ---- リセット & ベース ---- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #0c1a30;
    overflow: hidden;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        background-color: #f0f2f5;
    }
}

/* ---- 動的背景（PC のみ）Gold × Deep Navy ---- */
@media (min-width: 769px) {
    .background-animation {
        position: fixed;
        inset: 0;
        z-index: 0;
        background: linear-gradient(145deg, #0a1628 0%, #0e1f3a 40%, #122344 70%, #0c1830 100%);
        overflow: hidden;
    }

    /* 深海のような光のグロウ */
    .background-animation::before {
        content: '';
        position: absolute;
        width: 200%;
        height: 200%;
        top: -50%;
        left: -50%;
        background-image:
            radial-gradient(ellipse at 20% 80%, rgba(180, 140, 60, 0.15) 0%, transparent 55%),
            radial-gradient(ellipse at 80% 18%, rgba(200, 160, 70, 0.12) 0%, transparent 50%),
            radial-gradient(ellipse at 50% 50%, rgba(26, 58, 107, 0.35) 0%, transparent 60%);
        animation: bgNavy 24s ease-in-out infinite;
    }

    /* ゴールドシーン（斜め光の帯） */
    .background-animation::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(
            118deg,
            transparent 0%,
            rgba(200, 160, 60, 0.04) 38%,
            rgba(220, 185, 80, 0.09) 50%,
            rgba(200, 160, 60, 0.04) 62%,
            transparent 100%
        );
        animation: goldSheen 9s ease-in-out infinite alternate;
    }

    @keyframes bgNavy {
        0%, 100% { transform: translate(0,    0)    rotate(0deg); }
        25%       { transform: translate(4%,   3%)   rotate(0.6deg); }
        50%       { transform: translate(-3%,  2%)   rotate(-0.6deg); }
        75%       { transform: translate(3%,  -4%)   rotate(0.3deg); }
    }

    @keyframes goldSheen {
        0%   { opacity: 0.4; transform: skewX(-5deg) translateX(-5%); }
        100% { opacity: 1;   transform: skewX(-5deg) translateX(5%); }
    }

    .floating-shapes { position: absolute; inset: 0; }

    /* ネイビー × ゴールドの光の輪 */
    .shape { position: absolute; border-radius: 50%; }

    .shape:nth-child(1) {
        width: 500px; height: 500px;
        top: -10%; left: -12%;
        background: radial-gradient(circle, rgba(180, 140, 55, 0.08) 0%, transparent 65%);
        animation: floatNav 22s ease-in-out infinite;
    }
    .shape:nth-child(2) {
        width: 380px; height: 380px;
        bottom: -8%; right: -8%;
        background: radial-gradient(circle, rgba(200, 155, 60, 0.10) 0%, transparent 65%);
        animation: floatNav 18s ease-in-out infinite 3s;
    }
    .shape:nth-child(3) {
        width: 260px; height: 260px;
        top: 35%; left: 15%;
        background: radial-gradient(circle, rgba(26, 62, 120, 0.50) 0%, transparent 65%);
        animation: floatNav 26s ease-in-out infinite 7s;
    }
    .shape:nth-child(4) {
        width: 320px; height: 160px;
        bottom: 22%; right: 10%;
        background: radial-gradient(ellipse, rgba(180, 140, 55, 0.07) 0%, transparent 65%);
        animation: floatNav 20s ease-in-out infinite 2s;
    }
    .shape:nth-child(5) {
        width: 200px; height: 200px;
        top: 55%; left: 55%;
        background: radial-gradient(circle, rgba(26, 58, 107, 0.45) 0%, transparent 65%);
        animation: floatNav 16s ease-in-out infinite 5s;
    }
    .shape:nth-child(6) {
        width: 300px; height: 140px;
        top: 15%; right: 18%;
        background: radial-gradient(ellipse, rgba(200, 165, 70, 0.08) 0%, transparent 65%);
        animation: floatNav 19s ease-in-out infinite 1s;
    }

    @keyframes floatNav {
        0%, 100% { transform: translate(0,     0)    rotate(0deg);  opacity: 0.8; }
        25%       { transform: translate(20px, -16px) rotate(2deg);  opacity: 1; }
        50%       { transform: translate(-12px, 12px) rotate(-2deg); opacity: 0.85; }
        75%       { transform: translate(12px,  20px) rotate(1.5deg); opacity: 1; }
    }

    /* ゴールドのスパークル（時計の光の反射） */
    .particles { position: absolute; inset: 0; }

    .particle {
        position: absolute;
        border-radius: 50%;
        background: rgba(210, 175, 80, 0.95);
        box-shadow: 0 0 4px rgba(220, 185, 80, 0.8);
    }

    .particle:nth-child(1)  { width:3px; height:3px; top:16%; left:11%;  animation: goldSpark 7s  ease-in-out infinite; }
    .particle:nth-child(2)  { width:2px; height:2px; top:38%; left:24%;  animation: goldSpark 9s  ease-in-out infinite 1.3s; }
    .particle:nth-child(3)  { width:4px; height:4px; top:60%; left:35%;  animation: goldSpark 8s  ease-in-out infinite 2.6s; }
    .particle:nth-child(4)  { width:2px; height:2px; top:75%; left:48%;  animation: goldSpark 10s ease-in-out infinite 0.7s; }
    .particle:nth-child(5)  { width:3px; height:3px; top:26%; right:14%; animation: goldSpark 8s  ease-in-out infinite 3.2s; }
    .particle:nth-child(6)  { width:2px; height:2px; top:50%; right:24%; animation: goldSpark 11s ease-in-out infinite 2.0s; }
    .particle:nth-child(7)  { width:4px; height:4px; top:70%; right:32%; animation: goldSpark 9s  ease-in-out infinite 1.0s; }
    .particle:nth-child(8)  { width:2px; height:2px; top:10%; left:58%;  animation: goldSpark 7s  ease-in-out infinite 4.2s; }
    .particle:nth-child(9)  { width:3px; height:3px; top:86%; left:68%;  animation: goldSpark 10s ease-in-out infinite 2.2s; }
    .particle:nth-child(10) { width:2px; height:2px; top:42%; right:44%; animation: goldSpark 8s  ease-in-out infinite 3.8s; }
    .particle:nth-child(11) { width:3px; height:3px; top:5%;  left:30%;  animation: goldSpark 9s  ease-in-out infinite 0.5s; }
    .particle:nth-child(12) { width:2px; height:2px; top:22%; left:72%;  animation: goldSpark 7s  ease-in-out infinite 1.8s; }
    .particle:nth-child(13) { width:4px; height:4px; top:48%; left:8%;   animation: goldSpark 11s ease-in-out infinite 3.0s; }
    .particle:nth-child(14) { width:2px; height:2px; top:82%; left:20%;  animation: goldSpark 8s  ease-in-out infinite 2.4s; }
    .particle:nth-child(15) { width:3px; height:3px; top:34%; left:80%;  animation: goldSpark 10s ease-in-out infinite 4.6s; }
    .particle:nth-child(16) { width:2px; height:2px; top:64%; left:90%;  animation: goldSpark 7s  ease-in-out infinite 1.1s; }
    .particle:nth-child(17) { width:4px; height:4px; top:8%;  right:38%; animation: goldSpark 9s  ease-in-out infinite 5.2s; }
    .particle:nth-child(18) { width:2px; height:2px; top:55%; right:8%;  animation: goldSpark 12s ease-in-out infinite 0.3s; }
    .particle:nth-child(19) { width:3px; height:3px; top:90%; right:18%; animation: goldSpark 8s  ease-in-out infinite 3.6s; }
    .particle:nth-child(20) { width:2px; height:2px; top:30%; left:50%;  animation: goldSpark 10s ease-in-out infinite 2.8s; }
    .particle:nth-child(21) { width:3px; height:3px; top:72%; left:62%;  animation: goldSpark 7s  ease-in-out infinite 1.5s; }
    .particle:nth-child(22) { width:2px; height:2px; top:18%; right:55%; animation: goldSpark 9s  ease-in-out infinite 4.0s; }
    .particle:nth-child(23) { width:4px; height:4px; top:92%; left:42%;  animation: goldSpark 11s ease-in-out infinite 0.8s; }
    .particle:nth-child(24) { width:2px; height:2px; top:46%; left:3%;   animation: goldSpark 8s  ease-in-out infinite 5.5s; }
    .particle:nth-child(25) { width:3px; height:3px; top:12%; right:8%;  animation: goldSpark 10s ease-in-out infinite 2.1s; }

    @keyframes goldSpark {
        0%,  100% { transform: scale(1)   translateY(0);     opacity: 0.15; }
        25%        { transform: scale(2.2) translateY(-14px); opacity: 1; }
        55%        { transform: scale(1.4) translateY(-30px); opacity: 0.7; }
        80%        { transform: scale(0.9) translateY(-20px); opacity: 0.9; }
    }
}

/* ---- チャットコンテナ ---- */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    position: relative;
    z-index: 1;
}

@media (min-width: 769px) {
    .chat-container {
        background-color: rgba(255, 255, 255, 0.96);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
        backdrop-filter: blur(10px);
    }
}

/* ---- ヘッダー ---- */
.chat-header {
    background: linear-gradient(135deg, #1a3a6b 0%, #2c5f9e 60%, #4a90d9 100%);
    color: #fff;
    padding: 14px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header .header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header .c-logo {
    text-decoration: none;
}

.chat-header .logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #fff;
    font-family: 'Georgia', serif;
}

.chat-header h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}

.chat-header .back-btn {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    transition: background 0.3s;
    white-space: nowrap;
}

.chat-header .back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .chat-header h1 { font-size: 13px; }
    .chat-header .logo-text { font-size: 18px; }
}

/* ---- メッセージエリア ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f0f2f5;
}

@media (min-width: 769px) {
    .chat-messages { background: transparent; }
}

/* ---- メッセージ共通 ---- */
.message {
    margin-bottom: 14px;
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message.user { justify-content: flex-end; }

.message.bot {
    justify-content: flex-start;
    align-items: flex-end;
    gap: 8px;
}

/* ---- ボットアイコン（小） ---- */
.message.bot .profile-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #4a90d9;
}

/* ---- メッセージバブル ---- */
.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 14px;
}

.message.user .message-content {
    background: linear-gradient(135deg, #1a3a6b 0%, #4a90d9 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    border: 1.5px solid #4a90d9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---- タイピングインジケーター ---- */
.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1.5px solid #4a90d9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    align-items: center;
    gap: 0;
}

.typing-indicator.active { display: flex; }

.typing-indicator .typing-text {
    font-size: 13px;
    color: #4a90d9;
    margin-right: 8px;
    font-weight: 500;
}

.typing-indicator .typing-dots {
    display: flex;
    align-items: center;
    gap: 3px;
}

.typing-indicator .typing-dots span {
    width: 7px;
    height: 7px;
    background: #4a90d9;
    border-radius: 50%;
    animation: bounce 1.3s linear infinite;
}

.typing-indicator .typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-indicator .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator .typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-8px); }
}

/* ---- 入力エリア ---- */
.chat-input-container {
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #dde3ea;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid #c8d4e0;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.25s;
    background: #f8fafc;
    resize: none;
    overflow-y: hidden;
    line-height: 1.5;
    font-family: inherit;
    min-height: 44px;
    max-height: 120px;
}

.chat-input:focus {
    border-color: #4a90d9;
    background: #fff;
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a6b 0%, #4a90d9 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s, box-shadow 0.3s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(74, 144, 217, 0.45);
}

.send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---- ウェルカムメッセージ ---- */
.welcome-message {
    text-align: center;
    padding: 36px 20px 30px;
    color: #555;
}

.welcome-message .operator-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid #4a90d9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.welcome-message .operator-name {
    font-size: 13px;
    color: #4a90d9;
    font-weight: 600;
    margin-bottom: 14px;
}

.welcome-message h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #1a3a6b;
}

.welcome-message p {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #666;
}

/* ---- クイック返信ボタン ---- */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.quick-reply-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1.5px solid #4a90d9;
    color: #4a90d9;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s;
    line-height: 1.4;
}

.quick-reply-btn:hover {
    background: #4a90d9;
    color: #fff;
}

/* ---- レスポンシブ ---- */
@media (max-width: 768px) {
    .chat-container    { max-width: 100%; }
    .message-content   { max-width: 85%; }
    .welcome-message   { padding: 24px 16px 20px; }
    .welcome-message .operator-icon { width: 80px; height: 80px; }
    .welcome-message h3 { font-size: 16px; }
}
