/* ============================================
   グローバルスタイル
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ============================================
   チャットコンテナ
   ============================================ */
.chat-container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 900px;
}

/* ============================================
   チャットヘッダー
   ============================================ */
.chat-header {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.header-logo {
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
}

.logo-catchcopy {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.header-logo img {
    height: 28px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* テキストロゴのスタイル */
.header-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 1px;
}

.header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-icon svg {
    width: 20px;
    height: 20px;
}

.header-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-subtitle {
    font-size: 11px;
    opacity: 0.95;
    font-weight: 500;
    order: 1;
    margin-bottom: 2px;
}

.header-text h1 {
    font-size: 16px;
    font-weight: 700;
    order: 2;
    margin: 0;
}

/* ============================================
   トースト通知
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    animation: slideDown 0.3s ease-out;
    pointer-events: auto;
    border-left: 4px solid;
}

.toast.error {
    border-left-color: #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #ffffff 100%);
}

.toast.success {
    border-left-color: #4CAF50;
    background: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%);
}

.toast.warning {
    border-left-color: #ff9800;
    background: linear-gradient(135deg, #fff3e0 0%, #ffffff 100%);
}

.toast.info {
    border-left-color: #2196F3;
    background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.toast.error .toast-title {
    color: #d32f2f;
}

.toast.success .toast-title {
    color: #388e3c;
}

.toast.warning .toast-title {
    color: #f57c00;
}

.toast.info .toast-title {
    color: #1976D2;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.fadeOut {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ============================================
   進捗ドットインジケーター
   ============================================ */
.progress-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border-bottom: 1px solid #e0e0e0;
    gap: 8px;
    flex-shrink: 0;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.3s;
}

.progress-dot.completed {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.progress-dot.current {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
    animation: pulse 2s infinite;
}

.progress-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    margin-left: 8px;
}

/* ============================================
   チャットメッセージエリア
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-items: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.bot .message-avatar {
    background: #ffffff;
    border: 2px solid #e3f2fd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-content {
    max-width: 70%;
}

.message.bot .message-bubble {
    background: white;
    color: #333;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.message-bubble p {
    line-height: 1.5;
    font-size: 14px;
}

/* ============================================
   入力エリア
   ============================================ */
.chat-input-container {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.input-group {
    margin-bottom: 16px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Noto Sans JP', sans-serif;
    transition: all 0.3s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 50px;
    max-height: 60px;
}

/* 横並び入力フォーム */
.input-with-button {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-button .input-group {
    flex: 1;
    margin-bottom: 0;
}

.input-with-button .btn {
    flex-shrink: 0;
    min-width: 80px;
    margin: 0;
}

/* テキストエリアと送信ボタンの横並び */
.input-with-inline-button {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-inline-button .input-group {
    flex: 1;
    margin-bottom: 0;
}

.input-with-inline-button .btn {
    flex-shrink: 0;
    min-width: 70px;
    margin: 0;
    align-self: stretch;
}

/* 選択肢ボタン */
.options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.option-btn {
    padding: 10px 12px;
    background: white;
    border: 2px solid #2196F3;
    color: #2196F3;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Noto Sans JP', sans-serif;
}

.option-btn:hover {
    background: #2196F3;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* 緊急電話ボタン */
.emergency-call-btn {
    display: block;
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #ff5722 0%, #f44336 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    margin: 16px 0;
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
    transition: all 0.3s;
    animation: pulse 2s infinite;
}

.emergency-call-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(244, 67, 54, 0.5);
}

.emergency-call-btn .phone-icon {
    font-size: 24px;
    margin-right: 8px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 6px 30px rgba(244, 67, 54, 0.6);
    }
}

/* お客様の声カード */
.review-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #4CAF50;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.review-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.review-stars {
    color: #FFC107;
    font-size: 14px;
}

.review-comment {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 4px;
}

.review-area {
    font-size: 11px;
    color: #999;
}

/* 資格バッジ */
.certification-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.cert-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cert-badge::before {
    content: "✓";
    font-weight: bold;
}

/* 送信ボタン */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Noto Sans JP', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   営業時間表示
   ============================================ */
.business-hours {
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    flex-shrink: 0;
}

.business-hours p {
    font-size: 12px;
    color: #333;
    margin: 3px 0;
    font-weight: 500;
}

.business-hours a {
    color: #2196F3;
    font-weight: 700;
}

/* ============================================
   モーダル
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    font-size: 22px;
    margin-bottom: 24px;
    color: #333;
}

.confirm-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.detail-row {
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-buttons .btn {
    flex: 1;
}

/* 完了モーダル */
.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 24px;
    animation: successPop 0.5s ease-out;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.modal-content p {
    text-align: center;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* ============================================
   ローディング
   ============================================ */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(4px);
}

.loading.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    color: white;
    font-size: 16px;
}

/* ============================================
   検索機能
   ============================================ */
.search-tag {
    background: white;
    color: #1976D2;
    border: 1px solid #90caf9;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.search-tag:hover {
    background: #2196F3;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* 下部アクションバーのレスポンシブ対応 */
@media (max-width: 480px) {
    #searchToggleBtn, 
    a[href="tel:0120778114"] {
        font-size: 13px !important;
        padding: 10px 12px !important;
    }
}

/* ============================================
   リアルタイム通知アニメーション
   ============================================ */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.notification-fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* ============================================
   レスポンシブ対応
   ============================================ */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .chat-container {
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }

    .chat-header {
        padding: 10px 16px;
        flex-wrap: wrap;
    }

    .header-left {
        flex: 1;
    }

    .header-text h1 {
        font-size: 16px;
    }

    .header-subtitle {
        font-size: 12px;
    }

    .header-logo img {
        height: 30px;
    }

    .logo-catchcopy {
        font-size: 8px;
    }

    .progress-container {
        padding: 6px 12px;
    }

    .chat-messages {
        padding: 12px;
    }

    .message-content {
        max-width: 80%;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .options-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 24px;
        margin: 20px;
    }

    .business-hours p {
        font-size: 11px;
        margin: 2px 0;
    }

    /* 受付件数通知のレスポンシブ対応 */
    #inquiriesNotification {
        font-size: 10px !important;
        padding: 6px 10px !important;
        gap: 6px !important;
        flex-direction: column !important;
    }

    #inquiriesNotification > div {
        font-size: 10px;
        border-left: none !important;
        padding-left: 0 !important;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 6px 10px;
    }

    .header-icon {
        width: 28px;
        height: 28px;
    }

    .header-icon svg {
        width: 18px;
        height: 18px;
    }

    .header-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .header-text h1 {
        font-size: 12px;
    }

    .header-subtitle {
        font-size: 9px;
        line-height: 1.3;
    }

    .header-logo img {
        height: 24px;
    }

    .logo-catchcopy {
        font-size: 8px;
    }

    .header-logo-text {
        font-size: 16px;
    }

    /* 通知バーのスマホ最適化 */
    #inquiriesNotification {
        font-size: 9px !important;
        padding: 4px 8px !important;
        gap: 4px !important;
    }

    #realtimeNotification {
        font-size: 9px !important;
        padding: 4px 8px !important;
    }

    #remainingSlotsNotification {
        font-size: 9px !important;
        padding: 4px 8px !important;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
    }

    .business-hours p {
        font-size: 12px;
    }
}

/* ============================================
   営業時間外メッセージの点滅アニメーション
   ============================================ */
.blink-text {
    animation: blink 1.5s ease-in-out infinite;
    font-weight: 600;
    display: inline-block;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}
