/**
 * Syncle Chat Desktop - Notion Style Design
 * 노션 스타일 미니멀 채팅 UI
 */

/* ============================================
   CSS Variables & Theme - Notion Style
   ============================================ */
:root {
    /* Notion Dark Mode Colors */
    --bg-main: #191919;
    --bg-secondary: #202020;
    --bg-tertiary: #252525;
    --bg-hover: rgba(255, 255, 255, 0.055);
    --bg-active: rgba(255, 255, 255, 0.08);
    --bg-glass: transparent;
    --bg-glass-hover: rgba(255, 255, 255, 0.055);

    /* Notion Accent Color */
    --primary-blue: #2383e2;
    --primary-cyan: #2383e2;
    --primary-gradient: none;

    /* Text Colors - Notion Style */
    --text-primary: rgba(255, 255, 255, 0.9);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Borders - Notion Style (subtle) */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.09);
    --border-glow: rgba(255, 255, 255, 0.09);
    --border-active: rgba(255, 255, 255, 0.2);

    /* Status Colors */
    --status-online: #2ecc71;
    --status-offline: rgba(255, 255, 255, 0.4);
    --status-away: #f39c12;
    --status-busy: #e74c3c;

    /* Semantic Colors - Notion Style */
    --color-success: #2ecc71;
    --color-warning: #f39c12;
    --color-error: #e74c3c;
    --color-info: #2383e2;

    /* Shadows - Minimal (Notion uses very subtle shadows) */
    --shadow-sm: none;
    --shadow-md: rgba(0, 0, 0, 0.1) 0px 1px 2px;
    --shadow-lg: rgba(0, 0, 0, 0.15) 0px 2px 8px;
    --shadow-xl: rgba(0, 0, 0, 0.2) 0px 4px 16px;
    --shadow-glow: none;
    --glow-primary: none;
    --glow-cyan: none;
    --glow-success: none;

    /* Spacing - Notion Standard */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.875rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;

    /* Border Radius - Notion Style (subtle) */
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
}

/* ============================================
   Light Theme Variables - Notion Style
   ============================================ */
body.light-mode {
    /* Notion Light Mode Colors */
    --bg-main: #ffffff;
    --bg-secondary: #f7f6f3;
    --bg-tertiary: #edece9;
    --bg-hover: rgba(55, 53, 47, 0.08);
    --bg-active: rgba(55, 53, 47, 0.12);
    --bg-glass: transparent;
    --bg-glass-hover: rgba(55, 53, 47, 0.08);

    /* Text Colors - Notion Light */
    --text-primary: #37352f;
    --text-secondary: #6b6b6b;
    --text-muted: #9b9a97;

    /* Borders - Notion Light */
    --border-subtle: rgba(55, 53, 47, 0.06);
    --border-color: rgba(55, 53, 47, 0.09);
    --border-glow: rgba(55, 53, 47, 0.09);
    --border-active: rgba(55, 53, 47, 0.2);

    /* Shadows - Notion Light */
    --shadow-sm: none;
    --shadow-md: rgba(0, 0, 0, 0.04) 0px 1px 2px;
    --shadow-lg: rgba(0, 0, 0, 0.08) 0px 2px 8px;
    --shadow-xl: rgba(0, 0, 0, 0.1) 0px 4px 16px;
    --shadow-glow: none;
    --glow-primary: none;
    --glow-cyan: none;
    --glow-success: none;
}

/* ============================================
   Base Styles - Notion Style
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol';
    background: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Main Container - Desktop Layout
   ============================================ */
.chat-desktop-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   Notion Style - Clean, No Glass Effects
   ============================================ */
.glass {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
}

.glass-input {
    background: transparent;
    backdrop-filter: none;
    border: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.glass-input:focus-within {
    background: var(--bg-hover);
    border-color: var(--border-active);
}

.glass-tag {
    background: var(--bg-hover);
    backdrop-filter: none;
    border: none;
    border-radius: var(--radius-sm);
}

/* ============================================
   Sidebar - Chat List (Notion Style)
   ============================================ */
.chat-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

/* Sidebar Header - Notion Style */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 12px 14px;
    height: 45px;
    min-height: 45px;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.back-btn-header {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
    font-size: 14px;
}

.back-btn-header:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-profile-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-glow);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-online);
    animation: pulse 2s infinite;
}

/* User Profile Dropdown */
.user-profile-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}

.menu-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.menu-item:hover {
    background-color: var(--bg-hover);
}

/* 라이트모드 명시적 스타일 */
body.light-mode .user-profile-dropdown {
    background: #ffffff;
    border-color: #d4d4d4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body.light-mode .menu-item {
    color: #1a1a1a;
}

body.light-mode .menu-item:hover {
    background-color: transparent;
}

.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

body.light-mode .menu-divider {
    background-color: #000000;
}

