:root {
  /* Colors */
  --primary: #3C8D99;
  --primary-dark: #2563eb;
  --secondary: #6FCCB4;
  --accent: #FFB347;

  /* Grays */
  --gray-100: #F9FAFB;
  --gray-200: #e5e7eb;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --background: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E5E7EB;
    
  /* Text colors */
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-light: #F9FAFB;

  /* Background colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-hover: #f3f4f6;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.75rem;
  --spacing-lg: 1rem;
  --spacing-xl: 1.5rem;
  --spacing: 1rem;
     
  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;
     
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
     
  /* Font sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
          
  /* Common aliases */
  --common-primary: #3C8D99;
  --common-primary-dark: #2563eb;
  --common-secondary: #6FCCB4;
  --common-accent: #FFB347;
  --common-gray-100: #F9FAFB;
  --common-gray-200: #e5e7eb;
  --common-gray-600: #4b5563;
  --common-gray-700: #374151;
  --common-background: #F8FAFC;
  --common-surface: #FFFFFF;
  --common-border: #E5E7EB;
  --common-text-primary: #1a1a1a;
  --common-text-secondary: #6b7280;
  --common-text-light: #F9FAFB;
  --common-bg-primary: #ffffff;
  --common-bg-secondary: #f3f4f6;
  --common-bg-hover: #f3f4f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    background-color: #e5e7eb;
    min-height: 100vh;
}

/* =====================
   페이지 래퍼 - 반응형 레이아웃
   ===================== */
.page-wrapper {
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: white;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* =====================
   헤더 스타일
   ===================== */
.header {
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
}

/* top-bar 고정 */
.header .top-bar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 768px;
    background-color: var(--bg-primary);
    z-index: 1000;
    padding: 1rem;
    box-sizing: border-box;
}

/* search-bar 고정 */
.header .search-bar {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    width: 100%;
    max-width: 768px;
    background-color: var(--bg-primary);
    z-index: 1000;
    padding: var(--spacing-lg);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.header .search-bar.active {
    transform: translateX(-50%) translateY(0);
}

/* 프로필 섹션 */
.header .profile-section {
    margin-top: 50px;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: var(--text-2xl);
    font-weight: bold;
    color: var(--text-primary);
}

.actions {
    display: flex;
    gap: var(--spacing-md);
}

.icon-button {
    background: none;
    border: none;
    padding: var(--spacing-sm);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    color: var(--secondary);
}

.icon-button:hover {
    background-color: var(--bg-hover);
}

.notification-dot {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: var(--radius-full);
}

.search-bar {
    display: none;
    padding: 0.5rem 0;
}

.search-bar.active {
    display: block;
}

.search-input-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.search-input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: var(--text-sm);
}

.profile-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

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

.profile-name {
    font-weight: 500;
    color: var(--text-primary);
}

.profile-detail {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.location-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    font-size: var(--text-sm);
    color: var(--secondary);
}

/* =====================
   하단 탭바
   ===================== */
.tab-bar {
    background-color: var(--bg-primary);
    padding: var(--spacing-sm) 0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 768px;
    z-index: 1000;
    box-sizing: border-box;
}

.tab-bar-content {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-xs);
    gap: var(--spacing-xs);
    min-width: 60px;
}

.tab-item.active {
    color: var(--primary);
}

.tab-item svg {
    width: 24px;
    height: 24px;
}

/* =====================
   로딩 관련
   ===================== */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--gray-200);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =====================
   알럿 스타일
   ===================== */
.common-alert {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.common-alert.success .alert-icon {
    color: #2ecc71;
}

.common-alert.warning .alert-icon {
    color: #f39c12;
}

.common-alert.error .alert-icon {
    color: #e74c3c;
}

.common-alert.info .alert-icon {
    color: #3498db;
}

@keyframes alertFadeIn {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes alertFadeOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -20px); }
}

.alert-enter {
    animation: alertFadeIn 0.3s forwards;
}

.alert-exit {
    animation: alertFadeOut 0.3s forwards;
}

/* =====================
   공통 로더
   ===================== */
