/* ============================================
   KTCS2 Portal Styles (메인과 동일)
   ============================================

   이 파일은 공통 CSS를 임포트하고
   KTCS2 프로젝트 전용 스타일을 정의합니다.

   공통 CSS 구조:
   - variables.css: 색상, 폰트, 간격 등 변수
   - layout.css: 페이지 레이아웃, 그리드 시스템
   - components.css: 버튼, 폼, 카드 등 컴포넌트

   주의: 이 파일의 모든 CSS는 공통 CSS 이후에 작성되어
   필요시 공통 설정을 오버라이드할 수 있습니다.

   ============================================ */

/* ==================== 공통 CSS 임포트 ==================== */
@import url('./variables.css');
@import url('./layout.css');
@import url('./components.css');

/* ==================== 1. 전역 설정 ==================== */

/* Pretendard 웹폰트 선언 */
@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-Thin.subset.woff2') format('woff2');
  font-weight: 100;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-ExtraLight.subset.woff2') format('woff2');
  font-weight: 200;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-Light.subset.woff2') format('woff2');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-Regular.subset.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-Medium.subset.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-SemiBold.subset.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-Bold.subset.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-ExtraBold.subset.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: 'Pretendard';
  src: url('/fonts/Pretendard-Black.subset.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

/* GalmuriMono 폰트 */
@font-face {
  font-family: 'GalmuriMono';
  src: url('/fonts/GalmuriMono11.woff2') format('woff2');
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 색상 팔레트 */
  --primary-color: #4A90E2;
  --secondary-color: #7ED321;
  --danger-color: #F5A623;
  --success-color: #50E3C2;
  --text-color: #333;
  --text-light: #666;
  --border-color: #E8E8E8;
  --bg-light: #F8F8F8;

  /* 그림자 */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* 둥글기 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* 간격 */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 15px;
  --spacing-lg: 20px;
  --spacing-xl: 30px;
  --spacing-2xl: 40px;

  /* 전환 */
  --transition: all 0.3s ease;
}

html, body {
  height: 100%;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-color);
  font-weight: 400;
}

body {
  background: #fff;
}

/* ==================== 2. Typography ==================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
}

p {
  line-height: 1.5;
}

/* ==================== 3. Components ==================== */

/* 버튼 */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #3d7dd1;
}

/* 로그인 버튼 */
#login-btn {
  background: #e8e3da;
  color: #333;
}

#login-btn:hover {
  background: #ddd4ca;
}

/* 로그인 버튼 행 */
.login-button-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.login-button-row #login-btn {
  width: 100%;
}

.login-button-row #signup-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 12px;
  background: #e8e3da;
  color: #333;
}

.login-button-row #signup-btn:hover {
  background: #ddd4ca;
}

/* 비밀번호 버튼 행 */
.password-buttons {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.password-buttons .btn {
  padding: 10px 12px;
  font-size: 14px;
  margin: 0;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 비밀번호 변경 버튼 */
#change-password-btn {
  background: #e8e3da;
  color: #333;
}

#change-password-btn:hover {
  background: #ddd4ca;
}

/* 비밀번호 찾기 버튼 */
#find-password-btn {
  background: #e8e3da;
  color: #333;
  padding: 8px 12px;
  font-size: 12px;
}

#find-password-btn:hover {
  background: #ddd4ca;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-color);
  border: none;
}

.btn-secondary:hover {
  background: #f0f0f0;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  width: 100%;
}

.btn .icon {
  font-size: 16px;
}

/* 폼 */
.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: var(--spacing-lg);
  display: flex;
  flex-direction: column;
}

.form-group__label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-color);
  margin-bottom: 8px;
}

.form-group__input {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  text-align: center;
  background-color: #f8f8fb;
}

.form-group__input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group__input::placeholder {
  color: var(--text-light);
}

/* select 필드 */
.form-group__input[type="select"],
select.form-group__input {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  background-color: #f8f8fb;
}

select.form-group__input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* readonly 필드 */
.form-group__input[readonly] {
  background-color: #f0f0f0;
  cursor: not-allowed;
}

/* 체크박스 */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: #333;
  margin-bottom: 15px;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #262626;
}

