/* css/messages.css - メッセージ機能専用スタイル */

/* ===========================
   メッセージモーダル
   =========================== */
.message-modal-content {
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.message-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.message-modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-shop-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.message-shop-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.message-shop-details {
    flex: 1;
}

.message-shop-name {
    font-weight: 600;
    font-size: 1rem;
}

.message-shop-category {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* メッセージフォーム */
.message-form-container {
    padding: 1.5rem;
}

.message-input-group {
    margin-bottom: 1rem;
}

.message-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.message-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

.message-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-char-count {
    text-align: right;
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.25rem;
}

.message-char-count.warning {
    color: #ff9800;
}

.message-char-count.error {
    color: #f44336;
}

/* 匿名オプション */
.anonymous-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.anonymous-option:hover {
    background: #e9ecef;
}

.anonymous-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.anonymous-label {
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.anonymous-info {
    font-size: 0.8rem;
    color: #666;
}

/* メッセージ送信ボタン */
.message-submit-section {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.btn-cancel-message {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel-message:hover {
    background: #f8f9fa;
    border-color: #999;
}

.btn-send-message {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-send-message:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

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

/* ===========================
   メッセージ一覧表示
   =========================== */
.messages-list-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

.message-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

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

.message-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.message-item.unread {
    background: linear-gradient(to right, #f0f7ff, white);
    border-left: 3px solid #667eea;
}

.message-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.message-avatar.anonymous {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.message-meta {
    flex: 1;
}

.message-author {
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.owner-badge {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.message-time {
    font-size: 0.85rem;
    color: #999;
}

.message-text {
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
}

/* メッセージアクション */
.message-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.message-action-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.message-action-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-1px);
}

.message-action-btn.liked {
    background: #ffebee;
    border-color: #ff5252;
    color: #ff5252;
}

.message-action-btn.reply {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #2196f3;
}

.message-action-btn.delete {
    background: #ffebee;
    border-color: #f44336;
    color: #f44336;
}

.like-count {
    font-weight: 600;
}

/* 返信フォーム */
.reply-form-container {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

.reply-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    resize: none;
    min-height: 60px;
    font-family: inherit;
}

.reply-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.btn-cancel-reply,
.btn-send-reply {
    padding: 0.4rem 1rem;
    border-radius: 15px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel-reply {
    background: white;
    border: 1px solid #e0e0e0;
    color: #666;
}

.btn-send-reply {
    background: #667eea;
    border: none;
    color: white;
    font-weight: 500;
}

/* 返信表示 */
.message-replies {
    margin-top: 0.75rem;
    padding-left: 2rem;
    border-left: 2px solid #e0e0e0;
}

.reply-item {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.reply-author {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
}

.reply-time {
    font-size: 0.8rem;
    color: #999;
    margin-left: auto;
}

.reply-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    padding-left: 36px;
}

/* 空状態 */
.no-messages {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.no-messages-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-messages h3 {
    color: #666;
    margin-bottom: 0.5rem;
}

/* ローディング */
.messages-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.message-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* リアルタイム通知 */
.new-message-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
    }
    to {
        transform: translateX(0);
    }
}

.notification-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.9rem;
    color: #666;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .message-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .messages-list-container {
        max-height: 60vh;
    }
    
    .message-replies {
        padding-left: 1rem;
    }
    
    .new-message-notification {
        left: 10px;
        right: 10px;
    }
}