#app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* 1. Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: var(--sidebar-transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    align-items: center;
    overflow: visible !important;
}

/* --- Sidebar Header --- */
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 8px 8px;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    padding: 8px 0;
    gap: 4px;
}

.sidebar-hamburger-btn {
    flex-shrink: 0;
    color: var(--text-main);
    padding: 2px;
}

.sidebar-hamburger-btn svg {
    width: 14px;
    height: 14px;
}

/* --- New Chat Button (FAB / Pill) --- */
.btn-primary {
    background-color: var(--sidebar-hover-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    height: 30px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    flex: 1;
    transition: background-color 0.2s ease, transform 0.15s ease,
                border-radius 280ms cubic-bezier(0.4, 0, 0.2, 1),
                width 280ms cubic-bezier(0.4, 0, 0.2, 1),
                padding 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.btn-primary:hover {
    background-color: var(--card-hover);
    transform: scale(1.02);
}

.btn-primary span {
    overflow: hidden;
    max-width: 200px;
    opacity: 1;
    white-space: nowrap;
    transition: max-width 280ms cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.sidebar.collapsed .btn-primary {
    flex: none;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    background-color: var(--sidebar-hover-bg);
}

.sidebar.collapsed .btn-primary span {
    max-width: 0;
    opacity: 0;
}

/* --- Sidebar Nav --- */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding: 4px 8px 0;
}

.sidebar-nav-fixed {
    flex-shrink: 0;
}

.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 8px;
}

.nav-section {
    margin-bottom: 4px;
}

.section-title {
    font-size: 13px;
    font-weight: 500;
    padding: 14px 14px 6px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.sidebar.collapsed .section-title {
    display: none;
}

/* --- Sidebar Footer (Settings) --- */
.sidebar-footer {
    padding: 4px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    z-index: 10;
}

.settings-container {
    position: relative;
}

.settings-popup {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--premium-shadow);
    z-index: 500;
    padding: 6px 0;
    min-width: 220px;
    animation: fadeInUp 0.15s ease-out;
}

.settings-popup-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px 5px 10px;
    margin: 0 4px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
    transition: background 0.15s;
}

.settings-popup-item:hover {
    background: var(--card-hover);
}

.settings-popup-item i,
.settings-popup-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.settings-popup-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}

.sidebar.collapsed .settings-popup {
    position: fixed;
    bottom: 70px;
    left: 12px;
    right: auto;
    width: 220px;
    min-width: 220px;
    z-index: 1001;
    animation: popupFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* --- Nav Items --- */
.nav-item {
    background: transparent;
    border: none;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px 5px 10px;
    width: 100%;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    transition: background 0.2s, border-radius 0.2s, width 0.2s;
}

.nav-item i,
.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-dim);
    transition: color 0.2s;
}

.sidebar-menu-btn {
    line-height: 1.5;
}

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

.nav-item:hover i,
.nav-item:hover svg {
    color: var(--text-main);
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin: 2px auto;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

/* --- History Group Label --- */
.history-group-label {
    font-size: 13px;
    font-weight: 500;
    padding: 16px 12px 8px;
    color: var(--text-secondary);
    list-style: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar.collapsed .history-group-label {
    display: none !important;
}

.sidebar.collapsed .item-actions {
    display: none !important;
}

/* --- Mobile Backdrop --- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-backdrop.active {
    display: block;
}

/* --- Mobile (<=500px): Overlay Sidebar --- */
@media (max-width: 500px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        width: var(--sidebar-width) !important;
        transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        align-items: flex-start;
    }
}

/* 2. Main Content Styling */
#main-content {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color);
    transition: margin-right 0.3s cubic-bezier(0.2, 0, 0, 1);
}

#main-content.canvas-open {
    margin-right: 50%;
}

@media (max-width: 1024px) {
    #main-content.canvas-open {
        margin-right: 0;
    }
}

#top-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: background 0.2s;
    font-size: 13px;
    color: var(--text-main);
}

