/* ========================================
   멀티탭 모달 CSS (PC 버전 ≥768px)
   Created: 2026-03-15
   스타일: 네이버 메모 스타일 + 디자인 시스템
   ======================================== */

/* ===== 모달 오버레이 ===== */
.note-tab-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.note-tab-modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

/* ===== 모달 컨테이너 ===== */
.modal-container {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    background: var(--bg-primary, #FFFFFF);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 탭 바 ===== */
.tab-bar {
    display: flex;
    align-items: center;
    background: var(--bg-primary, #FFFFFF);
    border-bottom: 1px solid var(--border-color, #E5E5E5);
    padding: 8px 12px;
    gap: 8px;
    flex-shrink: 0;
}

.tabs-container {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray-300, #D4D4D4) transparent;
}

.tabs-container::-webkit-scrollbar {
    height: 4px;
}

.tabs-container::-webkit-scrollbar-thumb {
    background: var(--color-gray-300, #D4D4D4);
    border-radius: 2px;
}

/* ===== 탭 ===== */
.note-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary, #FAFAFA);
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 120px;
    max-width: 200px;
    font-size: var(--font-size-sm, 12px);
    color: var(--color-gray-600, #525252);
}

.note-tab:hover {
    background: var(--bg-hover, #F5F5F5);
}

.note-tab.active {
    background: var(--bg-primary, #FFFFFF);
    border-bottom-color: var(--bg-primary, #FFFFFF);
    color: var(--color-primary, #1E3A8A);
    font-weight: var(--font-weight-medium, 500);
}

.note-tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-tab-close {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: var(--color-gray-500, #737373);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.note-tab-close:hover {
    background: var(--bg-active, #E5E5E5);
    color: var(--color-error, #EF4444);
}

/* ===== 새 노트 버튼 ===== */
.btn-new-tab {
    padding: 8px 16px;
    background: var(--color-primary, #1E3A8A);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-size-sm, 12px);
    font-weight: var(--font-weight-medium, 500);
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-new-tab:hover {
    background: var(--color-primary-hover, #1E40AF);
}

/* ===== 모달 닫기 버튼 ===== */
.btn-close-modal {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-gray-600, #525252);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    background: var(--bg-hover, #F5F5F5);
    color: var(--color-error, #EF4444);
}

/* ===== 탭 컨텐츠 컨테이너 ===== */
.tab-content-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.tab-content-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.tab-content-container iframe.active {
    display: block;
}

/* ===== 로딩 상태 ===== */
.tab-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--color-gray-500, #737373);
}

.tab-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color, #E5E5E5);
    border-top-color: var(--color-primary, #1E3A8A);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

/* ===== 모바일에서는 숨김 ===== */
@media (max-width: 768px) {
    .note-tab-modal {
        display: none !important;
    }
}

/* ===== 반응형 조정 ===== */
@media (max-width: 1024px) {
    .modal-container {
        width: 95vw;
        height: 90vh;
    }
    
    .note-tab {
        min-width: 100px;
        max-width: 150px;
        padding: 6px 12px;
    }
}