.logout-item {
    color: var(--color-error);
}

.logout-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

body.light-mode .logout-item:hover {
    background-color: rgba(239, 68, 68, 0.08);
}

/* Search Container - Notion Style */
.search-container {
    padding: 6px 14px 8px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    transition: background-color 0.1s ease;
}

.search-wrapper:hover {
    background: var(--bg-main);
}

.search-wrapper:focus-within {
    background: var(--bg-main);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.search-wrapper i {
    color: var(--text-muted);
    font-size: 13px;
}

.chat-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 4px 0;
}

.chat-search::placeholder {
    color: var(--text-muted);
}

/* Chat Filters - Notion Style Tabs */
.chat-filters {
    display: flex;
    gap: 2px;
    padding: 4px 14px 8px;
}

.filter-btn {
    padding: 4px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* Chat Rooms List - Notion Style */
.chat-rooms-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-rooms-list {
    padding: 4px 8px;
}

.no-rooms {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--spacing-xl);
}

.no-rooms p {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* Chat Room Card - Notion Style (Clean, No Effects) */
.chat-room-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 1px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.1s ease;
    overflow: hidden;
}

/* Remove Magic Card Effect */
.chat-room-card::before {
    display: none;
}

.chat-room-card:hover,
.chat-room-card:focus {
    background: var(--bg-hover);
}

/* Keyboard focus - Notion Style */
.chat-room-card:focus {
    outline: none;
    background: var(--bg-hover);
}

.chat-room-card:focus:not(:focus-visible) {
    outline: none;
}

.chat-room-card:focus-visible {
    outline: none;
    background: var(--bg-active);
}

.chat-room-card.active {
    background: var(--bg-active);
}

/* Room Avatar - Notion Style (Smaller) */
.room-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    object-fit: cover;
}

.room-avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: white;
    text-shadow: none;
}

.room-info {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

.room-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.room-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.room-product-inline {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.room-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
}

.last-message {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.delete-room-btn {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.1s ease, background-color 0.1s ease;
    flex-shrink: 0;
}

.chat-room-card:hover .delete-room-btn {
    opacity: 1;
}

.delete-room-btn:hover {
    background: var(--bg-active);
    color: var(--color-error);
}

/* Unread Badge - Notion Style */
.unread-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--color-error);
    color: white;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Simplified Animation - Notion Style (subtle fade only) */
.chat-room-card {
    opacity: 1;
    transform: none;
    animation: none;
}

/* Sidebar Footer - Notion Style */
.sidebar-footer {
    display: flex;
    gap: var(--spacing-sm);
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
}

.footer-btn {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.1s ease;
    font-size: 13px;
}

.footer-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   Button Styles - Notion Style
   ============================================ */
.shimmer-btn {
    padding: 6px 12px;
    background: var(--primary-blue);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.shimmer-btn:hover {
    background: #1a6dc4;
}

.new-chat-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ============================================
   Main Chat Area - Notion Style
   ============================================ */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* Empty State - Notion Style */
.empty-chat-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-main);
}

.empty-chat-content {
    text-align: center;
}

.empty-chat-content i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-chat-content h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-chat-content p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Chat Header - Notion Style */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    position: relative;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    min-height: 45px;
}

.chat-header.glass {
    background: transparent;
    backdrop-filter: none;
}

/* 채팅 헤더 뒤로가기 버튼 - Notion Style */
.chat-header .back-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-header .back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-partner-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.partner-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

/* 헤더의 이니셜 아바타 - Notion Style */
.partner-avatar.avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: white;
    text-shadow: none;
}

.partner-details {
    display: flex;
    flex-direction: column;
}

.partner-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Text Styles - Remove gradient */
.shiny-text {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: var(--text-primary);
    background-clip: unset;
}

.product-info {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.menu-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
    font-size: 14px;
}

.menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Dropdown - Notion Style */
.chat-menu-dropdown {
    position: absolute;
    top: 50px;
    right: 16px;
    min-width: 180px;
    border-radius: var(--radius-md);
    padding: 4px;
    display: none;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.chat-menu-dropdown button {
    width: 100%;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.1s ease;
}

.chat-menu-dropdown button:hover {
    background: var(--bg-hover);
}

/* Messages Container - Notion Style */
.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    position: relative;
    min-height: 0;
}

.dot-pattern {
    background: var(--bg-main);
}

/* Date Divider - Notion Style */
.date-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}

.date-divider span {
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    min-height: min-content;
}

/* Notion Style Message - Block Style */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 16px;
    transition: background-color 0.1s ease;
    position: relative;
    max-width: 100%;
}

.message:hover {
    background: var(--bg-hover);
}

/* Received messages - left aligned */
.message.received {
    align-self: stretch;
}

/* Sent messages - right aligned */
.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 75%;
}

.message.sent:hover {
    background: var(--bg-hover);
}