.checkbox-text {
  font-size: 13px;
  color: #555;
}

/* 에러 메시지 */
.login-error {
  padding: 12px 14px;
  background-color: #FEE;
  border: 1px solid #FCC;
  border-radius: var(--radius-sm);
  color: #C33;
  font-size: 14px;
  margin-top: 20px;
  margin-bottom: var(--spacing-lg);
}

.error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 400px;
  background: #fff;
  border-left: 4px solid var(--danger-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1060;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.error-content {
  padding: 20px;
  position: relative;
}

.error-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-light);
}

.error-content h3 {
  color: var(--danger-color);
  font-size: 16px;
  margin-bottom: 8px;
}

.error-content p {
  color: var(--text-light);
  font-size: 14px;
}

/* ==================== 4. Layouts ==================== */

/* 로딩 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading p {
  color: white;
  font-size: 16px;
}

/* 페이지 */
.page {
  min-height: 100vh;
}

/* ==================== 5. Pages ==================== */

/* 로그인 페이지 */
#login-page {
  background: #f4f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  min-height: 100vh;
  position: relative;
  z-index: 100;
}

/* 로그인 페이지가 hidden일 때 */
#login-page.hidden {
  display: none;
  pointer-events: none;
  z-index: 1;
}

.login-container {
  width: 100%;
  max-width: 500px;
  padding: 20px;
}

.login-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-box__header {
  background: #262626;
  color: white;
  padding: var(--spacing-2xl) var(--spacing-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.login-box__header h1 {
  font-size: 40px;
  font-weight: 700;
  margin-bottom: 5px;
}

.login-box__header p {
  font-size: 14px;
  opacity: 0.9;
}

.login-box__content {
  padding: var(--spacing-2xl) var(--spacing-xl);
}

.login-box__content h2 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--text-color);
}

.login-box__subtitle {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: var(--spacing-2xl);
  line-height: 1.5;
}

.login-box__features {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
}

.feature-item {
  padding: var(--spacing-md);
  background: var(--bg-light);
  border-radius: var(--radius-md);
  text-align: center;
}

.feature-item__icon {
  font-size: 24px;
  display: block;
  margin-bottom: 8px;
}

.feature-item h3 {
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-color);
}

.feature-item p {
  font-size: 12px;
  color: var(--text-light);
}

.login-box__footer {
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  font-family: 'GalmuriMono', monospace;
}

/* 메인 페이지 */
#main-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 70px;
  pointer-events: auto;
  z-index: 100;
}

/* 메인 페이지가 hidden일 때 */
#main-page.hidden {
  display: none;
  pointer-events: none;
  z-index: 1;
}

/* 앱 컨테이너 (스크롤 영역) */
#app-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 70px;
  transition: padding-top 0.2s ease;
}

