#complaints-collector-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', sans-serif;
    background: var(--background-color, #F8F9FA);
    color: var(--text-color, #2F1B14);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* コンテナ全体をFlexboxに変更 */
.complaints-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    background: #FFFFFF;
    min-height: 100vh; /* 最小高さを保証 */
}

/* 上部エリア - 動的な最小高さ設定 */
.complaints-hostess-section {
    height: 55%;
    min-height: calc(40vh + 120px); /* 画像用40vh + 挨拶メッセージ用120px */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #FFFFFF;
    position: relative;
    padding: 20px;
    box-sizing: border-box;
}

.complaints-hostess-image {
    width: auto !important;
    height: auto !important;
    max-width: 90% !important;
    max-height: min(45vh) !important; /* 画面高さの40% */
    object-fit: contain !important;
    object-position: center center !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    display: block !important;
    margin: 0 auto !important;
    flex-shrink: 0; /* 画像が縮小されないように */
    aspect-ratio: unset !important;
    clip-path: none !important;
    transform: none !important;
    filter: none !important;
}

/* lazy loadingクラスの上書き */
.complaints-hostess-image.lazyload,
.complaints-hostess-image.lazyloaded {
    width: auto !important;
    height: auto !important;
    max-width: 90% !important;
    max-height: min(45vh) !important;
    object-fit: contain !important;
    object-position: center center !important;
    margin: 0 auto !important;
    flex-shrink: 0;
}

/* 画像が読み込まれていない場合の対策 */
.complaints-hostess-image[src=""],
.complaints-hostess-image:not([src]) {
    display: none !important;
}

.complaints-greeting-bubble {
    position: relative;
    background: #E9ECEF;
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-color, #2F1B14);
    font-weight: 500;
    max-width: 90%;
    text-align: center;
    margin-top: 15px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* メッセージが縮小されないように */
    min-height: 50px; /* 最小高さを保証 */
}

/* 中部と下部の調整 */
.complaints-chat-area {
    height: auto;
    min-height: 20vh;
    flex: 1; /* 残りのスペースを使用 */
    overflow-y: auto;
    padding: 15px;
    background: var(--background-color, #F8F9FA);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.complaints-input-section {
    height: auto;
    min-height: 15vh;
    padding: 15px;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    align-items: center;
    flex-shrink: 0; /* 入力エリアが縮小されないように */
}

.complaints-input-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.complaints-input {
    width: 100%;
    min-height: 60px;
    max-height: 100px;
    padding: 16px;
    border: 1px solid #DEE2E6;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    background: var(--background-color, #F8F9FA);
    transition: border-color 0.2s ease;
}

.complaints-input:focus {
    outline: none;
    border-color: #8B4513;
}

.complaints-button-group {
    display: flex;
    width: 100%;
    position: relative;
}

.complaints-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.complaints-submit-btn {
    background: #8B4513;
    color: white;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.complaints-submit-btn:hover:not(:disabled) {
    background: #A0522D;
    transform: translateX(-50%) translateY(-1px);
}

.complaints-submit-btn:disabled {
    background: #C7C7CC;
    cursor: not-allowed;
    transform: translateX(-50%);
}

.complaints-clear-btn {
    background: #DC3545;
    color: white;
    position: absolute;
    left: 0;
}

.complaints-clear-btn:hover {
    background: #C82333;
    transform: translateY(-1px);
}

/* メッセージスタイル */
.complaints-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: fadeIn 0.2s ease;
}

.complaints-message.user {
    flex-direction: row-reverse;
}

.complaints-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    object-fit: cover;
    border: none !important;
    outline: none !important;
}

.complaints-message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.complaints-message.user .complaints-message-bubble {
    background: #007AFF;
    color: white;
}

.complaints-message.hostess .complaints-message-bubble {
    background: #E9ECEF;
    color: var(--text-color, #2F1B14);
}

.complaints-message-time {
    font-size: 11px;
    color: #8E8E93;
    margin-top: 4px;
}

.complaints-message.user .complaints-message-time {
    text-align: right;
}

.complaints-message.hostess .complaints-message-time {
    text-align: left;
}

/* タイピングインジケーター */
.complaints-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.complaints-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #E9ECEF;
    border-radius: 16px;
}

.complaints-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8E8E93;
    animation: typing 1.4s infinite;
}

.complaints-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.complaints-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

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

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .complaints-hostess-section {
        min-height: calc(35vh + 70px);
    }
    
    .complaints-hostess-image {
        max-height: min(35vh, 250px) !important;
    }
    
    .complaints-greeting-bubble {
        max-width: 95%;
        font-size: 13px;
        padding: 12px 16px;
        margin-top: 10px;
        min-height: 45px;
    }
    
    .complaints-button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .complaints-submit-btn, .complaints-clear-btn {
        position: static;
        transform: none;
        width: 100%;
    }
    
    .complaints-submit-btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }
    
    .complaints-submit-btn:disabled {
        transform: none;
    }
}

@media (max-height: 600px) {
    .complaints-hostess-section {
        min-height: calc(30vh + 60px);
    }
    
    .complaints-hostess-image {
        max-height: min(30vh, 200px) !important;
    }
    
    .complaints-greeting-bubble {
        font-size: 12px;
        padding: 10px 15px;
        min-height: 40px;
    }
}

/* 画像とメッセージが確実に表示されるための追加設定 */
@media (min-height: 800px) {
    .complaints-hostess-section {
        min-height: calc(50vh + 100px);
    }
    
    .complaints-hostess-image {
        max-height: min(50vh, 400px) !important;
    }
}

/* スクロールバーのスタイリング */
.complaints-chat-area::-webkit-scrollbar {
    width: 4px;
}

.complaints-chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.complaints-chat-area::-webkit-scrollbar-thumb {
    background: #C7C7CC;
    border-radius: 2px;
}

.complaints-chat-area::-webkit-scrollbar-thumb:hover {
    background: #8E8E93;
}

/* 追加：すべての画像要素に対する強制スタイル */
img {
    border: none !important;
    outline: none !important;
}

/* 画像が空の場合の対策 */
img[src=""], img:not([src]) {
    display: none !important;
}

/* lazy loading対応 */
.lazyload {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazyloaded {
    opacity: 1;
}