.message.sent .message-content {
    margin-left: 0;
    align-items: flex-end;
}

.message.sent .message-text {
    text-align: right;
}

/* Message Avatar - Notion Style */
.message-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    margin-top: 2px;
    object-fit: cover;
}

/* 이니셜 아바타 - Notion Style */
.avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: white;
    text-shadow: none;
}

.message.grouped .message-avatar {
    opacity: 0;
    visibility: hidden;
}

/* Message Content - Notion Style */
.message-content {
    flex: 1;
    min-width: 0;
}

.message.sent .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 기존 message-header (하위 호환성) */
.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
    min-height: 18px;
}

.message.sent .message-header {
    justify-content: flex-start;
}

/* 발신자 이름 - 카카오톡 스타일 */
.message-sender {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* 보낸 메시지에서는 발신자 이름 숨김 */
.message.sent .message-sender {
    display: none;
}

/* ============================================
   카카오톡 스타일 메시지 레이아웃
   ============================================ */

/* 메시지 버블 + 시간을 감싸는 row */
.message-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

/* 받은 메시지: 텍스트 → 시간 */
.message.received .message-bubble-row {
    flex-direction: row;
}

/* 보낸 메시지: 시간 → 텍스트 */
.message.sent .message-bubble-row {
    flex-direction: row;
    justify-content: flex-end;
}

/* 메타 정보 (시간 + 읽음) */
.message-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 2px;
    flex-shrink: 0;
    padding-bottom: 2px;
}

/* 보낸 메시지의 메타: 오른쪽 정렬 */
.message.sent .message-meta {
    align-items: flex-end;
}

/* 받은 메시지의 메타: 왼쪽 정렬 */
.message.received .message-meta {
    align-items: flex-start;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
}

/* 읽음 확인 표시 - Notion Style */
.read-status {
    font-size: 12px;
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
}

.read-status.sent {
    color: var(--text-muted);
}

.read-status.read {
    color: var(--color-success);
}

.read-status i {
    font-size: 10px;
}

body.light-mode .read-status.read {
    color: var(--color-success);
}

/* Message Text - Bubble Style */
.message-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    word-wrap: break-word;
    padding: 10px 14px;
    border-radius: 18px;
    display: inline-block;
    max-width: 100%;
    background: var(--bg-tertiary);
}

/* 받은 메시지 말풍선 */
.message.received .message-text {
    background: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
}

/* 보낸 메시지 말풍선 */
.message.sent .message-text {
    background: var(--primary-blue);
    color: white;
    text-align: left;
    border-bottom-right-radius: 4px;
}

/* 라이트 모드 말풍선 */
body.light-mode .message.received .message-text {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.light-mode .message.sent .message-text {
    background: var(--primary-blue);
    color: white;
}

/* 그룹 메시지 말풍선 (연속 메시지) */
.message.grouped .message-text {
    border-radius: 18px;
}

.message.received.grouped .message-text {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.message.sent.grouped .message-text {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* 그룹 메시지: 헤더와 메타 정보 숨김 */
.message.grouped .message-header {
    display: none;
}

.message.grouped .message-sender {
    display: none;
}

.message.grouped .message-meta {
    display: none;
}

.message.grouped {
    padding-top: 1px;
    padding-bottom: 1px;
}

/* System Message - Notion Style */
.message.system-message {
    background: transparent;
    justify-content: center;
    padding: 8px 16px;
}

.system-message-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.system-message-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: normal;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: none;
}

/* Message Actions (on hover) - Notion Style */
.message-actions {
    position: absolute;
    top: 2px;
    right: 16px;
    display: none;
    gap: 2px;
}

.message:hover .message-actions {
    display: flex;
}

.message-action-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background-color 0.1s ease;
}

.message-action-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* Input Container - Notion Style */
.input-container {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
    position: relative;
    z-index: 10;
}

.input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

.input-form:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px var(--primary-blue);
}

.input-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
}

.message-input {
    width: 100%;
    padding: 4px 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    outline: none;
}

.message-input::placeholder {
    color: var(--text-muted);
}

.message-input::-webkit-scrollbar {
    width: 4px;
}

.message-input::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Send Button - Notion Style */
.send-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-blue);
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.1s ease;
    font-size: 12px;
}

.send-btn:hover:not(:disabled) {
    background: #1a6dc4;
}

.send-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding: 0 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.char-count {
    font-variant-numeric: tabular-nums;
}

.input-hint {
    font-size: 11px;
}

/* ============================================
   Loading & Animations - Notion Style (Simplified)
   ============================================ */
.loading-rooms,
.loading-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    font-size: 13px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    font-size: 12px;
    color: var(--text-muted);
}

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

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.2s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.4;
    }
    30% {
        opacity: 1;
    }
}