.model-selector:hover { background: var(--card-hover); }

.model-chevron { width: 14px; height: 14px; color: var(--text-dim); }

.model-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--premium-shadow);
    z-index: 200;
    min-width: 240px;
    padding: 8px 6px;
    animation: fadeInUp 0.15s ease-out;
}

.model-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    margin: 4px 10px 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.model-option:hover { background: var(--card-hover); }

.model-opt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.model-check {
    width: 14px;
    height: 14px;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.model-opt-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.model-opt-desc {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.4;
}

.model-dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

.thinking-section {
    display: flex;
    flex-direction: column;
}


.thinking-level-container {
    padding: 0 4px 6px;
    position: relative;
}

@keyframes slideDownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.thinking-sub-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.thinking-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.thinking-icon {
    width: 15px;
    height: 15px;
    color: var(--theme-purple);
}

.thinking-sub-trigger:hover {
    background: var(--card-hover);
}

.sub-trigger-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.selected-level-label {
    font-size: 12px;
    color: var(--text-dim);
}

.sub-chevron {
    width: 12px;
    height: 12px;
    color: var(--text-dim);
}

/* Right sliding sub dropdown */
.thinking-sub-dropdown {
    position: absolute;
    top: 0;
    left: calc(100% + 8px);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--premium-shadow);
    z-index: 300;
    min-width: 190px;
    padding: 6px;
    animation: slideRightFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.thinking-sub-dropdown::before {
    content: "";
    position: absolute;
    top: 0;
    left: -12px;
    width: 12px;
    height: 100%;
    background: transparent;
}

@keyframes slideRightFadeIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.sub-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 2px;
}

.sub-option:last-child {
    margin-bottom: 0;
}

.sub-option:hover {
    background: var(--card-hover);
}

.sub-opt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sub-opt-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.sub-check {
    width: 12px;
    height: 12px;
    color: var(--theme-purple);
    flex-shrink: 0;
}

.sub-opt-desc {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.3;
}

#sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

#sidebar-toggle:hover {
    background-color: var(--card-hover);
}

@media (min-width: 1024px) {
    #sidebar-toggle {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    #sidebar-toggle {
        display: flex;
    }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

/* 3. Chat Container & Zero State */
#chat-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.zero-state {
    max-width: 800px;
    width: 100%;
    margin-top: 10vh;
}

.welcome-text {
    font-size: clamp(32px, 8vw, 56px);
    font-weight: 500;
    line-height: 1.2;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 48px;
    animation: fadeInSlideUp 0.8s ease-out;
}

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

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.card {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.card:hover {
    background-color: var(--card-hover);
    border-color: var(--border-color);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--premium-shadow);
}

.card p {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.card-sub {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.3;
    margin-top: 4px;
}

/* 4. Bottom Input Bar */
#input-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-container {
    max-width: var(--input-max-width);
    width: 100%;
    position: relative;
}

.input-wrapper {
    background-color: var(--input-bg);
    border-radius: 24px;
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    max-width: var(--input-max-width);
    min-width: 320px;
}

.input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

#chat-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 16px;
    resize: none;
    padding: 4px 0;
    outline: none;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background-color: var(--card-hover);
    color: var(--text-main);
}

#send-btn.disabled {
    opacity: 0.3;
    cursor: default;
}

.disclaimer {
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    margin-top: 12px;
}

.hidden { display: none !important; }

/* 5. Message Styling */
#chat-feed {
    max-width: var(--input-max-width);
    width: 100%;
    margin: 0 auto;
    padding-bottom: 100px; /* 입력창과 겹치지 않게 */
}

.message {
    display: flex;
    gap: 20px;
    padding: 24px 0;
    line-height: 1.6;
}

.user-msg {
    justify-content: flex-end;
}

.user-msg .avatar {
    display: none;
}

.user-msg .content-wrapper {
    max-width: 72%;
    background-color: var(--user-bubble-bg);
    border-radius: 20px 20px 4px 20px;
    padding: 12px 18px;
}

