/* ============================================
   FROM-US Academy - Premium Navy & Gold Theme
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --navy: #1A1A1A;
  --navy-dark: #0D0D0D;
  --navy-light: #2D2D2D;
  --gold: #C5A55A;
  --gold-light: #D4B97A;
  --gold-pale: #F5EFE0;
  --gold-dark: #A8893E;
  --primary: var(--navy);
  --primary-dark: var(--navy-dark);
  --primary-light: #F0ECE3;
  --accent: var(--gold);
  --danger: #C0392B;
  --danger-light: #FADBD8;
  --success: #27AE60;
  --success-light: #D5F5E3;
  --text: #1A1A1A;
  --text-secondary: #7A7A7A;
  --bg: #F5F4F2;
  --white: #FFFFFF;
  --border: #E0DDD6;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* --- Navbar --- */
.navbar {
  background: var(--navy);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.navbar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}
.navbar-brand:hover { text-decoration: none; color: var(--gold-light); }
.navbar-brand img {
  height: 36px;
  width: auto;
}
.navbar-brand span { font-size: 1.5rem; }
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.navbar-user {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gold); color: var(--navy-dark); font-weight: 600; }
.btn-primary:hover { background: var(--gold-dark); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-outline {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.25);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); color: var(--white); border-color: rgba(255,255,255,0.4); }
.btn-outline-dark {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline-dark:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

/* --- Auth Page --- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #0D0D0D;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(197,165,90,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(197,165,90,0.04) 0%, transparent 50%),
    linear-gradient(180deg, #0D0D0D 0%, #1A1A1A 100%);
}
.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  border-top: 4px solid var(--gold);
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo img {
  height: 80px;
  width: auto;
  margin-bottom: 12px;
}
.auth-logo h1 {
  font-size: 1.6rem;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 1px;
}
.auth-logo p {
  color: var(--gold);
  font-size: 0.85rem;
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-tab.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: all 0.2s;
  background: var(--white);
}
.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,150,78,0.15);
}
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.auth-success {
  background: var(--success-light);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* --- Board --- */
.board-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.board-header h2 {
  font-size: 1.5rem;
  color: var(--navy);
  font-weight: 700;
}
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  color: var(--text-secondary);
}
.filter-chip:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}
.filter-chip.active {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--navy);
}

/* --- Card Grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold);
}
.card-thumb {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, #1A1A1A 0%, #2D2D2D 100%);
  position: relative;
}
.card-thumb::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}
.card-body {
  padding: 16px;
}
.card-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gold-pale);
  color: var(--gold-dark);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
  color: var(--navy);
}
.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: 1rem; }

/* --- Admin --- */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}
.admin-container > h2 {
  color: var(--navy);
  font-weight: 700;
}
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.admin-tab {
  padding: 12px 24px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: var(--font);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-size: 0.95rem;
}
.admin-tab.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* --- Table --- */
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th {
  background: var(--navy);
  color: var(--gold-light);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
}
.data-table tr:hover { background: #F8F9FB; }
.data-table tr:last-child td { border-bottom: none; }

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-admin { background: var(--gold-pale); color: var(--gold-dark); }
.badge-user { background: var(--primary-light); color: var(--navy); }
.badge-blocked { background: var(--danger-light); color: var(--danger); }
.badge-published { background: var(--success-light); color: var(--success); }
.badge-draft { background: #F3F4F6; color: #6B7280; }
.badge-pending { background: #FEF3C7; color: #92400E; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s;
  border-top: 4px solid var(--gold);
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h3 { font-size: 1.25rem; color: var(--navy); font-weight: 700; }
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--bg); }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* --- Toggle Switch --- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #D1D5DB;
  border-radius: 12px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 12px;
  color: var(--text-secondary);
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--white);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--navy); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(27,42,74,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(27,42,74,0.4); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; height: 56px; }
  .navbar-brand { font-size: 1rem; }
  .navbar-brand img { height: 28px; }
  .navbar-user { display: none; }
  .auth-card { padding: 28px 20px; }
  .auth-logo h1 { font-size: 1.3rem; }
  .auth-logo img { height: 60px; }
  .board-container, .admin-container { padding: 16px; }
  .board-header { flex-direction: column; align-items: flex-start; }
  .card-grid { grid-template-columns: 1fr; gap: 16px; }
  .card-thumb { height: 120px; font-size: 3rem; }
  .admin-tabs { overflow-x: auto; }
  .admin-tab { padding: 10px 16px; font-size: 0.85rem; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 0.8rem; }
  .modal { padding: 24px 16px; }
  .btn { padding: 8px 16px; font-size: 0.85rem; }
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