.common-loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background-color: rgba(248, 250, 252, 0.9);
    font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.common-loader.active {
    display: flex;
}

.common-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 450px;
    padding: 35px;
    background: var(--common-bg-primary);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.common-brain-container {
    width: 220px;
    height: 220px;
    position: relative;
    margin-bottom: 25px;
}

/* Circle Progress (SVG ring around brain) */
.common-circle-progress {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 3;
    transform: rotate(-90deg);
}

.common-circle-bg {
    fill: none;
    stroke: rgba(60, 141, 153, 0.08);
    stroke-width: 4;
}

.common-circle-fill {
    fill: none;
    stroke: var(--common-primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 628.32;
    stroke-dashoffset: 628.32;
    transition: stroke-dashoffset 0.3s ease;
    filter: drop-shadow(0 0 3px rgba(60, 141, 153, 0.4));
}

.common-network-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(60, 141, 153, 0.1) 0%, rgba(111, 204, 180, 0.05) 70%, rgba(255, 255, 255, 0) 100%);
    animation: common-pulse 2s infinite ease-in-out;
}

.common-network-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 2;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.common-network-inner {
    position: absolute;
    width: 100%;
    height: 100%;
}

.common-node {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--common-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(60, 141, 153, 0.5);
}

.common-node-center {
    width: 12px;
    height: 12px;
    background: var(--common-primary);
    box-shadow: 0 0 15px rgba(60, 141, 153, 0.8);
    animation: common-pulse-center 2s infinite ease-in-out;
}

@keyframes common-pulse-center {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

.common-connection {
    position: absolute;
    background: rgba(60, 141, 153, 0.15);
    transform-origin: 0 0;
    z-index: -1;
    height: 2px;
}

.common-connection.pulse {
    animation: common-connectionPulse 1.5s infinite;
}

.common-data-packet {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--common-primary);
    border-radius: 50%;
    top: -1px;
    animation: common-data-flow-back-forth 2s linear infinite;
}

@keyframes common-data-flow-back-forth {
    0% { left: 0; }
    50% { left: 100%; }
    100% { left: 0; }
}

@keyframes common-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.7; }
}

@keyframes common-connectionPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

.common-loading-text {
    margin: 20px 0 15px;
    font-size: 18px;
    font-weight: 500;
    color: var(--common-text-primary);
    text-align: center;
    height: 28px;
}

#common-loading-message {
    transition: opacity 0.4s ease;
    display: inline-block;
    min-width: 340px;
    text-align: center;
    color: var(--common-primary);
    font-weight: 600;
}

.common-progress-indicator {
    width: 100%;
    height: 6px;
    background: var(--common-bg-secondary);
    border-radius: 8px;
    margin: 10px 0 20px;
    position: relative;
    overflow: hidden;
}

.common-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--common-primary), var(--common-secondary));
    border-radius: 8px;
    transition: width 0.3s ease;
}

.common-search-terms {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 15px;
    max-width: 340px;
}

.common-term {
    padding: 4px 10px;
    background: rgba(60, 141, 153, 0.1);
    color: var(--common-primary);
    border-radius: 15px;
    margin: 0 5px 8px;
    font-size: 13px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.common-term.active {
    opacity: 1;
}

.common-status-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--common-text-secondary);
}

/* 파티클 효과 */
.common-particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
}

.common-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(60, 141, 153, 0.15);
    pointer-events: none;
}

/* 문서 스타일 */
.common-documents-orbit {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
}

.common-orbit-document {
    position: absolute;
    width: 40px;
    height: 55px;
    background: var(--common-bg-primary);
    border-radius: 4px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.common-orbit-document.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: common-document-appear 0.6s forwards;
}

.common-orbit-document.found {
    box-shadow: 0 0 0 2px var(--common-primary), 0 5px 15px rgba(60, 141, 153, 0.3);
    z-index: 10;
    animation: common-float 2s infinite ease-in-out;
}

.common-document-icon {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 8px;
}

.common-doc-title {
    width: 70%;
    height: 4px;
    background: var(--common-gray-200);
    margin-bottom: 5px;
    border-radius: 2px;
}

