/* Google Fonts - Inter & Outfit */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --primary-color: #0284c7; /* Sky 600 */
  --primary-hover: #0369a1; /* Sky 700 */
  --bg-main: #f8fafc; /* Slate 50 */
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #64748b; /* Slate 500 */
  --border-color: #e2e8f0; /* Slate 200 */
  
  /* Status Colors */
  --color-active: #10b981; /* Attendance: Weekly */
  --color-warning: #f59e0b; /* Attendance: Monthly */
  --color-danger: #ef4444; /* Attendance: None */
  
  --font-title: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.03);
  --radius: 12px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

/* Sidebar (Filters) */
aside {
  width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary-color), #3b82f6);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-title);
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-title {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.filter-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  font-size: 0.9rem;
  background-color: white;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary-color);
}

.btn-reset {
  margin-top: auto;
  padding: 0.8rem;
  background-color: #f1f5f9;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-reset:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

/* Main Content */
main {
  flex-grow: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 95%; /* 전체 엑셀 열이 잘리지 않고 넓게 표시되도록 가로 최대 공간 확보 */
  margin: 0 auto;
  width: calc(100% - 320px);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 700;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.stats-card {
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stats-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stats-value {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

.stats-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Table Card Container */
.data-card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-header-info {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fafbfd;
}

.table-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Table Styling */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background-color: #fafbfd;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap; /* 헤더 텍스트 줄바꿈 방지 */
}

th:hover {
  color: var(--text-main);
}

td {
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap; /* 셀 내용 줄바꿈 방지 */
}

tr {
  transition: var(--transition);
}

tbody tr:hover {
  background-color: #f8fafc;
  cursor: pointer;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-male {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-female {
  background-color: #fce7f3;
  color: #be185d;
}

.badge-weekly {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-monthly {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-none {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.page-buttons {
  display: flex;
  gap: 0.35rem;
}

.page-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-btn.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background-color: white;
  width: 90%;
  max-width: 650px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f8fafc, #edf2f7);
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.info-value {
  font-size: 0.95rem;
  font-weight: 500;
}

.family-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.family-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.family-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.family-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.family-rel {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.8rem;
  background-color: #f0f9ff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  body {
    flex-direction: column;
  }
  aside {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
  }
  main {
    width: 100%;
    padding: 1.5rem;
  }
}

@media (max-width: 600px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

/* Loading Overlay & Spinner */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
}

/* Login Overlay & Card Style */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  width: 90%;
  max-width: 400px;
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.login-logo-icon {
  background: linear-gradient(135deg, var(--primary-color), #3b82f6);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 16px rgba(2, 132, 199, 0.3);
  margin-bottom: 0.5rem;
}

.login-logo h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.login-logo p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.input-group input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  font-size: 0.95rem;
  transition: var(--transition);
}

.input-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-login {
  width: 100%;
  padding: 0.85rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
}

.btn-login:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.login-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  text-align: center;
  font-weight: 500;
}

