/* 
✨ 실무용 완성형 레이아웃 시스템 v2.2 ✨
- 타이포그래피 시스템과 완벽 호환
- 테일윈드와 충돌 없는 네이밍
- 통일된 브레이크포인트 사용
- CSS 변수를 통한 유연한 커스터마이징
- 반응형 + 접근성 최적화
- 헤더 네비게이션 및 모바일 사이드바 포함
- 사이드바 수정사항 적용 완료
*/

/* ===== 미디어 쿼리 브레이크포인트 (타이포그래피와 통일) ===== */
/*
모바일: 0~640px
태블릿: 641px~1024px  
데스크톱: 1025px~
대형 화면: 1441px~
*/

/* ===== CSS 변수 ===== */
:root {

    --body-admin-color: radial-gradient(circle at top left, #FFD85F 0%, transparent 100%),
    radial-gradient(circle at right bottom, #6ABBE7 0%, transparent 100%) no-repeat fixed;

    --body-franchise-color: transparent linear-gradient(137deg, #E8F5E9 0%, #FFF3E0 26%, #E3F2FD 52%, #FCE4EC 77%, #F3E5F5 100%) 0% 0% no-repeat padding-box;

    /* 레이아웃 사이즈 */
    --container-max-width: 1960px;
    --container-padding: 15px;
    --container-padding-tablet: 16px;
    --container-padding-mobile: 12px;

    /* 헤더/푸터 */
    --header-height: 100px;
    --header-height-mobile: 48px;
    --footer-height: 300px;
    --footer-height-mobile: 48px;

    /* 간격 */
    --gutter-xs: 8px;
    --gutter-sm: 12px;
    --gutter-md: 16px;
    --gutter-lg: 24px;
    --gutter-xl: 32px;

    /* 모바일 네비게이션 */
    --mobile-nav-height: 56px;

    /* z-index 레이어 (수정됨) */
    --z-header: 100;
    --z-mobile-nav: 300;
    --z-modal: 1000;
    --z-dropdown: 1100;
    --z-tooltip: 1200;

    /* 트랜지션 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

}

/* ===== 로고 스타일 ===== */
.navbar-brand .logo,
.navbar-brand img.logo,
a.navbar-brand img.logo,
img.logo,
.logo {
    width: 200px;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
    transition: transform var(--transition-fast) !important;
    max-width: none !important;
    flex-shrink: 0 !important;
}

/* ===== 컨테이너 (테일윈드와 충돌 방지) ===== */
.app-container {
    width: 100%;
    height: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    box-sizing: border-box;
}

.app-inner-container {
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px);
    padding: 7px 30px 7px 30px;
}

.app-container-full {
    width: 100%;
    height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
}

@media (max-width: 768px) {
    .app-container {
        padding: 0 15px;
    }
}

/* 컨테이너 사이즈 변형 */
.app-container-sm {
    max-width: 768px;
}

.app-container-md {
    max-width: 1024px;
}

.app-container-lg {
    max-width: 1280px;
}

.app-container-xl {
    max-width: 1536px;
}

.app-container-full {
    max-width: none;
}

/* ===== 헤더/푸터 ===== */
.app-header, .app-footer {
    width: 100%;
    min-height: var(--header-height);
    align-items: center;
    box-sizing: border-box;
    z-index: var(--z-header);
    transition: all var(--transition-normal);

}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 999;
}

/* 헤더 글자색 변경을 위한 css */
.header-footer {
    color: #222;
    transition: color .2s ease, fill .2s ease;
}

.header-footer a,
.header-footer a:hover,
.header-footer a:active {
    color: inherit;
}

/* 어두운 배경 위에 있을 때(=섹션이 data-header-theme="light") */
.header-footer.is-light {
    color: #cccccc;
}

.header-footer.is-light a:hover {
    color: #a5a5a5;
}

.header-footer.is-light a:active {
    color: #cccccc;
}

.app-header .app-container {
    padding: var(--container-padding);
    height: 100%;
}

.app-header nav {
    height: var(--header-height) - var(--container-padding);
}

.app-footer {
    min-height: var(--footer-height);
    padding: var(--gutter-lg) var(--container-padding);
}

/* 헤더 변형 */
.app-header-sticky {
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
}

.app-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

/* ===== 네비게이션 스타일 ===== */
/* 데스크톱 네비게이션 */
.desktop-nav {
    display: flex;
    align-items: center;
}

/* 모바일에서 데스크톱 네비게이션 숨김 */
@media (max-width: 768px) {
    .app-header .desktop-nav {
        display: none !important;
    }

    .app-header .nav-menu,
    .app-header .user-menu {
        display: none !important;
    }

    .app-header .nav-menu li,
    .app-header .user-menu li {
        display: none !important;
    }
}

.nav-menu,
.user-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.nav-menu li,
.user-menu li {
    margin: 0;
}

.nav-link {
    color: var(--nav-link-color);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--nav-link-hover-color);
    text-decoration: none;
}

.nav-link i {
    margin-right: 4px;
    font-size: 14px;
}

/* ===== 모바일 햄버거 버튼 개선 ===== */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

/* 모바일에서 햄버거 버튼 표시 */
@media (max-width: 768px) {
    .app-header .mobile-menu-btn {
        display: flex !important;
    }
}

.mobile-menu-btn:hover,
.mobile-menu-btn:focus {
    outline: none;
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: var(--hamburger-color);
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* active 상태에서 X자 만들기 */
.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== 메인/콘텐츠 ===== */
.app-main {
    max-width: var(--container-max-width);
    padding: var(--header-height) 20px 20px 20px; /* 상단에 헤더 높이만큼 패딩 추가 */
    box-sizing: border-box;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}

/* 모바일에서 헤더 높이 조정 */
@media (max-width: 768px) {
    .app-main {
        padding-top: calc(var(--header-height-mobile) + 52px); /* 모바일 헤더 + 상단바 높이 */
    }
}

/* 데스크톱에서 헤더 높이 적용 */
@media (min-width: 769px) {
    .app-main {
        padding-top: var(--header-height); /* 헤더 높이만 적용 */
    }
}

/* 헤더 상단바 스타일
프로젝트에 따라  사용안하는 경우 발생*/

.header-topbar {
    width: 100%;
    background: #2b2b2b;
    font-size: 12px;
    height: 19px;
    padding: 12px 0px;
}

.topbar-link {
    color: #d3d3d3;
    text-decoration: none;
}

.topbar-link:hover {
    color: #ffffff;
}

.topbar-user {
    color: #d3d3d3;
    font-weight: 500;
}

/* ===== 콘텐츠 영역 (사이드바와 함께) ===== */
.app-content {
    padding: var(--gutter-lg) 0;
    transition: margin-left var(--transition-normal);
    min-height: 100vh;
}

/* 사이드바 없는 콘텐츠 */
.app-content-full {
    margin-left: 0;
}

/* ===== 그리드 레이아웃 ===== */
.layout-grid {
    display: grid;
    gap: var(--gutter-lg);
}

.layout-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.layout-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.layout-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.layout-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.layout-grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

.layout-grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 1024px) {
    .layout-grid {
        gap: var(--gutter-md);
    }

    .layout-grid-4, .layout-grid-5, .layout-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-link {
        padding: 10px 14px;
    }
}

@media (max-width: 640px) {
    .layout-grid {
        gap: var(--gutter-sm);
    }

    .layout-grid-2, .layout-grid-3, .layout-grid-4,
    .layout-grid-5, .layout-grid-6 {
        grid-template-columns: 1fr;
    }

    .nav-link {
        padding: 12px 16px;
    }
}

/* 그리드 아이템 스팬 */
.grid-span-2 {
    grid-column: span 2;
}

.grid-span-3 {
    grid-column: span 3;
}

.grid-span-4 {
    grid-column: span 4;
}

.grid-span-full {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .grid-span-2, .grid-span-3, .grid-span-4 {
        grid-column: span 1;
    }
}

/* ===== 플렉스 레이아웃 ===== */
.layout-flex {
    display: flex;
}

.flex-row {
    flex-direction: row;
}

.flex-col {
    flex-direction: column;
}

.flex-center {
    align-items: center;
    justify-content: center;
}

.flex-between {
    align-items: center;
    justify-content: space-between;
}

.flex-around {
    align-items: center;
    justify-content: space-around;
}

.flex-evenly {
    align-items: center;
    justify-content: space-evenly;
}

.flex-start {
    align-items: flex-start;
    justify-content: flex-start;
}

.flex-end {
    align-items: flex-end;
    justify-content: flex-end;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

/* 플렉스 아이템 */
.flex-1 {
    flex: 1;
}

.flex-auto {
    flex: auto;
}

.flex-none {
    flex: none;
}

.flex-grow {
    flex-grow: 1;
}

.flex-shrink {
    flex-shrink: 1;
}

/* ===== 간격(Gap) 유틸리티 ===== */
.gap-xs {
    gap: var(--gutter-xs);
}

.gap-sm {
    gap: var(--gutter-sm);
}

.gap-md {
    gap: var(--gutter-md);
}

.gap-lg {
    gap: var(--gutter-lg);
}

.gap-xl {
    gap: var(--gutter-xl);
}

/* 방향별 간격 */
.gap-x-xs {
    column-gap: var(--gutter-xs);
}

.gap-x-sm {
    column-gap: var(--gutter-sm);
}

.gap-x-md {
    column-gap: var(--gutter-md);
}

.gap-x-lg {
    column-gap: var(--gutter-lg);
}

.gap-x-xl {
    column-gap: var(--gutter-xl);
}

.gap-y-xs {
    row-gap: var(--gutter-xs);
}

.gap-y-sm {
    row-gap: var(--gutter-sm);
}

.gap-y-md {
    row-gap: var(--gutter-md);
}

.gap-y-lg {
    row-gap: var(--gutter-lg);
}

.gap-y-xl {
    row-gap: var(--gutter-xl);
}


/* ===== z-index 레이어 ===== */
.z-header {
    z-index: var(--z-header);
}

.z-mobile-nav {
    z-index: var(--z-mobile-nav);
}

.z-modal {
    z-index: var(--z-modal);
}

.z-dropdown {
    z-index: var(--z-dropdown);
}

.z-tooltip {
    z-index: var(--z-tooltip);
}

/* ===== 포지션 유틸리티 ===== */
.position-relative {
    position: relative;
}

.position-absolute {
    position: absolute;
}

.position-fixed {
    position: fixed;
}

.position-sticky {
    position: sticky;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}

.sticky-bottom {
    position: sticky;
    bottom: 0;
    z-index: var(--z-header);
}

/* ===== 크기 유틸리티 ===== */
.w-full {
    width: 100%;
}

.w-auto {
    width: auto;
}

.w-fit {
    width: fit-content;
}

.w-screen {
    width: 100vw;
}

.h-full {
    height: 100%;
}

.h-auto {
    height: auto;
}

.h-fit {
    height: fit-content;
}

.h-screen {
    height: 100vh;
}

.min-h-screen {
    min-height: 100vh;
}

/* ===== 오버플로우 ===== */
.overflow-auto {
    overflow: auto;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-visible {
    overflow: visible;
}

.overflow-scroll {
    overflow: scroll;
}

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-x-hidden {
    overflow-x: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

.overflow-y-hidden {
    overflow-y: hidden;
}


/* ===== 섹션/영역 ===== */
.section {
    padding: var(--gutter-xl) 0;
}

.section-sm {
    padding: var(--gutter-lg) 0;
}

.section-md {
    padding: var(--gutter-xl) 0;
}

.section-lg {
    padding: calc(var(--gutter-xl) * 2) 0;
}

.section-xl {
    padding: calc(var(--gutter-xl) * 3) 0;
}

.border-radius {
    border-radius: 25px;
}

.none-border {
    border: none !important;
}

.none-shadow {
    box-shadow: none !important;
}

/* ===== 접근성 ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.not-sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* 포커스 가시성 개선 */
.focus-visible:focus-visible,
.mobile-menu-btn:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* ===== 다크모드 대응 ===== */
@media (prefers-color-scheme: dark) {

    .app-mobile-nav {
        background: rgba(30, 41, 59, 0.95);
        border-color: rgba(71, 85, 105, 0.5);
    }
}

/* ===== 고대비 모드 대응 ===== */
@media (prefers-contrast: more) {
    .app-header {
        border-bottom-width: 2px;
    }

    .nav-link {
        border: 1px solid transparent;
    }

    .nav-link:hover,
    .nav-link:focus {
        border-color: currentColor;
    }

    .card {
        border: 1px solid currentColor;
    }
}

/* ===== 애니메이션 감소 대응 ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hamburger-line,
    .nav-link
    .mobile-menu-btn {
        transition: none !important;
    }
}

/* ===== 데모용 스타일 ===== */
.demo-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.demo-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-inner-img {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
}

.input-inner-img:hover {
    cursor: pointer;
    transform: translateY(-50%) scale(1.2); /* 살짝 확대 */
    filter: brightness(1.3) contrast(1.1); /* 밝기 + 선명도 증가 */
    opacity: 0.9; /* 약간 투명도 조정 */
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.app-inner-sub-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* 로고 반응형 크기 조정 */
@media (max-width: 1024px) {
    .logo {
        width: 130px !important;
    }
}