/* ========================================
   Syncle AI - Mobile Responsive Styles
   모바일/태블릿 전용 스타일
   ======================================== */

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0 !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    /* Hide right sidebar on tablet */
    .chat-sidebar {
        display: none !important;
    }

    /* Make chat take full width */
    .chat-app {
        width: 100% !important;
        height: calc(100vh - 80px) !important;
    }

    .main-chat {
        width: 100% !important;
        height: 100% !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .chat-messages {
        width: 100% !important;
        height: 100% !important;
        flex: 1 !important;
        overflow-y: auto !important;
        padding-bottom: 0 !important; /* messages-container에서 관리 */
        scroll-padding-bottom: 200px !important;
        position: relative !important;
    }

    .messages-container {
        min-height: auto !important; /* 메시지를 상단부터 시작하도록 변경 */
        /* padding-bottom은 chat-input-overlay.css에서 관리 */
        padding-left: 16px !important;
        padding-right: 16px !important;
        padding-top: 20px !important;
    }

    /* Welcome Screen 중앙 정렬 보장 */
    .welcome-screen {
        height: calc(100vh - 80px - 140px) !important;
    }

    /* DEPRECATED - chat-input-overlay.css로 이동 */
    /*
    .chat-input-section {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 16px !important;
        padding-top: 40px !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
        background: linear-gradient(to top,
            #f9fafb 0%,
            #f9fafb 70%,
            rgba(249, 250, 251, 0.98) 85%,
            rgba(249, 250, 251, 0.9) 95%,
            transparent 100%
        ) !important;
        z-index: 99999 !important;
        box-sizing: border-box !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        isolation: isolate !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
        pointer-events: auto !important;
    }
    */
}

/* Responsive Design - Mobile */
@media (max-width: 767px) {
    /* Ensure left sidebar is hidden */
    .index-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 100;
        transition: transform 0.3s ease;
    }

    .index-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Hide right sidebar on mobile */
    .chat-sidebar {
        display: none !important;
    }

    /* Full width for main content */
    .main-content {
        margin-left: 0 !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    /* Adjust chat interface for mobile */
    .chat-app {
        height: calc(100vh - 100px) !important; /* 모바일 헤더 2줄 구조 */
    }

    .main-chat {
        width: 100% !important;
        height: 100% !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .chat-messages {
        width: 100% !important;
        height: 100% !important;
        flex: 1 !important;
        overflow-y: auto !important;
        padding-bottom: 0 !important; /* messages-container에서 관리 */
        scroll-padding-bottom: 200px !important;
        position: relative !important;
    }

    .messages-container {
        min-height: auto !important; /* 메시지를 상단부터 시작하도록 변경 */
        /* padding-bottom은 chat-input-overlay.css에서 관리 */
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-top: 20px !important;
    }

    .message-content {
        max-width: 85%;
    }

    /* Welcome Screen 중앙 정렬 보장 (모바일) */
    .welcome-screen {
        height: calc(100vh - 100px - 140px) !important; /* 전체 화면 - 헤더(2줄) - 입력창 */
    }

    /* DEPRECATED - chat-input-overlay.css로 이동 */
    /*
    .chat-input-section {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 16px !important;
        padding-top: 40px !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
        background: linear-gradient(to top,
            #f9fafb 0%,
            #f9fafb 70%,
            rgba(249, 250, 251, 0.98) 85%,
            rgba(249, 250, 251, 0.9) 95%,
            transparent 100%
        ) !important;
        z-index: 99999 !important;
        box-sizing: border-box !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        isolation: isolate !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
        pointer-events: auto !important;
    }
    */

    /* Message wrapper adjustments for mobile */
    .message-wrapper {
        padding: 0 12px;
        gap: 12px;
    }

    .message-wrapper.user-message .message-content {
        max-width: 85%;
    }

    .message-wrapper.bot-message .message-content {
        max-width: 90%;
    }

    /* Welcome content adjustments */
    .welcome-content {
        padding: 10px;
    }

    .welcome-title {
        font-size: 18px;
    }

    .welcome-description {
        font-size: 13px;
    }

    /* Input container mobile adjustments */
    .chat-input-container {
        padding: 10px 10px 10px 16px;
        border-radius: 14px;
    }

    .chat-input {
        font-size: 13px;
    }

    .send-button {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* Extra small devices (phones, less than 375px) */
@media (max-width: 374px) {
    .message-wrapper {
        padding: 0 8px;
        gap: 8px;
    }

    .message-text {
        font-size: 12px;
        padding: 10px 14px;
    }

    .chat-input {
        font-size: 12px;
    }

    .send-button {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    .welcome-title {
        font-size: 16px;
    }

    .welcome-description {
        font-size: 12px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .welcome-screen {
        padding: 10px;
    }

    .welcome-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .welcome-description {
        font-size: 12px;
    }

    .ripple-container {
        display: none; /* Hide ripple effect in landscape to save space */
    }

    .chat-input-section {
        padding: 10px;
        min-height: 70px;
    }

    .chat-input-container {
        padding: 8px 8px 8px 12px;
    }
}

/* High DPI displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize rendering for high DPI */
    .message-text,
    .welcome-title,
    .property-title {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode support (optional - commented out) */
/*
@media (prefers-color-scheme: dark) {
    .chat-app {
        background: #1a1a1a;
    }

    .main-chat {
        background: #1a1a1a;
    }

    .bot-message .message-text {
        background: #2a2a2a;
        color: #ffffff;
        border-color: #3a3a3a;
    }

    .chat-input-container {
        background: #2a2a2a !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }

    .chat-input {
        color: #ffffff;
    }

    .welcome-title {
        color: #ffffff;
    }

    .welcome-description {
        color: #a0a0a0;
    }
}
*/

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .ripple-container {
        display: none;
    }

    .chat-input-section {
        transition: none;
    }

    .message-wrapper {
        animation: none;
    }
}

/* Print styles */
@media print {
    .chat-sidebar,
    .chat-input-section,
    .new-chat-button,
    .send-button {
        display: none !important;
    }

    .main-chat {
        width: 100% !important;
    }

    .message-wrapper {
        page-break-inside: avoid;
    }

    .bot-formatted {
        color: #000 !important;
    }
}