/* 헤더 */
.header {
  background: linear-gradient(to bottom, #F0ECE4, #F0ECE4 calc(100% - 1px), transparent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header__content {
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

.header__logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__logo h1 {
  font-size: 24px;
  color: #000000;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

.header__logo-img {
  height: 36px;
  width: auto;
  box-shadow: inset 0 0 0 5px #eeeae1;
}

/* Breadcrumb 스타일 */
.header__breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #666;
}

.breadcrumb__link {
  color: #0066cc;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.breadcrumb__link:hover {
  color: #0052a3;
  text-decoration: underline;
}

.breadcrumb__separator {
  color: #ccc;
  margin: 0 4px;
}

.breadcrumb__current {
  color: #333;
  font-weight: 500;
}

.header__user {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* 사용자 메뉴 드롭다운 */
.user-menu {
  position: relative;
}

.user-menu__trigger {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: right;
}

.user-menu__trigger-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
}

.user-menu__name {
  font-weight: 600;
  font-size: 14px;
}

.user-menu__info-inline {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #666;
}

.user-menu__info-inline span:not(:empty)::before {
  content: '';
}

.user-menu__info-inline span:not(:empty) {
  display: inline;
}

.user-menu__info-inline span + span:not(:empty)::before {
  content: '|';
  margin: 0 4px;
  color: #ccc;
}

.user-menu__trigger:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.user-menu__arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.user-menu__trigger.active .user-menu__arrow {
  transform: rotate(180deg);
}

.user-menu__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-width: 160px;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 9999;
}

.user-menu__dropdown.active {
  display: block;
}

.user-menu__dropdown.show {
  display: block;
}

.user-menu__info {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-menu__info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-menu__info-label {
  font-size: 11px;
  color: #999;
  font-weight: 500;
  text-transform: uppercase;
}

.user-menu__info-value {
  font-size: 13px;
  color: #333;
  font-weight: 500;
}

.user-menu__divider {
  height: 1px;
  background-color: #eee;
}

.user-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.user-menu__item:hover {
  background-color: #f5f5f5;
}

.user-menu__item:last-child {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
}


/* 헤더 버튼 */
.btn-header {
  background-color: #e8e3da;
  color: #333;
  padding: 6px 12px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-header:hover {
  background-color: #ddd4ca;
}

/* 헤더 내 모든 버튼 크기 조정 */
.header__user .btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* 메인 컨테이너 */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: calc(100vh - 60px - 60px);
}

/* 메인 콘텐츠 */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-2xl) 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

/* 모든 페이지의 메인 콘텐츠 영역 - 가로 너비 제한 */
body > div.container > main > div {
  margin: 0 auto;
  max-width: 1300px;
  width: 100%;
  padding: 0 20px;
}

/* 프로젝트 관리 페이지 */
.projects-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-2xl) 20px;
  width: 100%;
}

/* 서비스 페이지 (구독, 판촉) */
.service-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-2xl) 20px;
  width: 100%;
}

.service-page h2 {
  font-size: 28px;
  margin-bottom: var(--spacing-lg);
  color: var(--text-color);
}

.service-page p {
  color: var(--text-light);
  margin-bottom: var(--spacing-lg);
}

/* 아이콘 선택 버튼 */
.icon-btn {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  aspect-ratio: 1;  /* 정사각형 */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
}

