/**
 * Syncle AI - 채팅 레이아웃 스타일
 * 채팅 앱 전체 레이아웃 및 기본 구조 정의
 */

/* ========== 전역 스크롤바 방지 ========== */
.syncleai-page body {
    overflow-x: hidden;
}

.syncleai-page .app-container {
    overflow-x: hidden;
}

/* ========== 메인 콘텐츠 영역 ========== */
.syncleai-page .main-content {
    flex: 1;
    margin-left: 240px; /* 왼쪽 사이드바 공간 */
    min-height: 100vh;
    overflow-x: hidden;
    max-width: calc(100vw - 240px); /* 왼쪽 사이드바 제외 */
    box-sizing: border-box;
    position: relative;
    background: #f9fafb;
}

/* 데스크톱: 오른쪽 사이드바도 제외 */
@media (min-width: 1025px) {
    .syncleai-page .main-content {
        max-width: calc(100vw - 240px - 320px); /* 왼쪽 + 오른쪽 사이드바 제외 */
    }

    /* 데스크톱: padding-bottom은 JavaScript가 동적 계산 */
}

/* 태블릿/모바일: 왼쪽 사이드바 숨김 */
@media (max-width: 1024px) {
    .syncleai-page .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
}

/* ========== 채팅 앱 컨테이너 ========== */
.syncleai-page .chat-app {
    display: block; /* flexbox 제거 - 사이드바가 fixed이므로 */
    height: calc(100vh - var(--syncleai-header-height));
    background: var(--syncleai-color-background);
    width: 100%;
    position: relative;
    font-family: var(--syncleai-font-mono);
    overflow-x: hidden;
}

/* ========== 메인 채팅 영역 ========== */
.syncleai-page .main-chat {
    width: 100%; /* 전체 너비 */
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: transparent;
    max-height: calc(100vh - var(--syncleai-header-height)); /* 헤더 제외한 전체 높이 */
    height: 100%;
}

/* 오른쪽 그라디언트 오버레이 (사이드바 경계) */
.syncleai-page .main-chat::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to left,
        rgba(250, 250, 250, 0.95) 0%,
        rgba(250, 250, 250, 0.7) 30%,
        rgba(250, 250, 250, 0.4) 60%,
        transparent 100%
    );
    pointer-events: none;
    z-index: var(--syncleai-z-overlay);
}

/* ========== 도트 패턴 배경 (숨김) ========== */
.syncleai-page .dot-pattern {
    display: none;
}

/* ========== 채팅 메시지 영역 ========== */
.syncleai-page .chat-messages {
    flex: 1; /* 부모 영역을 채우도록 */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: var(--syncleai-z-base);
    /* 높이 제한 제거 - padding-bottom으로 입력창 공간 확보 */
    /* scroll-padding-bottom은 chat-input-overlay.css에서 관리 */
}

.syncleai-page .messages-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 모바일과 동일: 상단부터 시작 */
    align-items: stretch; /* 메시지 너비 유지 */
    gap: var(--syncleai-spacing-lg);
    /* padding-bottom은 JavaScript에서 동적 관리! */
    padding-top: var(--syncleai-spacing-xl);
    padding-left: var(--syncleai-spacing-xl);
    padding-right: var(--syncleai-spacing-xl);
    padding-bottom: 140px; /* 초기값 - JS가 즉시 덮어씀 */
    min-height: auto; /* 모바일과 동일: 메시지를 상단부터 시작 */
}

/* ========== 환영 화면 ========== */
.syncleai-page .welcome-screen {
    width: 100%;
    height: calc(100vh - var(--syncleai-header-height) - 200px); /* 데스크톱: 입력창 영역 제외 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.6s ease;
    transition: opacity var(--syncleai-transition-slow),
                visibility var(--syncleai-transition-slow);
    z-index: var(--syncleai-z-welcome);
    background: transparent;
    flex-shrink: 0; /* 크기 고정 */
}

.syncleai-page .welcome-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

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

.syncleai-page .welcome-content {
    text-align: center;
    max-width: 500px;
    background: transparent;
    padding: var(--syncleai-spacing-xl);
}

/* ========== 환영 타이틀 ========== */
.syncleai-page .welcome-title {
    font-size: var(--syncleai-font-size-xl);
    font-weight: var(--syncleai-font-weight-semibold);
    color: var(--syncleai-color-text-primary);
    margin-bottom: var(--syncleai-spacing-md);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 10;
}

.syncleai-page .welcome-description {
    font-size: var(--syncleai-font-size-md);
    color: var(--syncleai-color-text-tertiary);
    line-height: var(--syncleai-line-height-normal);
    margin-bottom: 0;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.2px;
    position: relative;
    z-index: 10;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.3s forwards;
}

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

/* ========== Ripple 효과 (MagicUI) ========== */
.syncleai-page .ripple-container {
    pointer-events: none;
    position: absolute;
    inset: 0;
    overflow: visible;
    background: transparent;
}

.syncleai-page .ripple-circle {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    background: radial-gradient(circle at center,
        rgba(107, 114, 128, 0.08) 0%,
        rgba(107, 114, 128, 0.04) 40%,
        transparent 70%);
    box-shadow:
        0 0 0 1px rgba(107, 114, 128, 0.2),
        0 0 40px rgba(107, 114, 128, 0.1),
        inset 0 0 30px rgba(107, 114, 128, 0.05);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
    mix-blend-mode: multiply;
}

.syncleai-page .ripple-circle::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(107, 114, 128, 0.1),
        transparent,
        rgba(107, 114, 128, 0.1),
        transparent
    );
    animation: ripple-rotate 8s linear infinite;
    opacity: 0.5;
}

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

/* ========== 제안 숨김 ========== */
.syncleai-page .welcome-suggestions {
    display: none;
}

/* ========== 반응형: 태블릿 ========== */
@media (max-width: 1024px) {
    .syncleai-page .chat-app {
        width: 100%;
        height: calc(100vh - var(--syncleai-header-height));
    }

    .syncleai-page .main-chat {
        width: 100%;
        height: 100%;
        flex: 1;
    }

    .syncleai-page .chat-messages {
        width: 100%;
        flex: 1; /* 부모 영역 채우기 */
        overflow-y: auto;
        position: relative;
        /* 높이 제한 제거 - padding-bottom으로 관리 */
    }

    /* Welcome Screen 중앙 정렬 - 태블릿 */
    .syncleai-page .welcome-screen {
        height: calc(100vh - var(--syncleai-header-height) - var(--syncleai-input-height));
    }
}

/* ========== 반응형: 모바일 ========== */
@media (max-width: 767px) {
    .syncleai-page .chat-app {
        height: calc(100vh - var(--syncleai-header-height-mobile));
    }

    .syncleai-page .main-chat {
        width: 100%;
        height: 100%;
        flex: 1;
    }

    .syncleai-page .chat-messages {
        width: 100%;
        flex: 1; /* 부모 영역 채우기 */
        overflow-y: auto;
        position: relative;
        /* 높이 제한 제거 - padding-bottom으로 관리 */
    }

    /* Welcome Screen 중앙 정렬 - 모바일 */
    .syncleai-page .welcome-screen {
        height: calc(100vh - var(--syncleai-header-height-mobile) - var(--syncleai-input-height));
    }
}