.user-msg .message-actions {
    justify-content: flex-end;
}

.ai-msg {
    justify-content: flex-start;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: var(--card-bg);
}

.ai-msg .avatar {
    background: linear-gradient(45deg, #4b90ff, #ff71cd);
}

.content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    min-width: 0;
    color: var(--text-main);
    font-size: 16px;
    white-space: pre-wrap;
}

.ai-msg .content {
    white-space: normal;
    color: var(--text-main);
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn svg,
.action-btn i {
    width: 16px;
    height: 16px;
}

.action-btn:hover {
    background-color: var(--card-hover);
    color: var(--text-main);
}

/* 6. Markdown Detail Styling */
.content p {
    margin-bottom: 12px;
}

.content h1, .content h2, .content h3 {
    margin: 16px 0 8px 0;
    color: var(--text-main);
}

.content ul, .content ol {
    margin: 8px 0 16px 24px;
}

.content li {
    margin-bottom: 6px;
}

.content code {
    background-color: var(--code-bg);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.content pre {
    background-color: var(--code-block-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
}

.content pre code {
    background-color: transparent;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
}

.content blockquote {
    border-left: 4px solid var(--accent-blue);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--text-dim);
}

/* --- Multimodal UI Added --- */
.image-preview-container {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    flex-wrap: wrap;
    max-width: var(--input-max-width);
}

.image-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-img {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.message-images {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.msg-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.msg-img:hover {
    transform: scale(1.02);
}

/* Thought Process Styling */
.thought-process {
    margin-bottom: 16px;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.thought-process details {
    padding: 12px;
}

.thought-process summary {
    font-size: 13px;
    color: var(--theme-purple);
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    outline: none;
}

.thought-content {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 4px;
}

/* Sidebar History Items */
.chat-item {
    position: relative;
    justify-content: space-between;
    font-size: 14px;
    padding: 5px 4px 5px 10px;
    transition: background-color 0.2s;
    overflow: hidden;
}

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

.chat-item .truncate {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* item-actions: pin + more-btn 묶음 */
/* 비고정: 기본 width=0으로 공간 미점유 → 호버 시 확장 */
.item-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 0;
    overflow: hidden;
    margin-left: 0;
    transition: width 0.15s ease, margin-left 0.15s ease;
}

/* 고정 아이콘이 있는 경우 항상 공간 확보 */
.chat-item.pinned .item-actions {
    width: 18px;
    margin-left: 2px;
}

/* 호버 시 공간 확장 (고정·비고정 공통) */
.chat-item:hover .item-actions {
    width: 18px;
    margin-left: 2px;
}

/* 고정 아이콘 — pinned 항목의 기본 상태에서 표시 */
.pin-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pin-indicator svg {
    width: 12px;
    height: 12px;
    color: var(--accent-blue);
}

/* 호버 시 고정 아이콘 숨기고 more-btn이 그 자리 차지 */
.chat-item:hover .pin-indicator {
    display: none;
}

/* more-btn — opacity/visibility 불필요, 컨테이너 width가 제어 */
.more-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.more-btn svg {
    width: 14px;
    height: 14px;
}

.more-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* Dropdown Menu */
.dropdown-menu {
    position: fixed;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--premium-shadow);
    z-index: 1000;
    min-width: 150px;
    padding: 8px 0;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

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

.dropdown-item.danger {
    color: #ff4b4b;
}

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

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

/* 8. Login Overlay Styling */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(14, 14, 14, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-out;
}

.login-card {
    background-color: var(--card-bg);
    padding: 48px;
    border-radius: 28px;
    width: 420px;
    box-shadow: var(--premium-shadow);
    border: 1px solid var(--glass-border);
    text-align: center;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo svg {
    width: 48px;
    height: 48px;
    color: #4b90ff;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 32px;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(75, 144, 255, 0.1);
}

.btn-login {
    width: 100%;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: var(--transition-fast);
}

.btn-login:hover {
    background-color: #357ae8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(75, 144, 255, 0.3);
}

.error-text {
    color: #ff4b4b;
    font-size: 13px;
    margin-top: 20px;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 9. Modal & Share Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    width: 480px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--premium-shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-body p {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.share-link-wrapper {
    display: flex;
    gap: 10px;
}

.share-link-wrapper input {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.primary-btn {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.primary-btn:hover {
    background-color: #357ae8;
}

/* --- New User Specific Share & Hub Modal Styling --- */
.share-modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.share-search-section, .selected-users-section, .active-shares-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-search-section label, .selected-users-section label, .active-shares-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.share-search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.share-search-box input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px 12px 42px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
}

.share-search-box input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(75, 144, 255, 0.15);
}

.share-search-box .search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-dim);
    pointer-events: none;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: 200px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--premium-shadow);
    overflow-y: auto;
    z-index: 1000;
    animation: fadeIn 0.15s ease-out;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
}

.search-result-item:hover {
    background-color: var(--card-hover);
}

.search-result-item .user-pos {
    font-size: 12px;
    color: var(--text-dim);
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-height: 48px;
    align-items: center;
}

.chip-container .placeholder-text {
    font-size: 13px;
    color: var(--text-dim);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(75, 144, 255, 0.15);
    border: 1px solid rgba(75, 144, 255, 0.25);
    color: #a3c7ff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.user-chip button {
    background: transparent;
    border: none;
    color: #a3c7ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
}

.user-chip button svg {
    width: 14px;
    height: 14px;
}

.active-shares-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.active-share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.active-share-item:last-child {
    border-bottom: none;
}

.active-share-item .user-info {
    font-size: 14px;
    color: var(--text-main);
}

.active-share-item .user-info span {
    font-size: 12px;
    color: var(--text-dim);
    margin-left: 6px;
}

.active-share-item .remove-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.15s;
}

.active-share-item .remove-btn:hover {
    color: #ff4b4b;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.loading-text, .empty-text {
    padding: 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* Shares Hub Modal Specific */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* 와이드 팝업 크기 확장 */
#shares-hub-modal .modal-card {
    max-width: 1000px;
    width: 95%;
    height: 90vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
}

#shares-hub-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* 2컬럼 컨테이너 */
.shares-hub-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: 100%;
}

.shares-hub-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-width: 0;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.column-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.col-icon {
    width: 20px;
    height: 20px;
}
.outgoing-icon {
    color: var(--accent-blue);
}
.incoming-icon {
    color: #e8b4ff;
}

/* 리스트 높이 확보 */
.shares-hub-column .shares-list {
    flex: 1;
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

/* 카드형 스타일 고도화 */
.share-hub-item {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.share-hub-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--premium-shadow);
}

.share-hub-item.clickable {
    cursor: pointer;
}

.share-hub-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.share-hub-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.share-hub-item-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

.share-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.share-detail-row i {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}

.share-detail-label {
    font-weight: 500;
    color: var(--text-main);
    flex-shrink: 0;
}

.share-detail-value {
    word-break: break-all;
}

.share-hub-actions {
    display: flex;
    gap: 8px;
}

.share-action-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.share-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.share-action-btn.danger {
    color: #ff4b4b;
    border-color: rgba(255, 75, 75, 0.15);
}

/* 모바일 반응형 처리 */
@media (max-width: 820px) {
    #shares-hub-modal .modal-card {
        max-height: 85vh;
        height: auto;
    }
    .shares-hub-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .shares-hub-column .shares-list {
        max-height: 250px;
    }
}

.share-action-btn.danger:hover {
    background: rgba(255, 75, 75, 0.1);
}

/* Toast / Snackbar */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: var(--card-bg);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    box-shadow: var(--premium-shadow);
    border: 1px solid var(--border-color);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 20000;
    pointer-events: none;
    border-left: 4px solid var(--accent-blue);
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-success { border-left-color: #34a853; }
.toast.toast-error   { border-left-color: #ea4335; }

/* Confirm Modal */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15000;
    animation: fadeIn 0.15s ease-out;
}

.confirm-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px 32px;
    width: 360px;
    border: 1px solid var(--border-color);
    box-shadow: var(--premium-shadow);
}

.confirm-message {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.secondary-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.secondary-btn:hover { background: var(--card-hover); }

.danger-btn {
    background: #ea4335;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.danger-btn:hover { background: #c5221f; }

/* History date group label */
.history-group-label {
    list-style: none;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 16px 12px 8px;
}

/* === User Message Inline Edit === */
.edit-textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--accent-blue);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    padding: 10px 14px;
    resize: vertical;
    min-height: 60px;
    outline: none;
}

.edit-cancel-btn, .edit-save-btn {
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.edit-cancel-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-dim);
}

.edit-cancel-btn:hover { background: var(--card-hover); color: var(--text-main); }

.edit-save-btn {
    background: var(--accent-blue);
    border: none;
    color: white;
}

.edit-save-btn:hover { background: #357ae8; }

/* === Upload Dropdown Menu === */
.upload-wrapper {
    position: relative;
}

.upload-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--premium-shadow);
    z-index: 200;
    min-width: 180px;
    padding: 6px;
    animation: fadeIn 0.15s ease-out;
}