.icon-btn:hover {
  background: #e8f4f8;
  border-color: var(--primary-color);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* 이모지 아이템 */
.emoji-item {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.emoji-item:hover {
  background-color: #e8f4f8;
  transform: scale(1.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.emoji-item:active {
  transform: scale(0.95);
}

/* 관리자 배지 */
.manager-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #e8f4f8;
  color: var(--primary-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  border: 1px solid var(--primary-color);
}

.manager-badge .remove-btn {
  cursor: pointer;
  font-weight: bold;
  color: var(--primary-color);
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 50%;
  transition: all 0.2s;
}

.manager-badge .remove-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

/* 접근 대상 배지 */
.access-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #f0f7ff;
  color: #2563eb;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid #93c5fd;
}

.access-target-badge .remove-btn {
  cursor: pointer;
  font-weight: bold;
  color: #2563eb;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 50%;
  transition: all 0.2s;
}

.access-target-badge .remove-btn:hover {
  background-color: #2563eb;
  color: white;
}

.welcome-section {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.welcome-section h2 {
  font-size: 32px;
  color: var(--text-color);
  margin-bottom: 10px;
}

.welcome-section p {
  color: var(--text-light);
  font-size: 16px;
}

/* 서비스 카드 */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: var(--spacing-2xl);
}

.service-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.service-card__header {
  padding: 30px 20px;
  background: #F0ECE4;
  color: #333;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.service-card__icon {
  font-size: 40px;
  display: block;
  margin-bottom: 15px;
  height: 40px;
  line-height: 40px;
}

.service-card__logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  margin: 0 auto 15px auto;
  display: block;
}

.service-card__header h3 {
  font-size: 20px;
  margin-bottom: 5px;
}

.service-card__header p {
  font-size: 14px;
  opacity: 0.9;
  margin: 0;
}

.service-card__body {
  padding: 20px;
}

.service-card__body p {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 15px;
  line-height: 1.5;
}

.service-card__footer {
  padding: 15px 20px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.service-card__footer .btn {
  flex: 1;
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
  background-color: #e8e3da;
  color: #333;
  border: none;
}

.service-card__footer .btn:hover {
  background-color: #ddd4c8;
  color: #333;
}

.service-card__footer .btn:active {
  background-color: #d4c9bc;
}

/* 푸터 */
.footer {
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  padding: 8px 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 12px;
  margin-top: auto;
}

.footer p {
  margin: 0;
}

.footer-link {
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--primary-color) !important;
}

/* 커스텀 모달 (로그인/회원가입) - Bootstrap과 충돌 방지 */
.modal-custom {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

/* 커스텀 모달이 보일 때 */
.modal-custom.show {
  width: 100%;
  height: 100%;
  display: flex;
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin: 20px;
  z-index: 1;
}

.modal-header {
  background: var(--gradient-beige);
  color: #333;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.modal-header h2,
.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--modal-close-color);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--modal-close-hover);
}

.modal-body {
  padding: var(--spacing-2xl) var(--spacing-xl);
  max-height: 70vh;
  overflow-y: auto;
}

/* ==================== 유틸리티 클래스 ==================== */

/**
 * 스타일 가이드:
 * - 인라인 스타일 금지: 모든 스타일은 CSS 클래스로 관리
 * - 표시/숨김: .hidden / .visible 클래스 사용
 * - 모달: .hidden과 .show 클래스 조합 사용
 * - 에러: .login-error.show로 표시/숨김
 *
 * 예시:
 * - 요소 숨김: element.classList.add('hidden')
 * - 요소 표시: element.classList.remove('hidden')
 * - 모달 열기: element.classList.remove('hidden'); element.classList.add('show')
 * - 모달 닫기: element.classList.add('hidden'); element.classList.remove('show')
 */

/* 표시/숨김 */
.hidden {
  display: none;
}

.visible {
  display: block;
}

/* 모달 관련 */
.modal-custom {
  display: none;
}

.modal-custom.show {
  display: flex;
}

/* 폼 텍스트 */
.form-text {
  font-size: 12px;
  margin-top: 5px;
  color: #666;
}

.form-text.text-muted {
  color: #999;
}

/* 상대 위치 */
.position-relative {
  position: relative;
}

.position-absolute {
  position: absolute;
}

/* 배경/패딩 박스 */
.bg-light-gray {
  background: #f8f8fb;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.text-meta {
  margin: 0;
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}

.text-strong {
  margin: 0;
  font-weight: 600;
  color: #333;
}

.text-small-info {
  color: #666;
  display: block;
  margin-top: 5px;
}

/* 드롭다운 리스트 */
.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 10;
}

.dropdown-list.show {
  display: block;
}

/* 로그인 에러 메시지 */
.login-error {
  display: none;
}

.login-error.show {
  display: block;
}