.common-doc-line {
    width: 70%;
    height: 2px;
    background: var(--common-gray-200);
    margin-bottom: 3px;
    border-radius: 2px;
}

.common-found-document .common-doc-title {
    background: var(--common-primary);
}

.common-found-document .common-doc-line {
    background: rgba(60, 141, 153, 0.2);
}

.common-document-detail {
    position: absolute;
    background: var(--common-bg-primary);
    border: 1px solid var(--common-border);
    border-radius: 8px;
    padding: 12px;
    width: 180px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    font-size: 12px;
    z-index: 30;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    transform: translateY(10px);
}

.common-document-detail.visible {
    opacity: 1;
    transform: translateY(0);
}

.common-detail-title {
    font-weight: 600;
    color: var(--common-primary);
    margin-bottom: 5px;
}

.common-detail-text {
    color: var(--common-text-secondary);
    line-height: 1.4;
}

.common-doc-relevance {
    display: flex;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--common-primary);
}

.common-relevance-bar {
    height: 4px;
    width: 70px;
    background: var(--common-gray-200);
    border-radius: 2px;
    margin-left: 5px;
    overflow: hidden;
}

.common-relevance-fill {
    height: 100%;
    background: var(--common-primary);
}

/* 애니메이션 */
@keyframes common-float {
    0%, 100% { transform: translate(-50%, -50%) scale(1.3); }
    50% { transform: translate(-50%, -60%) scale(1.3); }
}

@keyframes common-document-appear {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.common-detail-tag {
    display: inline-block;
    background: rgba(111, 204, 180, 0.2);
    color: var(--common-primary);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
}

.common-detail-footer {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--common-text-secondary);
}

/* =====================
   모바일 반응형
   ===================== */
@media (max-width: 768px) {
    body {
        background-color: #ffffff;
    }
    
    .page-wrapper {
        box-shadow: none;
    }
    
    /* 헤더 - 모바일에서는 전체 너비 */
    .header .top-bar {
        left: 0;
        right: 0;
        transform: none;
        max-width: 100%;
        padding: 0.75rem;
    }
    
    .header .search-bar {
        left: 0;
        right: 0;
        transform: translateY(-100%);
        max-width: 100%;
    }
    
    .header .search-bar.active {
        transform: translateY(0);
    }
    
    .header .profile-section {
        margin-top: 30px;
    }
    
    /* 탭바 - 모바일에서는 전체 너비 */
    .tab-bar {
        left: 0;
        right: 0;
        transform: none;
        max-width: 100%;
    }
    
    /* 로더 */
    .common-loading-container {
        padding: 25px 20px;
        width: calc(100% - 40px);
        margin: 0 20px;
    }
    
    .common-brain-container {
        width: 180px;
        height: 180px;
    }
    
    .common-loading-text {
        font-size: 16px;
    }
    
    #common-loading-message {
        min-width: 0;
        width: 100%;
    }
    
    .common-search-terms {
        max-width: 100%;
    }
    
    .common-term {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .common-document-detail {
        width: 150px;
        padding: 10px;
        font-size: 11px;
    }
    
    .common-orbit-document .common-document-detail {
        left: 45px;
        top: -10px;
    }
    
    .common-orbit-document.found .common-document-detail {
        top: -120px;
        left: 0;
    }
}

/* =====================
   데스크톱 - 중앙 정렬
   ===================== */
@media (min-width: 769px) {
    body {
        background-color: #e5e7eb;
    }
    
    .page-wrapper {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
    
    /* 헤더 - 데스크톱에서 중앙 정렬 */
    .header .top-bar {
        left: 50%;
        transform: translateX(-50%);
        max-width: 768px;
    }
    
    .header .search-bar {
        left: 50%;
        transform: translateX(-50%) translateY(-100%);
        max-width: 768px;
    }
    
    .header .search-bar.active {
        transform: translateX(-50%) translateY(0);
    }
    
    /* 탭바 - 데스크톱에서 중앙 정렬 */
    .tab-bar {
        left: 50%;
        transform: translateX(-50%);
        max-width: 768px;
    }
}