/* ============================================
   Responsive Design - Notion Style
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .chat-desktop-container {
        grid-template-columns: 280px 1fr;
    }

    /* 태블릿 입력창 고정 */
    .input-container {
        position: fixed;
        bottom: 0;
        left: 280px;
        right: 0;
        background: var(--bg-main);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
    }

    /* 메시지 영역에 하단 여백 추가 */
    .messages-container {
        padding-bottom: 100px !important;
    }

    .message-list {
        padding-bottom: 40px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .chat-desktop-container {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        display: flex;
    }

    .chat-main {
        display: none;
    }

    .chat-main.active {
        display: flex;
    }

    .chat-sidebar.hidden {
        display: none;
    }

    .mobile-only {
        display: flex !important;
    }

    /* 모바일 뒤로가기 버튼 - Notion Style */
    .back-btn {
        width: 26px;
        height: 26px;
        border-radius: var(--radius-sm);
        background: transparent;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 14px;
    }

    .back-btn:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

    .chat-partner-info {
        display: flex;
        flex: 1;
        min-width: 0;
    }

    .chat-partner-info .partner-avatar {
        width: 26px;
        height: 26px;
    }

    .product-info {
        display: none;
    }

    .chat-info {
        justify-content: flex-start;
        gap: 8px;
    }

    .chat-header {
        padding: 10px 12px;
    }

    /* 모바일 입력창 고정 */
    .input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-main);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        padding: 10px 12px;
    }

    .messages-container {
        padding-bottom: 100px !important;
    }

    .message-list {
        padding-bottom: 40px;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* Scrollbar Styling - Notion Style (thin, subtle) */
.chat-rooms-container::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 4px;
}

.chat-rooms-container::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-rooms-container::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.chat-rooms-container::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-active);
}

/* File Preview - Notion Style */
.file-preview {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.preview-item {
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.preview-item img,
#previewImage {
    width: 100% !important;
    height: 100% !important;
    max-width: 80px !important;
    max-height: 80px !important;
    object-fit: cover;
    display: block;
}

.remove-preview {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
}

.remove-preview:hover {
    background: var(--color-error);
}

.remove-preview i {
    font-size: 10px;
}

/* Chat Image Thumbnail - Bubble Style */
.chat-image-thumbnail {
    max-width: 200px !important;
    max-height: 200px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 14px;
    cursor: pointer;
    transition: opacity 0.1s ease;
    object-fit: cover;
    display: block;
}

.chat-image-thumbnail:hover {
    opacity: 0.9;
}

.message-image {
    display: inline-block;
    max-width: 200px;
    border-radius: 14px;
    overflow: hidden;
}

/* 보낸 이미지 메시지 정렬 */
.message.sent .message-image {
    margin-left: auto;
}

/* Reply Preview - Notion Style */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-secondary);
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--primary-blue);
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.reply-preview-content i {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.reply-preview-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.reply-to-name {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.reply-message-preview {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-cancel-btn {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
    flex-shrink: 0;
}

.reply-cancel-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Reply Reference in Message - Notion Style */
.reply-reference {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--primary-blue);
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.reply-reference:hover {
    background: var(--bg-hover);
}

.reply-reference i {
    color: var(--text-muted);
    font-size: 10px;
}

.reply-reference-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Message Highlight Animation - Notion Style (subtle) */
.highlight-message {
    animation: highlightPulse 0.4s ease-out;
    background: var(--bg-active) !important;
}

@keyframes highlightPulse {
    0% {
        background: var(--primary-blue);
        opacity: 0.2;
    }
    100% {
        background: var(--bg-active);
        opacity: 1;
    }
}

/* Message Dropdown - Notion Style */
.message-dropdown {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    min-width: 140px;
    z-index: 1000;
    backdrop-filter: none;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 0.1s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item i {
    width: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}

.dropdown-item[data-action="delete"] {
    color: var(--color-error);
}

.dropdown-item[data-action="delete"]:hover {
    background: rgba(231, 76, 60, 0.1);
}

.dropdown-item[data-action="delete"] i {
    color: var(--color-error);
}

/* Image Viewer Modal - Notion Style */
.image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.close-viewer {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s ease;
}

.close-viewer:hover {
    background: rgba(255, 255, 255, 0.2);
}

.image-viewer-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* ==========================================
   만료된 이미지 Placeholder - Notion Style
   ========================================== */
.message-image.expired {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
}

.expired-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 40px;
    min-width: 160px;
    min-height: 100px;
    background: transparent;
}

.expired-image-placeholder i {
    opacity: 0.4;
    font-size: 24px;
    color: var(--text-muted);
}

.expired-image-placeholder p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Light Mode - Notion adjustments */
body.light-mode .message-image.expired {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.light-mode .expired-image-placeholder i {
    color: var(--text-muted);
}

body.light-mode .expired-image-placeholder p {
    color: var(--text-muted);
}