/* ==================== 6. Utilities (반응형) ==================== */
@media (max-width: 768px) {
  /* 헤더 동적 높이 조정 */
  .header {
    min-height: auto;
    padding: 10px 12px;
  }

  .header__content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0;
  }

  .header__logo-section {
    flex: 1;
    min-width: 0;
    gap: 8px;
    display: flex;
    align-items: center;
  }

  .header__logo h1 {
    font-size: 18px;
    gap: 3px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header__logo-img {
    height: 24px;
    width: auto;
    flex-shrink: 0;
  }

  .header__breadcrumb {
    display: none;
  }

  .header__user {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
  }

  .user-menu__trigger {
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .user-menu__trigger-content {
    align-items: flex-end;
  }

  .user-menu__name {
    font-size: 11px;
    font-weight: 600;
  }

  .user-menu__info-inline {
    font-size: 9px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
  }

  .user-menu__info-inline span {
    display: block;
    line-height: 1.2;
  }

  .user-menu__info-inline span + span::before {
    content: none;
    margin: 0;
  }

  .user-menu__arrow {
    font-size: 9px;
  }

  /* 메인 페이지 padding 조정 */
  #main-page {
    padding-top: 0;
  }

  .login-box__content {
    padding: var(--spacing-xl) var(--spacing-lg);
  }

  .login-box__header {
    padding: var(--spacing-xl) var(--spacing-lg);
  }

  .login-box__header h1 {
    font-size: 32px;
  }

  .welcome-section h2 {
    font-size: 24px;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* 모바일 서비스 카드 컴팩트 */
  .service-card {
    border-radius: 8px;
  }

  .service-card__header {
    padding: 15px 12px;
  }

  .service-card__header h3 {
    font-size: 16px;
    margin: 8px 0 4px 0;
  }

  .service-card__header p {
    font-size: 12px;
    margin: 0;
  }

  .service-card__icon {
    font-size: 32px;
    margin-bottom: 8px;
  }

  .service-card__footer {
    padding: 10px 12px;
    gap: 8px;
  }

  .service-card__footer .btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .main-content {
    padding: var(--spacing-lg) 12px;
  }

  .projects-page {
    padding: var(--spacing-lg) 12px;
  }

  .service-page {
    padding: var(--spacing-lg) 12px;
  }

  /* 모달 모바일 최적화 */
  .modal-box {
    margin: 10px;
    max-width: calc(100% - 20px);
  }

  .modal-dialog {
    margin: 10px;
  }

  /* 버튼 행 모바일 최적화 */
  .login-button-row {
    gap: 8px;
  }

  .login-button-row #login-btn,
  .login-button-row #signup-btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  .password-buttons {
    gap: 8px;
  }

  .password-buttons .btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* 폼 그룹 가독성 */
  .form-group {
    margin-bottom: var(--spacing-md);
  }

  .form-group__input {
    font-size: 16px; /* iOS에서 zoom 방지 */
    padding: 10px 12px;
  }

  /* 로그인 컨테이너 최적화 */
  .login-container {
    padding: 10px;
  }

  .login-box {
    border-radius: var(--radius-md);
  }

  /* 서비스 카드 행 최적화 */
  .service-card__footer {
    flex-direction: column;
    gap: 8px;
  }

  .service-card__footer .btn {
    flex: 1;
    padding: 10px 12px;
  }

  /* 터치 최적화 - 최소 44px 높이 */
  .btn {
    min-height: 44px;
  }

  /* 사용자 메뉴 드롭다운 모바일 최적화 */
  .user-menu__dropdown {
    right: -10px;
    min-width: 180px;
  }

  /* 에러 메시지 모바일 위치 */
  .error-message {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
  }
}

/* ==================== 모달 통일 (Bootstrap + Custom) ==================== */

/* 1. Bootstrap 모달 - 전체 스크린 오버레이 */
.modal {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1050;
}

.modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  margin: 0;
  z-index: auto;
  overflow: auto;
}

.modal-backdrop {
  display: none !important;
}

/* 2. 모달 닫기 버튼 */
.btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z' fill='%23ffffff'/%3e%3c/svg%3e") no-repeat center;
  background-size: 1em 1em;
  border: none;
  padding: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.btn-close:hover {
  opacity: 1;
}

.btn-close:focus {
  outline: none;
  opacity: 1;
}

/* ==================== 관리자 탭 네비게이션 개선 ==================== */

/* 기존 탭 스타일 재정의 */
.admin-tabs-nav {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 0;
  margin: 0;
  position: sticky;
  top: 75px;
  z-index: 98;
  display: flex;
  align-items: center;
  min-height: 55px;
}

.admin-tabs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0;
  height: 100%;
}

.admin-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 30px;
  text-decoration: none;
  color: #495057;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  font-size: 16px;
  height: 55px;
  line-height: 1.2;
}

.admin-tab:hover {
  color: #007bff;
  background: #e7f3ff;
  border-bottom-color: #0056b3;
}

.admin-tab.active {
  color: #007bff;
  background: #fff;
  border-bottom-color: #007bff;
  font-weight: 600;
}

@media (max-width: 768px) {
  .admin-tabs-nav {
    min-height: 50px;
  }

  .admin-tab {
    padding: 0 18px;
    font-size: 14px;
    height: 50px;
  }

  /* 모바일: 판매현황 테이블 - 일시불, 구독 범례 폰트 크기 */
  #sales-chart-section tbody tr:nth-child(5) td:first-child,
  #sales-chart-section tbody tr:nth-child(6) td:first-child {
    font-size: 11px !important;
  }
}
