/* style.css */

/* 구글 폰트 불러오기 (Noto Sans KR) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

/* GS25 색상 테마 정의 */
:root {
    --primary-color: #00AEEF; /* GS25 메인 블루 */
    --secondary-color: #66CC00; /* GS25 메인 그린 */
    --text-color: #333;
    --background-color: #f4f7f9;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ★★★ 수정된 부분 ★★★ */
/* 전체 페이지 기본 스타일 */
body {
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    background-color: var(--background-color);
}

/* 로그인/회원가입 페이지만을 위한 중앙 정렬 스타일 */
.login-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* ==================
   Login & Register Page
   ================== */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}
.login-header {
    text-align: center;
    margin-bottom: 25px;
}
.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}
.login-header span {
    color: var(--primary-color);
}
.login-box {
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
}
.form-control {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}
.checkbox-group {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #555;
}
.checkbox-group input {
    margin-right: 8px;
}
.link-group {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}
.link-group a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.link-group a:hover {
    text-decoration: underline;
}
.error-message {
    color: #e74c3c;
    background-color: #fbe2e2;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}
.success-message {
    color: #27ae60;
    background-color: #e9f7ef;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}


/* ==================
   Main Header/Nav Bar
   ================== */
.main-header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 0 30px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
}
.header-container {
    display: flex;
    align-items: center;
    height: 60px;
}
.logo a {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
}
.logo span {
    color: var(--primary-color);
}
.main-nav {
    margin: 0 auto; /* 메뉴를 중앙에 자동 정렬 */
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}
.user-menu .logout-btn {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background-color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s;
}
.user-menu .logout-btn:hover {
    background-color: #0099d4;
}
.content-wrapper {
    padding: 80px 30px 30px;
    width: 100%;
    box-sizing: border-box;
}


/* ==================
   Dropdown Menu
   ================== */

/* ul, li 기본 구조 스타일 */
.main-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    height: 60px;
}
.main-nav li {
    position: relative; /* ★ 드롭다운의 기준점이 되도록 position: relative 적용 */
}

