/* =====================================================
   ParkPlay Admin - 웹 레이아웃 CSS
   ===================================================== */

/* --- CSS 변수 --- */
:root {
    /* 사이드바 */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --sidebar-bg: #0f172a;
    --sidebar-hover-bg: #1e293b;
    --sidebar-active-bg: #059669;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-border: rgba(148, 163, 184, 0.1);

    /* 헤더 */
    --header-height: 60px;
    --header-bg: #ffffff;
    --header-border: #e2e8f0;
    --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

    /* 콘텐츠 */
    --content-bg: #f1f5f9;
    --content-padding: 24px;

    /* 색상 */
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #d1fae5;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #10b981;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --modal-overlay-bg: rgba(0, 0, 0, 0.5);
    --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    --phone-frame-bg: #1a1a2e;
    --phone-screen-bg: #f5f5f5;
    --phone-scrollbar: #ccc;
    --star-color: #FFD700;
    --map-placeholder-bg: #e8f0e8;

    /* 푸터 */
    --footer-height: 48px;
    --footer-bg: #ffffff;
    --footer-text: #94a3b8;

    /* 배지 */
    --badge-notice-bg: #e0f2fe;
    --badge-notice-text: #0369a1;
    --badge-event-bg: #fef3c7;
    --badge-event-text: #d97706;
    --badge-discount-bg: #fce7f3;
    --badge-discount-text: #be185d;

    /* 상태 색상 (light/dark 변형) */
    --danger-light: #fee2e2;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-dark: #991b1b;
    --danger-text: #b91c1c;
    --info-light: #dbeafe;
    --warning-light: #ffedd5;
    --purple: #8b5cf6;
    --purple-light: #ede9fe;
    --bg-muted: #f8fafc;

    /* 전환 */
    --transition-speed: 0.25s;

    /* 폰트 */
    --font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;

    /* === 예약서 모달 캘린더 / 슬롯 시맨틱 === */
    --cal-holiday-bg: #fef2f2;          /* 추가 휴무일 배경 */
    --cal-full-bg: #fee2e2;             /* 예약마감 배경 */
    --cal-full-fg: #991b1b;             /* 예약마감 텍스트 */
    --slot-booked-bg: #fef3c7;          /* 예약된 슬롯 배경 */
    --slot-booked-fg: #b45309;          /* 예약된 슬롯 텍스트 */
    --slot-booked-border: #fde68a;      /* 예약된 슬롯 테두리 */
}

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

body.web-admin {
    font-family: var(--font-family);
    background: var(--content-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* =====================================================
   사이드바
   ===================================================== */
.web-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease;
    overflow: hidden;
}

/* 로고 영역 */
.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    gap: 4px;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--sidebar-text-active);
}

.sidebar-logo i {
    font-size: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

.sidebar-logo .logo-text .accent {
    color: var(--primary);
}

.sidebar-logo .logo-sub {
    font-size: 11px;
    color: var(--sidebar-text);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* 업체 선택 드롭다운 */
.store-selector {
    position: relative;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.store-selector-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--sidebar-text-active);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-size: 13px;
    font-weight: 500;
}

.store-selector-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.store-selector-btn i.fa-store {
    color: var(--primary);
    font-size: 14px;
}

.store-selector-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-selector-arrow {
    font-size: 10px;
    color: var(--sidebar-text);
    transition: transform 0.2s ease;
}

.store-selector-list {
    position: absolute;
    top: calc(100% - 4px);
    left: 16px;
    right: 16px;
    background: var(--sidebar-hover-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    list-style: none;
    padding: 6px 0;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1010;
    display: none;
    max-height: 250px;
    overflow-y: auto;
}

.store-selector-list.show {
    display: block;
}

/* 스크롤바 (드롭다운) */
.store-selector-list::-webkit-scrollbar {
    width: 4px;
}
.store-selector-list::-webkit-scrollbar-track {
    background: transparent;
}
.store-selector-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.store-selector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}

.store-selector-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text-active);
}

.store-selector-item.active {
    color: var(--primary-light);
    font-weight: 500;
    background: rgba(5, 150, 105, 0.1);
}

.store-selector-item i.fa-check {
    margin-left: auto;
    color: var(--primary);
}

/* 사이드바 네비게이션 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}

/* 스크롤바 스타일 */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-hover-bg);
    border-radius: 4px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 메뉴 그룹 제목 */
.menu-group-title {
    padding: 20px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
    overflow: hidden;
}

/* 메뉴 링크 */
.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    border-radius: 8px;
    margin: 2px 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.menu-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.menu-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
}

.menu-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 500;
}

