/* カスタムスタイル */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* スムーズなスクロール */
html {
    scroll-behavior: smooth;
}

/* チャットメッセージのアニメーション */
#chatMessages > div {
    animation: fadeInUp 0.3s ease-out;
}

#chatArea {
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 92vh;
}

#chatMessages {
    flex: 1;
    min-height: 360px;
}

.typing-indicator-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #4b5563;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.15);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #fa6e78;
    animation: typingDots 1s infinite ease-in-out;
    opacity: 0.4;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

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

/* カードホバー効果 */
.bg-white.rounded-lg.shadow-lg {
    transition: all 0.3s ease;
}

.bg-white.rounded-lg.shadow-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ボタンのホバー効果 */
button {
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 入力フィールドのフォーカス効果 */
input:focus,
textarea:focus {
    transform: scale(1.01);
    transition: transform 0.2s ease;
}

/* 推薦カードのスタイル */
#recommendationsList > div {
    animation: slideInFromBottom 0.5s ease-out;
    border-left: 4px solid #fa6e78;
    transition: all 0.3s ease;
}

#recommendationsList > div:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 25px -5px rgba(250, 110, 120, 0.25);
}

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

/* ブランドカラーユーティリティ */
.bg-mosh-primary,
.btn-mosh-primary {
    background: linear-gradient(135deg, #fa6e78, #ff9066);
    color: #ffffff;
}

.bg-mosh-primary-solid {
    background-color: #fa6e78;
    color: #ffffff;
}

.border-mosh-primary {
    border-color: #fa6e78 !important;
}

.text-mosh-primary {
    color: #fa6e78;
}

.btn-mosh-primary {
    border: none;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 12px 26px -18px rgba(250, 110, 120, 0.35);
}

.btn-mosh-primary:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #ed446c, #fa6e78);
}

.btn-mosh-primary:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
    background: linear-gradient(135deg, rgba(250, 110, 120, 0.55), rgba(250, 110, 120, 0.6));
    box-shadow: none;
}

.bubble-mosh-primary {
    background: linear-gradient(135deg, #fa6e78, #ff9066);
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(250, 110, 120, 0.3);
}

/* スペシャルティタグのスタイル */
.bg-purple-100.text-purple-800 {
    transition: all 0.2s ease;
}

.bg-purple-100.text-purple-800:hover {
    background-color: #fa6e78;
    color: white;
    transform: scale(1.05);
}

/* 通知のアニメーション */
.fixed.top-4.right-4 {
    animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* チャットバブルのスタイル強化 */
#chatMessages .bubble-mosh-primary {
    background: linear-gradient(135deg, #fa6e78, #ff9066);
    box-shadow: 0 4px 12px rgba(250, 110, 120, 0.35);
}

#chatMessages .bg-gray-200 {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #374151;
}

/* スクロールバーのカスタマイズ */
#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* グラデーション背景 */
.bg-gradient-to-br {
    background: linear-gradient(135deg, #faf5ff 0%, #fdf2f8 100%);
    min-height: 100vh;
}

/* アイコンのアニメーション */
.fa-robot {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* レスポンシブデザインの調整 */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .grid.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }

    #chatLayout {
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
    }

    #chatContainer {
        max-width: none;
        width: 100%;
        height: 100vh;
        padding: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    #chatContainer > * {
        margin-top: 0 !important;
    }
    
    #chatArea {
        flex: 1;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #chatMessages {
        min-height: 0;
    }
    
    .flex.gap-3 {
        flex-direction: column;
        gap: 0.5rem;
    }

    .flex.gap-3 textarea {
        width: 100%;
    }
    
    .max-w-xs {
        max-width: 95%;
    }

    .send-label {
        display: none;
    }
}

/* ダークモード対応（将来の拡張用） */
@media (prefers-color-scheme: dark) {
    /* ダークモードのスタイルをここに追加 */
}

/* 印刷用スタイル */
@media print {
    #chatArea,
    #recommendationsArea {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    button {
        display: none;
    }
    
    .bg-gradient-to-br {
        background: white;
    }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .btn-mosh-primary,
    .bg-mosh-primary,
    .bg-mosh-primary-solid,
    .bubble-mosh-primary {
        background-color: #fa6e78 !important;
        background-image: none !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

    .text-mosh-primary {
        color: #fa6e78 !important;
    }
    
    .text-gray-600 {
        color: #000 !important;
    }
    
    .border {
        border-width: 2px !important;
    }
}

