/* ============================================
   SEHWA MRO B2B Platform - Common Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700;800;900&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  /* Primary Colors */
  --primary-900: #0a1628;
  --primary-800: #111d35;
  --primary-700: #1a2d4d;
  --primary-600: #1e3a5f;
  --primary-500: #2563eb;
  --primary-400: #3b82f6;
  --primary-300: #60a5fa;
  --primary-200: #93c5fd;
  --primary-100: #dbeafe;
  --primary-50: #eff6ff;

  /* Neutrals */
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;

  /* Accent Colors */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #6366f1;
  --info-light: #e0e7ff;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);

  /* Layout */
  --header-height: 56px;
  --sidebar-width: 240px;

  /* Typography */
  --font-sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Poppins', 'Noto Sans KR', sans-serif;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* ===== TOP HEADER BAR ===== */
.top-header {
  height: var(--header-height);
  background: var(--primary-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.top-header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-header__logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--white);
  letter-spacing: -0.5px;
}

.top-header__logo-sub {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.top-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-header__btn {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.top-header__btn--primary {
  background: var(--primary-500);
  color: var(--white);
}

.top-header__btn--primary:hover {
  background: var(--primary-400);
}

.top-header__btn--outline {
  border: 1px solid var(--gray-600);
  color: var(--gray-300);
}

.top-header__btn--outline:hover {
  border-color: var(--gray-400);
  color: var(--white);
}

.top-header__session {
  color: var(--gray-400);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.top-header__session span {
  color: var(--warning);
  font-weight: 600;
}

.top-header__user {
  background: var(--primary-600);
  color: var(--white);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-800);
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 900;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-600) transparent;
}

.sidebar__section-title {
  padding: 20px 20px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-300);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar__menu-title {
  padding: 16px 20px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar__menu-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary-500);
  border-radius: 2px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px 9px 32px;
  color: var(--gray-400);
  font-size: 0.85rem;
  transition: var(--transition-fast);
  border-left: 3px solid transparent;
}

.sidebar__link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--gray-200);
}

.sidebar__link--active {
  background: rgba(37, 99, 235, 0.15);
  color: var(--white);
  border-left-color: var(--primary-400);
  font-weight: 500;
}

.sidebar__badge {
  background: var(--danger);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}

/* ===== BREADCRUMB / TAB BAR ===== */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--gray-200);
}

.tab-bar__home {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.tab-bar__home:hover {
  background: var(--gray-100);
  color: var(--primary-500);
}

.tab-bar__item {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab-bar__item--active {
  color: var(--primary-500);
  border-bottom-color: var(--primary-500);
  font-weight: 600;
}

.tab-bar__close {
  font-size: 1rem;
  color: var(--gray-400);
  transition: var(--transition-fast);
}

.tab-bar__close:hover {
  color: var(--danger);
}

.breadcrumb {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-left: auto;
}

/* ===== PAGE TITLE ===== */
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 20px;
}

/* ===== STAT CARDS ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-base);
  cursor: pointer;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-200);
  transform: translateY(-1px);
}

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card__icon--blue {
  background: var(--primary-100);
  color: var(--primary-500);
}

.stat-card__icon--indigo {
  background: var(--info-light);
  color: var(--info);
}

.stat-card__icon--purple {
  background: var(--purple-light);
  color: var(--purple);
}

.stat-card__icon--green {
  background: var(--success-light);
  color: var(--success);
}

.stat-card__label {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

/* ===== PANEL / CARD ===== */
.panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel__header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}

.panel__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.panel__more {
  font-size: 0.8rem;
  color: var(--gray-500);
  transition: var(--transition-fast);
}

.panel__more:hover {
  color: var(--primary-500);
}

.panel__body {
  padding: 16px 20px;
}

/* ===== TABLE ===== */
.data-table {
  width: 100%;
}

.data-table thead th {
  background: var(--gray-50);
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 0.85rem;
  text-align: center;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.data-table tbody td:last-child {
  font-weight: 600;
  color: var(--gray-900);
}

/* ===== NOTICE LIST ===== */
.notice-list {
  display: flex;
  flex-direction: column;
}

.notice-item {
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition-fast);
  cursor: pointer;
}

.notice-item:last-child {
  border-bottom: none;
}

.notice-item:hover {
  color: var(--primary-500);
}

.notice-item__icon {
  color: var(--primary-400);
  font-size: 0.65rem;
}

.notice-item__text {
  font-size: 0.85rem;
}

.notice-item__date {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-left: auto;
  flex-shrink: 0;
}

/* ===== QUICK LINKS ===== */
.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-link {
  padding: 12px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: var(--transition-fast);
}

.quick-link:hover {
  border-color: var(--primary-300);
  color: var(--primary-500);
  background: var(--primary-50);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary-500);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--primary-600);
  box-shadow: var(--shadow-md);
}

.btn--secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn--secondary:hover {
  background: var(--gray-200);
}

.btn--danger {
  background: var(--danger);
  color: var(--white);
}

.btn--danger:hover {
  background: #dc2626;
}

.btn--success {
  background: var(--success);
  color: var(--white);
}

.btn--success:hover {
  background: #059669;
}

.btn--sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn--lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn--full {
  width: 100%;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input--error {
  border-color: var(--danger);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge--pending {
  background: var(--warning-light);
  color: #b45309;
}

.badge--approved {
  background: var(--success-light);
  color: #047857;
}

.badge--rejected {
  background: var(--danger-light);
  color: #b91c1c;
}

.badge--info {
  background: var(--info-light);
  color: #4338ca;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--gray-500);
  font-size: 1.2rem;
  transition: var(--transition-fast);
}

.modal__close:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.modal__body {
  padding: 24px;
}

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== TOAST / ALERT ===== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
}

.toast--success {
  background: var(--success);
  color: var(--white);
}

.toast--error {
  background: var(--danger);
  color: var(--white);
}

.toast--info {
  background: var(--primary-500);
  color: var(--white);
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== UTILITY ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== RESPONSIVE ===== */
.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: rgba(255,255,255,0.1);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 899;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 1200px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: var(--transition-base);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