/* 메뉴 우측 카운트 배지 (승인 대기 등) — 값이 있을 때만 hidden 해제로 렌더 */
.menu-link .menu-badge {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--danger);
    color: var(--sidebar-text-active);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 18px;
}

/* 접힘 모드는 아이콘만 남는다 — 배지가 아이콘을 밀어내지 않게 숨김 */
body.sidebar-collapsed .menu-link .menu-badge {
    display: none;
}

/* 서브메뉴 접이식 */
.has-submenu .submenu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
}

.has-submenu.open .submenu {
    display: block;
}

.submenu-link {
    display: block;
    padding: 8px 20px 8px 52px;
    font-size: 13px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: color 0.2s;
}

.submenu-link:hover {
    color: var(--sidebar-text-active);
}

.submenu-link.active {
    color: var(--primary-light);
    font-weight: 500;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* 사이드바 접힘 상태에서 서브메뉴 숨김 */
body.sidebar-collapsed .has-submenu .submenu {
    display: none;
}

body.sidebar-collapsed .submenu-arrow {
    display: none;
}

/* 사이드바 하단 */
.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-version {
    font-size: 11px;
    color: var(--sidebar-text);
    text-align: center;
    white-space: nowrap;
}

/* =====================================================
   사이드바 접힘 상태
   ===================================================== */
body.sidebar-collapsed .web-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-logo .logo-text,
body.sidebar-collapsed .sidebar-logo .logo-sub,
body.sidebar-collapsed .menu-link span,
body.sidebar-collapsed .sidebar-version {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease, width 0.15s ease;
}

body.sidebar-collapsed .menu-group-title {
    height: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: all 0.15s ease;
}

body.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .sidebar-logo a {
    justify-content: center;
}

body.sidebar-collapsed .menu-link {
    justify-content: center;
    padding: 12px 0;
    margin: 2px 8px;
    position: relative;
}

body.sidebar-collapsed .menu-link i {
    font-size: 18px;
}

/* 접힘 상태에서 호버 시 메뉴명 툴팁 — data-title 없는 메뉴가 빈 칩을 띄우지 않게 속성으로 게이트 */
body.sidebar-collapsed .menu-link[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    color: var(--sidebar-text-active);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* =====================================================
   메인 래퍼 (사이드바 우측)
   ===================================================== */
.web-main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

body.sidebar-collapsed .web-main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* =====================================================
   헤더
   ===================================================== */
.web-header {
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    flex-shrink: 0;
}

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

.sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--content-bg);
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    transition: all 0.2s ease;
    position: relative;
}

.header-icon-btn:hover {
    background: var(--content-bg);
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--header-bg);
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.header-user-btn::after {
    font-size: 10px;
}

.header-user-btn:hover {
    background: var(--content-bg);
    border-color: var(--primary);
}

.user-avatar {
    font-size: 22px;
    color: var(--primary);
}

.user-name {
    font-weight: 500;
    white-space: nowrap;
}

/* 드롭다운 스타일 오버라이드 */
.header-user .dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--card-hover-shadow);
    border-radius: 8px;
    padding: 4px;
    min-width: 180px;
}

.header-user .dropdown-item {
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}

.header-user .dropdown-item:hover {
    background: var(--content-bg);
}

/* =====================================================
   콘텐츠 영역
   ===================================================== */
.web-content {
    flex: 1;
    padding: var(--content-padding);
}

/* =====================================================
   푸터
   ===================================================== */
.web-footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--footer-bg);
    border-top: 1px solid var(--header-border);
    flex-shrink: 0;
}

.web-footer p {
    font-size: 12px;
    color: var(--footer-text);
    margin: 0;
}

/* 푸터 링크(업체용 개인정보 처리방침) — 저작권 문구와 같은 톤으로 둔다.
   기본 파랑/밑줄이면 푸터에서 홀로 튀어 광고처럼 보이고 클릭률이 떨어진다. */
.web-footer a {
    color: inherit;
    text-decoration: underline;
}

.web-footer a:hover {
    color: var(--text-primary);
}

/* =====================================================
   사이드바 오버레이 (태블릿/모바일)
   ===================================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   반응형 - 태블릿 (1024px 이하)
   ===================================================== */
@media (max-width: 1024px) {
    .web-sidebar {
        transform: translateX(-100%);
    }

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

    .web-main-wrapper {
        margin-left: 0;
    }

    body.sidebar-collapsed .web-main-wrapper {
        margin-left: 0;
    }

    .web-content {
        padding: 16px;
    }
}

/* =====================================================
   반응형 - 모바일 (768px 이하)
   ===================================================== */
@media (max-width: 768px) {
    .web-header {
        padding: 0 16px;
    }

    .web-content {
        padding: 12px;
    }

    .user-name {
        display: none;
    }
}