/**
 * ============================================================================
 * assets/css/global.css - 전역 디자인 시스템 및 반응형 공통 레이아웃 스타일
 * ============================================================================
 * [지원 해상도]: 데스크톱(1025px+), 태블릿(769px~1024px), 모바일(320px~768px)
 */

:root {
    /* 브랜드 컬러 팔레트 */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-text: #3730a3;

    /* 배경 및 서피스 색상 */
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-card: #ffffff;

    /* 텍스트 색상 */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* 테두리 및 구분선 */
    --border-color: #e2e8f0;
    --border-focus: #818cf8;

    /* 상태 색상 */
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-light: #fee2e2;
    --color-success: #10b981;
    --color-warning: #f59e0b;

    /* 둥글기 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* 그림자 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 기본 리셋 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ==========================================================================
   0. 최상단 고정 글로벌 네비게이션 헤더 (반응형 지원)
   ========================================================================== */
.global-navbar {
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.brand-logo-badge {
    width: 38px;
    height: 38px;
    background: #0f172a;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.brand-logo-badge span {
    color: #facc15;
    font-size: 12.5px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 15.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.brand-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
}

/* 모바일 햄버거 메뉴 토글 버튼 (기본 숨김, 모바일에서 노출) */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mobile-menu-toggle:hover {
    background: var(--bg-muted);
}

.mobile-menu-toggle i {
    width: 20px;
    height: 20px;
}

/* 모바일 사이드바 배경 딤드 오버레이 */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 1999;
    opacity: 0;
    transition: opacity 0.25s ease;
}

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

/* ==========================================================================
   1. 전체 레이아웃 (3단 그리드 -> 반응형 자동 전환)
   ========================================================================== */
.app-container {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    min-height: calc(100vh - 60px);
    background-color: var(--bg-app);
    width: 100%;
}

/* 우측 사이드바가 없는 2단 페이지용 레이아웃 */
.app-container.two-column-layout {
    grid-template-columns: 240px 1fr;
}

/* ==========================================================================
   2. 왼쪽 사이드바 네비게이션
   ========================================================================== */
.sidebar {
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    overflow-y: auto;
}

/* 모바일 드로어 닫기 버튼 (기본 숨김) */
.sidebar-mobile-close {
    display: none;
    align-self: flex-end;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-bottom: 8px;
}

.sidebar-header {
    margin-bottom: 20px;
}

.home-btn {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-group {
    margin-bottom: 24px;
}

.nav-group-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0 12px 8px 12px;
    letter-spacing: -0.2px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.nav-item i {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    color: #64748b;
    flex-shrink: 0;
}

.nav-item:hover {
    background-color: var(--bg-muted);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary-text);
    font-weight: 700;
}

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

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
}

.security-card {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.security-icon {
    width: 18px;
    height: 18px;
    color: var(--color-success);
    flex-shrink: 0;
    margin-top: 2px;
}

.security-text strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.security-text p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ==========================================================================
   3. 중앙 메인 작업 영역
   ========================================================================== */
.main-content {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    overflow-y: auto;
}

.content-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.breadcrumb-arrow {
    width: 14px;
    height: 14px;
}

.sub-brand {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.page-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 850px;
}

.privacy-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: #166534;
    margin-top: 4px;
}

.notice-icon {
    width: 16px;
    height: 16px;
    color: #16a34a;
    flex-shrink: 0;
}

/* 작업 카드 */
.workspace-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 툴바 */
.workspace-toolbar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background-color: #ffffff;
    flex-wrap: wrap;
}

.toolbar-guide {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toolbar-guide strong {
    font-size: 13.5px;
    color: var(--text-primary);
}

.guide-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 드롭존 및 빈 상태 */
.drop-zone {
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin: 16px;
    background-color: var(--bg-muted);
    transition: all 0.2s ease;
    min-height: 280px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 480px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    color: var(--primary-color);
}

.empty-state-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ==========================================================================
   4. 우측 설정 사이드바
   ========================================================================== */
.settings-sidebar {
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    overflow: hidden;
}

.settings-header {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff;
}

.settings-scroll-area {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-sublabel {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ==========================================================================
   5. 공통 버튼 & 폼 컨트롤
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: var(--bg-muted);
    color: var(--text-primary);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background-color: var(--bg-muted);
    color: var(--text-primary);
}

.btn-save-large {
    background-color: #0f172a;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    padding: 13px 26px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}

.btn-save-large:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.count-badge {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-muted);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

/* 폼 요소 */
.form-select, .form-input, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 13.5px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-range {
    width: 100%;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.btn-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

/* 세그먼트 컨트롤 */
.segmented-control {
    display: flex;
    background-color: var(--bg-muted);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.segment-btn {
    flex: 1;
    padding: 7px 10px;
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.segment-btn.active {
    background-color: #ffffff;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

/* 하단 사용 가이드 박스 */
.guide-box {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}

.guide-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.guide-steps {
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.guide-footnote {
    font-size: 11.5px;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

/* 유틸리티 */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }

/* ==========================================================================
   6. 전역 반응형 미디어 쿼리 (태블릿 & 스마트폰 완벽 대응)
   ========================================================================== */

/* 태블릿 가로 및 소형 데스크톱 (1025px ~ 1200px) */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 210px 1fr 290px;
    }
    .main-content {
        padding: 20px 24px;
    }
}

/* 태블릿 세로 (769px ~ 1024px) */
@media (max-width: 1024px) {
    .app-container {
        display: flex;
        flex-direction: row;
        min-height: calc(100vh - 60px);
    }
    .sidebar {
        width: 210px;
        flex-shrink: 0;
    }
    .main-content {
        flex: 1;
        padding: 20px 20px;
    }
    .settings-sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border-color);
        margin-top: 24px;
    }
}

/* 스마트폰 모바일 (768px 이하) */
@media (max-width: 768px) {
    .global-navbar {
        padding: 0 16px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .app-container {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* 좌측 사이드바: 모바일 슬라이드 드로어로 변환 */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 2000;
        box-shadow: var(--shadow-xl);
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 16px;
    }

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

    .sidebar-mobile-close {
        display: block;
    }

    .main-content {
        padding: 16px 12px;
        gap: 16px;
        width: 100%;
    }

    .content-header .page-title {
        font-size: 22px;
    }

    .content-header .page-description {
        font-size: 13px;
    }

    .privacy-notice {
        font-size: 11.5px;
        padding: 8px 10px;
    }

    .workspace-toolbar {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .drop-zone {
        padding: 24px 12px;
        margin: 12px;
        min-height: 220px;
    }

    /* 우측 사이드바 -> 하단 배치 */
    .settings-sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border-color);
        margin-top: 16px;
    }

    .settings-header {
        padding: 14px 16px;
    }

    .settings-scroll-area {
        padding: 16px;
        gap: 16px;
    }

    .btn-save-large {
        width: 100%;
        justify-content: center;
        padding: 14px;
        font-size: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-grid-3 {
        grid-template-columns: 1fr 1fr;
    }
}