/* 動きを減らす設定への対応 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* フォーカス表示の改善 */
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid #fa6e78;
    outline-offset: 2px;
}

/* エラー状態のスタイル */
.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.error:focus {
    outline-color: #ef4444;
}

/* 成功状態のスタイル */
.success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.success:focus {
    outline-color: #10b981;
}

/* 警告状態のスタイル */
.warning {
    border-color: #f59e0b;
    background-color: #fffbeb;
}

.warning:focus {
    outline-color: #f59e0b;
}

/* ローディング状態 */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ツールチップスタイル */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

.quick-replies {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-replies__button {
    background: linear-gradient(135deg, #fa6e78, #ff8f70);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 10px 24px -12px rgba(250, 110, 120, 0.6);
}

.quick-replies__button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -12px rgba(250, 110, 120, 0.65);
}

.quick-replies__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.uploaded-image {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 12px;
    margin-top: 8px;
}

.upload-caption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #1f2937;
}

.image-upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    z-index: 10000;
}

.image-upload-modal {
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 24px 60px -24px rgba(47, 63, 92, 0.35);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.image-upload-modal h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.image-upload-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.image-upload-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-upload-option:hover {
    border-color: #fa6e78;
    box-shadow: 0 12px 30px -20px rgba(250, 110, 120, 0.6);
}

.image-upload-option img {
    width: 100%;
    border-radius: 10px;
    background: #f9fafb;
}

.image-upload-option span {
    font-size: 0.85rem;
    color: #374151;
    font-weight: 500;
    text-align: center;
}

.image-upload-file-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px dashed rgba(250, 110, 120, 0.7);
    background: rgba(250, 110, 120, 0.08);
    color: #fa6e78;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: fit-content;
}

.image-upload-file-button:hover {
    background: rgba(250, 110, 120, 0.15);
}

.image-upload-file-input {
    display: none;
}

.image-upload-preview {
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 16px;
    padding: 12px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    position: relative;
    overflow: hidden;
}

.image-upload-preview img {
    width: 100%;
    border-radius: 12px;
    display: block;
}

.image-upload-preview img[hidden] {
    display: none;
}

.image-upload-preview .placeholder {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    line-height: 1.5;
}

.image-upload-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.image-upload-cancel {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
}

.image-upload-cancel:hover {
    color: #fa6e78;
}

.photo-upload-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(250, 110, 120, 0.06);
}

.photo-upload-inline__button {
    align-self: flex-start;
    background: linear-gradient(135deg, #fa6e78, #ff9066);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 22px -18px rgba(250, 110, 120, 0.6);
    transition: all 0.2s ease;
}

.photo-upload-inline__button:hover {
    transform: translateY(-1px);
}

.photo-upload-inline__note {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
}

.photo-upload-inline__actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.photo-upload-inline__file-input {
    display: none;
}

.photo-upload-inline__samples {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.photo-upload-inline__sample {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(250, 110, 120, 0.35);
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-upload-inline__sample:hover {
    border-color: #fa6e78;
    box-shadow: 0 10px 24px -18px rgba(250, 110, 120, 0.6);
}

.photo-upload-inline__sample img {
    width: 100%;
    border-radius: 10px;
    background: #f9fafb;
}

.photo-upload-inline__sample span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
}

.photo-upload-inline--disabled {
    opacity: 0.5;
    pointer-events: none;
}

.photo-upload-inline--highlight {
    animation: pulse-highlight 0.9s ease;
}

@keyframes pulse-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(250, 110, 120, 0.35);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(250, 110, 120, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(250, 110, 120, 0);
    }
}

.image-upload-confirm {
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #fa6e78, #ff9066);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 30px -20px rgba(250, 110, 120, 0.6);
    transition: all 0.2s ease;
}

.image-upload-confirm:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.image-upload-confirm:not(:disabled):hover {
    transform: translateY(-1px);
}
