/* Base styles */
* {
  box-sizing: border-box;
}

/* Accordion styles */
.section-content {
  overflow: visible;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: none;
  opacity: 1;
}

.section-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.section-content.collapsed * {
  pointer-events: none;
}

h2:hover {
  background-color: rgba(102, 126, 234, 0.05);
  border-radius: 8px;
  padding: 8px;
  margin: -8px;
}

body { 
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #2d3748;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  margin-top: 24px;
  margin-bottom: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Header styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px 0;
  border-bottom: 2px solid transparent;
  background: linear-gradient(90deg, #667eea, #764ba2) left bottom no-repeat;
  background-size: 100% 2px;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Search section */
.search-section {
  margin-bottom: 32px;
  padding: 28px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.search-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.search-section h2 {
  margin: 0 0 24px 0;
  color: #1a202c;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Row layout */
.row { 
  display: flex; 
  gap: 16px; 
  align-items: center; 
  margin-bottom: 20px; 
}

.row input, .row select, .row button, .row textarea { 
  line-height: 1.5; 
}

/* Form elements */
label { 
  display: inline-block; 
  min-width: 140px; 
  font-weight: 600;
  color: #374151;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
}

input, select, textarea { 
  font-size: 15px; 
  padding: 12px 16px; 
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

/* Buttons */
button { 
  cursor: pointer; 
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px; 
  font-weight: 600;
  font-size: 14px;
  padding: 12px 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.025em;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover { 
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 10px 25px -5px rgba(102, 126, 234, 0.4);
}

.btn-info {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-info:hover {
  box-shadow: 0 10px 25px -5px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
  box-shadow: 0 10px 25px -5px rgba(100, 116, 139, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.4);
}

/* Status and error */
pre { 
  background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 20px; 
  border-radius: 16px; 
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.error { 
  color: #dc2626; 
  font-weight: 600;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  padding: 12px 16px;
  border-radius: 12px;
  border-left: 4px solid #dc2626;
}

/* Members grid */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
  max-height: 80vh;
  overflow-y: auto;
  padding-right: 8px;
}

/* 스크롤바 스타일링 */
.members-grid::-webkit-scrollbar {
  width: 8px;
}

.members-grid::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.members-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
}

.members-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.member-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.member-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.member-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

.member-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.member-photo-container {
  margin-right: 16px;
  position: relative;
}

.member-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
}

.member-photo:hover {
  border-color: #667eea;
  transform: scale(1.05);
}

.member-info h3 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a202c;
  letter-spacing: -0.025em;
}

.member-info p {
  margin: 4px 0;
  font-size: 0.95rem;
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.member-actions button {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
}

.no-members {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
  background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 20px;
  border: 2px dashed #cbd5e1;
}

.no-members i {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  color: #94a3b8;
}

.no-members p {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-weight: 700;
  color: white;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

td {
  font-weight: 500;
  color: #374151;
  transition: all 0.2s ease;
}

tr:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

tr:hover td {
  color: #1a202c;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .container {
    margin: 16px;
    padding: 20px;
    border-radius: 20px;
  }
  
  .header {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    text-align: center;
  }
  
  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .header h1 { 
    font-size: 1.75rem; 
  }
  
  .search-section {
    padding: 20px;
    margin-bottom: 24px;
  }
  
  .search-section h2 { 
    font-size: 1.3rem; 
    margin-bottom: 20px;
  }
  
  label { 
    min-width: 0; 
    margin-bottom: 8px;
  }
  
  .row { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 12px; 
  }
  
  input, select, textarea { 
    width: 100%; 
    padding: 14px 16px; 
    font-size: 16px; 
  }
  
  button { 
    width: 100%; 
    padding: 14px 20px; 
    font-size: 16px; 
  }
  
  .members-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .member-card {
    padding: 20px;
  }
  
  .member-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .member-actions button {
    width: 100%;
  }
  
  table {
    font-size: 14px;
    border-radius: 16px;
  }
  
  th, td {
    padding: 12px 16px;
  }
  
  th {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .container {
    margin: 8px;
    padding: 16px;
  }
  
  .header h1 {
    font-size: 1.5rem;
  }
  
  .search-section {
    padding: 16px;
  }
  
  .member-card {
    padding: 16px;
  }
  
  .member-photo {
    width: 48px;
    height: 48px;
  }
  
  .member-info h3 {
    font-size: 1.1rem;
  }
}

/* 통계분석 섹션 스타일 */
.statistics-card {
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.statistics-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.statistics-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

/* 통계 차트 애니메이션 */
.statistics-card .progress-bar {
  transition: width 0.8s ease-in-out;
}

/* 반응형 통계 카드 */
@media (max-width: 768px) {
  .statistics-card {
    padding: 15px;
    margin-bottom: 15px;
  }
  
  .statistics-card h3 {
    font-size: 1.1rem;
  }
  
  #overallStats {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 15px !important;
  }
  
  #overallStats > div {
    padding: 15px !important;
  }
  
  #overallStats i {
    font-size: 20px !important;
  }
  
  #overallStats > div > div:first-of-type {
    font-size: 20px !important;
  }
}

/* 로그인/회원가입 섹션 스타일 */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-header {
  margin-bottom: 30px;
}

.login-header h2 {
  color: #1e40af;
  margin: 0 0 10px 0;
  font-size: 1.8rem;
  font-weight: bold;
}

.login-header p {
  color: #64748b;
  margin: 0;
  font-size: 0.9rem;
}

/* 탭 스타일 */
.auth-tabs {
  display: flex;
  margin-bottom: 30px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-tab.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-tab:hover:not(.active) {
  color: #3b82f6;
}

/* 폼 스타일 */
.auth-form {
  text-align: left;
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #374151;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

/* 비밀번호 입력 필드 특별 스타일 */
.form-group input[type="password"],
.form-group input[type="text"] {
  padding-right: 50px; /* 토글 버튼 공간 확보 (모바일 대응) */
  min-height: 48px; /* 모바일 터치 최소 높이 */
  font-size: 16px; /* 모바일 줌 방지 */
}

/* 모바일에서 비밀번호 토글 버튼 개선 */
@media (max-width: 768px) {
  .form-group input[type="password"],
  .form-group input[type="text"] {
    padding-right: 55px; /* 모바일에서 더 넓은 공간 */
    font-size: 16px; /* iOS 줌 방지 */
    -webkit-appearance: none; /* iOS 기본 스타일 제거 */
    border-radius: 8px;
  }
  
  .password-toggle-btn {
    width: 44px !important; /* 모바일 최소 터치 영역 */
    height: 44px !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 6px !important;
    z-index: 10 !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    -webkit-tap-highlight-color: transparent !important; /* 터치 하이라이트 제거 */
  }
  
  .password-toggle-btn:active {
    background: rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-50%) scale(0.95) !important;
  }
  
  /* 입력 필드 포커스 시 토글 버튼이 가려지지 않도록 */
  .form-group input[type="password"]:focus,
  .form-group input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }
}

#togglePassword {
  transition: color 0.3s ease;
}

#togglePassword:hover {
  color: #3b82f6;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:invalid {
  border-color: #ef4444;
}

.auth-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.auth-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.error-message {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 5px;
  display: none;
}

.login-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.login-footer p {
  color: #64748b;
  font-size: 0.8rem;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* 반응형 인증 폼 */
@media (max-width: 480px) {
  .login-container {
    padding: 10px;
  }
  
  .login-card {
    padding: 30px 20px;
  }
  
  .login-header h2 {
    font-size: 1.5rem;
  }
  
  .auth-tabs {
    margin-bottom: 20px;
  }
  
  .auth-tab {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
  
  .form-group input {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
  
  .auth-btn {
    padding: 12px;
    font-size: 0.9rem;
  }
}