.upload-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    transition: background 0.15s;
}

.upload-option:hover { background: var(--card-hover); }
.upload-option svg { width: 18px; height: 18px; color: var(--text-dim); flex-shrink: 0; }

.menu-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

/* === Drive Browser Modal === */
.drive-browser-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    width: 600px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    box-shadow: var(--premium-shadow);
    overflow: hidden;
    animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drive-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    flex-shrink: 0;
}

.drive-browser-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.navigation-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.navigation-btn:hover:not(:disabled) {
    background: var(--card-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-1px);
}

.navigation-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.drive-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
    margin-left: 12px;
    background: var(--input-bg);
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.breadcrumb-item {
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.15s ease;
}

.breadcrumb-item:hover {
    color: var(--accent-blue);
}

.breadcrumb-sep {
    color: var(--text-dim);
    font-size: 11px;
}

.drive-file-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drive-file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-main);
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.drive-file-item:hover {
    background: var(--card-hover);
    border-color: var(--border-color);
    transform: translateY(-1px);
    box-shadow: var(--premium-shadow);
}

.drive-file-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-dim);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.drive-file-item:hover svg {
    transform: scale(1.05);
}

.drive-file-item.is-folder svg {
    color: #fabb60;
}

.drive-status {
    padding: 60px;
    text-align: center;
    font-size: 15px;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Inline rename input */
.inline-rename {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--accent-blue);
    color: var(--text-main);
    font-size: 14px;
    width: 100%;
    outline: none;
    padding: 2px 0;
}

/* ==========================================
   === Gems Manager & Split Editor Styles ===
   ========================================== */

/* Gems Pinned Sidebar List */
.sidebar-gems-list {
    list-style: none;
    padding: 0;
    margin: 4px 0;
}
.sidebar-gems-list .nav-item {
    padding: 5px 8px 5px 12px;
}
.sidebar-gems-list .gem-dot-icon {
    font-size: 14px;
    margin-right: 2px;
}

/* Gems Manager Modal overlay */
.gems-manager-card {
    background: var(--glass-bg);
    backdrop-filter: blur(28px);
    border-radius: 20px;
    width: 860px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    box-shadow: var(--premium-shadow);
    overflow: hidden;
    animation: fadeInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.gems-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}
.gm-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--theme-purple);
}
.gems-manager-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.gems-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.gems-create-btn {
    background: linear-gradient(135deg, #7b3fe4, #448aff);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.gems-create-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(123, 63, 228, 0.4);
}
/* Gems layout classes were extracted to gems.css */


