/* =========================================================
   학교 식권 관리 시스템 - main.css  (완전 자체포함)
   Font Awesome CDN 불필요 버전
   ========================================================= */

/* ── Google Fonts (선택적, 없어도 기본폰트로 동작) ─────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap');

:root {
  --primary:      #3b82f6;
  --primary-dark: #2563eb;
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #06b6d4;
  --secondary:    #6b7280;
  --bg:           #f1f5f9;
  --sidebar-bg:   #1e293b;
  --sidebar-w:    220px;
  --header-h:     56px;
  --footer-h:     40px;
  --white:        #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #94a3b8;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.12);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont,
  'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
code { font-family: 'SFMono-Regular', Consolas, monospace; }

/* ─── App Layout ─────────────────────────────────────── */
.app-wrapper   { display: flex; flex-direction: column; min-height: 100vh; }
.app-body      { display: flex; flex: 1; margin-top: var(--header-h); }

/* ─── Header ─────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(59,130,246,.15);
}
.header-left  { display: flex; align-items: center; gap: .75rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }

.brand {
  display: flex; align-items: center; gap: .5rem;
  color: var(--primary); font-size: 1.1rem; font-weight: 800;
  text-decoration: none; letter-spacing: -.02em;
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--secondary);
  padding: .4rem .5rem; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--bg); }

.user-info  { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.user-name  { font-weight: 700; color: var(--text); }

.btn-logout {
  background: none; border: 1px solid var(--border);
  color: var(--secondary); padding: .3rem .75rem;
  border-radius: var(--radius); cursor: pointer;
  font-size: .8rem; font-weight: 500; transition: all .15s;
  display: flex; align-items: center; gap: .3rem;
}
.btn-logout:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.logout-form { margin: 0; }

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: calc(100vh - var(--header-h));
  padding: .75rem 0 2rem;
  flex-shrink: 0;
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
}

.sidebar-menu         { list-style: none; }
.sidebar-section-title {
  padding: 1rem 1rem .3rem;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: #475569;
}

.sidebar-item a {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1rem;
  color: #94a3b8; font-size: .85rem; font-weight: 500;
  text-decoration: none; transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar-item a:hover   { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-item.active a  { color: #fff; background: rgba(59,130,246,.2); border-left-color: var(--primary); }
.sidebar-item a .fa, .sidebar-item a i { width: 1.1rem; text-align: center; flex-shrink: 0; }

/* ─── Main Content ─────────────────────────────────────── */
.main-content {
  flex: 1; padding: 1.5rem;
  overflow-x: auto;
  min-width: 0;
}

/* ─── Footer ─────────────────────────────────────────── */
.app-footer {
  height: var(--footer-h); background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
}
.footer-inner {
  width: 100%; padding: 0 1.5rem;
  display: flex; justify-content: space-between;
  font-size: .78rem; color: var(--text-muted);
}