/* 메뉴 링크 스타일 */
.main-nav li > a {
    font-size: 15px;
    font-weight: 500;
    color: #555;
    text-decoration: none;
    padding: 20px 15px;
    display: block;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.main-nav li > a:hover {
    color: var(--primary-color);
}
.main-nav li > a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* 드롭다운 메뉴 기본 상태 (숨김) */
.dropdown-menu {
    display: none;
    position: absolute; /* ★ 기준점(li)에 맞춰 위치를 잡도록 absolute 적용 */
    top: 100%;          /* 부모 li 바로 아래에 위치 */
    left: 0;            /* ★ 부모 li의 왼쪽 끝에 정렬 (가장 중요) ★ */
    right: auto;        /* ★ 오른쪽 정렬 속성 초기화 ★ */
    background-color: #fff;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    min-width: 160px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    z-index: 1001;
}

/* 부모 li에 마우스를 올렸을 때 드롭다운 메뉴 보이기 */
.dropdown:hover .dropdown-menu {
    display: block;
}

/* 드롭다운 메뉴 안의 링크 스타일 */
.dropdown-menu li a {
    color: #333;
    padding: 12px 20px;
    display: block;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.dropdown-menu li a:hover {
    background-color: #f5f5f5;
}


/* ==================
   Page Header & Buttons
   ================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-header div {
    display: flex;
    gap: 10px;
}
.btn {
    display: inline-block;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    background-color: var(--primary-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s;
}
.btn:hover {
    background-color: #0099d4;
}
.btn-secondary {
    background-color: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    transition: all 0.2s ease-in-out;
}
.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
}


/* ============================
   Permission Page (Advanced)
   ============================ */
.permission-form {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
}
.permission-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #eaedf1;
    border-radius: 8px;
    overflow: hidden;
}
.permission-table th, .permission-table td {
    border: none;
    padding: 15px;
    text-align: left;
}
.permission-table tbody tr {
    border-bottom: 1px solid #eaedf1;
}
.permission-table tbody tr:last-child {
    border-bottom: none;
}
.permission-table th {
    background-color: #f9fafb;
    font-size: 14px;
    font-weight: 500;
}
.permission-table td {
    font-size: 15px;
    color: #333;
}
.permission-table td.checkbox-cell {
    text-align: center;
}
.permission-table input[type="checkbox"] {
    transform: scale(1.3);
    cursor: pointer;
}
.permission-table .group-header th {
    background-color: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 12px 15px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}
.form-actions {
    text-align: right;
    margin-top: 25px;
}
.toggle-switch input[type="checkbox"] {
    display: none;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 34px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.toggle-switch-label:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-switch-label {
    background-color: var(--primary-color);
}
.toggle-switch input:checked + .toggle-switch-label:before {
    transform: translateX(20px);
}


/* ==================
   Role Management Page
   ================== */
.role-management-container {
    display: flex;
    gap: 30px;
}
.role-list-box, .role-add-box {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    flex: 1;
}
.role-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.role-table th, .role-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #eaedf1;
}
.btn-delete {
    color: #e74c3c;
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
}


/* ==================
   Sidebar Layout
   ================== */

.page-container-with-sidebar {
    display: flex;
    gap: 30px;
}

.sidebar-nav {
    flex: 0 0 220px; /* 사이드바 너비 220px로 고정 */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    height: fit-content;
}

.sidebar-nav h3 {
    margin-top: 0;
    font-size: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav ul li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #555;
    font-size: 15px;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav ul li a:hover {
    background-color: #f4f7f9;
    color: var(--text-color);
}

.sidebar-nav ul li a.active {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 500;
}

.main-content {
    flex: 1; /* 남은 공간을 모두 차지 */
}
/* ==================
   Scroll Fix Code
   ================== */

/* 로그인 페이지가 아닌 모든 body 태그에 대한 스타일 강제 적용 */
body:not(.login-page-body) {
    height: auto;          /* 높이를 내용에 맞게 자동으로 조절 */
    display: block;        /* flex 관련 속성 초기화 */
    overflow-y: auto;      /* 세로 스크롤 항상 허용 */
}
/* === GS 공통 토큰(없으면 추가) =============================== */
:root{
  --gs-primary:#00AD5A;
  --gs-primary-600:#009351;
  --gs-bg:#F7F9FB;
  --gs-line:#E8EDF3;
  --gs-text:#1F2D3D;
  --gs-muted:#6B7A90;
  --radius:12px;
  --shadow:0 4px 16px rgba(0,0,0,.06);
}

/* === 사이드바 네비 표준화 ================================== */
.settings-sidebar .nav-item{ margin-bottom:4px; }
.settings-sidebar .nav-link{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px; color:var(--gs-text); text-decoration:none;
}
.settings-sidebar .nav-link:hover{ background:#F0F5F8; }
.settings-sidebar .nav-link.active{
  background:#E6F6EE; color:var(--gs-primary); font-weight:600;
}
.settings-sidebar .nav-icon{ width:18px; display:inline-flex; justify-content:center; }
.settings-sidebar .nav-text{ line-height:1; }

/* === 버튼 계열 일치 ======================================= */
.btn{ background:var(--gs-primary); color:#fff; border:none; padding:8px 14px; border-radius:10px; box-shadow:var(--shadow); }
.btn:hover{ background:var(--gs-primary-600); }
.btn:disabled{ opacity:.6; }
.btn.btn-secondary{
  background:#fff; color:var(--gs-text); border:1px solid var(--gs-line);
  box-shadow:none;
}

/* === 폼/검색바 일치 ======================================= */
.form-control{ height:36px; padding:6px 10px; border-radius:10px; border:1px solid var(--gs-line); }
.filter-bar{ background:#fff; border:1px solid var(--gs-line); border-radius:12px; padding:10px; }

/* === 테이블 일치 (권한 페이지와 동일 톤) ===================== */
.table-wrap{ background:#fff; border:1px solid var(--gs-line); border-radius:12px; overflow:hidden; box-shadow:var(--shadow); }
.permission-table{ width:100%; border-collapse:separate; border-spacing:0; }
.permission-table thead th{
  background:#F4F7FA; color:var(--gs-muted); font-weight:600; font-size:13px;
  border-bottom:1px solid var(--gs-line); padding:10px; text-align:left;
}
.permission-table tbody td{ border-bottom:1px solid var(--gs-line); padding:10px; font-size:14px; }
.permission-table tbody tr:hover{ background:#FAFCFF; }

/* === 레이아웃 가이드 ====================================== */
.page-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.content-wrapper{ padding:80px 24px 24px; } /* 헤더 fixed 대비 */


/* === Modal Inner Scroll Fix v2 === */
/* 1) Flex column + height cap on inner dialog (legacy or classed) */
#modal > .modal-dialog,
#modal > div {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
}

/* 2) Make the form the scroll container (no HTML change required) */
#modal form {
  display: flex;
  flex-direction: column;
  min-height: 0;                 /* allow children to shrink */
  overflow-y: auto;              /* ★ inner scroll lives here */
  -webkit-overflow-scrolling: touch; /* iOS momentum scroll */
}

/* 3) Keep action buttons visible */
#modal .modal-footer,
#modal .form-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 1;
  border-top: 1px solid var(--gs-line);
  padding-top: 10px;
}

/* 4) Optional: prevent body scroll bounce affecting modal */
#modal { overscroll-behavior: contain; }