/* ─── Page Header ─────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding-bottom: .875rem;
  border-bottom: 2px solid var(--border);
}
.page-title {
  font-size: 1.4rem; font-weight: 800;
  display: flex; align-items: center; gap: .5rem;
  color: var(--text);
}
.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: .2rem; }
.page-actions  { display: flex; gap: .5rem; }

/* ─── Panel ────────────────────────────────────────────── */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.panel-header {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: #fafbfc;
}
.panel-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.panel-body         { padding: 1.25rem; }
.panel-body.no-padding { padding: 0; }
.panel-footer {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.panel-warning .panel-header { background: #fffbeb; border-color: #fde68a; }
.mb-3 { margin-bottom: 1rem; }

/* ─── Stats Grid ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow); border-left: 4px solid transparent;
}
.stat-blue   { border-left-color: var(--primary); }
.stat-green  { border-left-color: var(--success); }
.stat-orange { border-left-color: var(--warning); }
.stat-red    { border-left-color: var(--danger);  }
.stat-icon   { font-size: 1.6rem; opacity: .75; }
.stat-label  { font-size: .78rem; color: var(--text-muted); margin-bottom: .15rem; }
.stat-value  { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat-blue .stat-value   { color: var(--primary); }
.stat-green .stat-value  { color: var(--success); }
.stat-orange .stat-value { color: var(--warning); }
.stat-red .stat-value    { color: var(--danger);  }

/* ─── Dashboard ─────────────────────────────────────────── */
.dashboard-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 960px) { .dashboard-panels { grid-template-columns: 1fr; } }

.quick-links      { display: flex; gap: 1rem; flex-wrap: wrap; }
.quick-link-card {
  display: flex; flex-direction: column; align-items: center;
  gap: .5rem; padding: 1.25rem 1.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  transition: all .15s; min-width: 110px;
}
.quick-link-card:hover {
  background: var(--primary); color: #fff;
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.quick-link-card span { font-size: .8rem; font-weight: 600; }

/* ─── Tables ────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td {
  padding: .7rem 1rem; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle;
}
.table th { font-weight: 700; }
.thead-dark th { background: #1e293b; color: #fff; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-striped tbody tr:nth-child(even) { background: #f8fafc; }
.table-sm th, .table-sm td { padding: .45rem .75rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem 1rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  font-size: .875rem; font-weight: 600; text-decoration: none;
  transition: all .15s; white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm   { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg   { padding: .7rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-primary       { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success       { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }
.btn-danger        { background: var(--danger); color: #fff; }
.btn-danger:hover  { filter: brightness(.9); }
.btn-warning       { background: var(--warning); color: #fff; }
.btn-info          { background: var(--info); color: #fff; }
.btn-secondary     { background: var(--secondary); color: #fff; }
.btn-secondary:hover { filter: brightness(.9); }

.btn-outline-primary  { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover  { background: var(--primary); color: #fff; }
.btn-outline-success  { background: #fff; color: var(--success); border-color: var(--success); }
.btn-outline-success:hover  { background: var(--success); color: #fff; }
.btn-outline-warning  { background: #fff; color: var(--warning); border-color: var(--warning); }
.btn-outline-warning:hover  { background: var(--warning); color: #fff; }
.btn-outline-danger   { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover   { background: var(--danger); color: #fff; }
.btn-outline-secondary { background: #fff; color: var(--secondary); border-color: var(--secondary); }
.btn-outline-secondary:hover { background: var(--secondary); color: #fff; }

/* ─── Badge ─────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .55rem;
  border-radius: 20px; font-size: .72rem; font-weight: 700;
}
.badge-primary   { background: #dbeafe; color: #1d4ed8; }
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-danger    { background: #fee2e2; color: #b91c1c; }
.badge-warning   { background: #fef3c7; color: #b45309; }
.badge-info      { background: #cffafe; color: #0e7490; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group    { margin-bottom: 1.1rem; }
.form-label    { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .35rem; }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control  {
  display: block; width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .875rem; color: var(--text); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-control-sm { padding: .3rem .6rem; font-size: .82rem; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }

.form-hint   { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }
.field-error { color: var(--danger); font-size: .78rem; margin-top: .2rem; display: block; }
.form-row    { display: flex; gap: 1rem; }
.form-row .col-6 { flex: 1; min-width: 0; }
.form-actions {
  display: flex; gap: .75rem; margin-top: 1.5rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.form-vertical { max-width: 100%; }

.input-group  { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); flex: 1; }
.input-addon  {
  padding: .5rem .75rem; background: var(--bg);
  border: 1px solid var(--border); border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--secondary); font-size: .875rem;
  display: flex; align-items: center; white-space: nowrap;
}
.btn-toggle-pw {
  padding: .5rem .75rem; background: var(--bg);
  border: 1px solid var(--border); border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer; color: var(--secondary); transition: all .15s;
}
.btn-toggle-pw:hover { background: var(--border); }

/* ─── Search Panel ──────────────────────────────────────── */
.search-panel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .875rem 1.25rem; margin-bottom: 1.25rem;
}
.search-row   { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.form-group-inline { display: flex; flex-direction: column; gap: .25rem; }
.form-group-inline label { font-size: .78rem; font-weight: 600; color: var(--secondary); }

/* ─── Info List ─────────────────────────────────────────── */
.info-list { display: grid; grid-template-columns: 120px 1fr; gap: .5rem .75rem; }
.info-list dt { font-weight: 600; color: var(--text-muted); font-size: .875rem; }
.info-list dd { margin: 0; font-size: .875rem; }

/* ─── Detail Grid ───────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1.25rem; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }

/* ─── Radio Card ────────────────────────────────────────── */
.radio-group { display: flex; gap: 1rem; }
.radio-card  {
  flex: 1; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1rem; cursor: pointer; transition: all .15s; position: relative;
}
.radio-card input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.radio-icon  { display: block; font-size: 1.4rem; color: var(--primary); margin-bottom: .4rem; }
.radio-label { display: block; font-weight: 700; }
.radio-desc  { display: block; font-size: .78rem; color: var(--text-muted); }

/* ─── Menu Grid ─────────────────────────────────────────── */
.menu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1rem;
}
.menu-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.menu-card:hover      { box-shadow: var(--shadow-md); }
.menu-card-disabled   { opacity: .6; }
.menu-card-body       { padding: 1.1rem; }
.menu-name   { font-size: 1rem; font-weight: 700; margin-bottom: .3rem; }
.menu-price  { font-size: 1.1rem; color: var(--primary); font-weight: 700; margin-bottom: .4rem; }
.menu-desc   { font-size: .8rem; margin-bottom: .5rem; color: var(--text-muted); }
.menu-status { margin-top: .4rem; }
.menu-card-footer {
  padding: .65rem 1rem; border-top: 1px solid var(--border);
  background: #f8fafc; display: flex; gap: .4rem; flex-wrap: wrap;
}

/* ─── Summary Bar ───────────────────────────────────────── */
.summary-bar {
  display: flex; gap: 2rem; padding: .75rem 1rem;
  background: #f8fafc; border-bottom: 1px solid var(--border); font-size: .875rem;
}

/* ─── Store Info Bar ────────────────────────────────────── */
.store-info-bar {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1rem; background: #eff6ff;
  border: 1px solid #bfdbfe; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: .875rem;
}

/* ─── Pagination ────────────────────────────────────────── */
.pagination-nav { display: flex; align-items: center; gap: 1rem; }
.pagination     { display: flex; list-style: none; gap: .25rem; }
.page-link {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); font-size: .82rem; transition: all .15s;
}
.page-link:hover           { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-item.active .page-link { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-info { font-size: .8rem; color: var(--text-muted); }

/* ─── Alert ─────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem; font-size: .875rem;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info    { background: #cffafe; color: #0e7490; border: 1px solid #67e8f9; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 300; display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--white); border-radius: var(--radius);
  width: 480px; max-width: 95vw; box-shadow: var(--shadow-md);
}
.modal-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--secondary);
}
.modal-body   { padding: 1.25rem; }
.modal-footer {
  padding: .875rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .75rem;
}

/* ─── Login Page ────────────────────────────────────────── */
.login-page-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}

body:has(.login-page-wrapper) {
  background: linear-gradient(135deg, #1e293b 0%, #3b82f6 100%);
}

.login-container { width: 100%; display: flex; justify-content: center; }

.login-card {
  background: var(--white); border-radius: 16px; padding: 2.5rem;
  width: 420px; max-width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.login-brand     { text-align: center; margin-bottom: 2rem; color: var(--primary); }
.login-brand h2  { font-size: 1.5rem; font-weight: 800; margin: .75rem 0 .25rem; color: var(--text); }
.login-subtitle  { color: var(--text-muted); font-size: .85rem; }

.login-form .form-group { margin-bottom: .875rem; }

.login-notice {
  text-align: center; margin-top: 1.5rem;
  font-size: .8rem; color: var(--text-muted);
}

/* ─── Ticket Form ───────────────────────────────────────── */
.ticket-fields { animation: fadeIn .2s ease; }

/* ─── Misc ──────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.py-4         { padding-top: 1rem; padding-bottom: 1rem; }

code {
  background: #f1f5f9; padding: .15rem .4rem;
  border-radius: 4px; font-size: .85em; color: #c026d3;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -var(--sidebar-w); z-index: 150; transition: left .25s; }
  .sidebar.open { left: 0; }
  .main-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .page-header { flex-wrap: wrap; gap: .5rem; }
}