/* SiteBox - Main Page Styles - Figma Inspired Clean Design */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #FAFAFA;
  color: #1D1D1F;
  line-height: 1.5;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* ====================
   HEADER
   ==================== */
.header {
  background-color: #fff;
  border-bottom: 1px solid #E5E5E5;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ajd-logo {
  height: 28px;
  width: auto;
}

.logo {
  font-size: 20px;
  font-weight: 600;
  color: #1D1D1F;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-bar {
  flex: 1;
  max-width: 400px;
}

.search-bar input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1px solid #D0D0D0;
  border-radius: 8px;
  font-size: 13px;
  background-color: #FAFAFA;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  outline: none;
  transition: all 0.2s;
}

.search-bar input:focus {
  background-color: #fff;
  border-color: #0071E3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.user-menu {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.auth-buttons {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn-primary {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  background-color: #0071E3;
  color: #fff;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: #0062CC;
}

.btn-secondary {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  background-color: #fff;
  color: #1D1D1F;
  border: 1px solid #D0D0D0;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: #F5F5F5;
  border-color: #999;
}

/* User Dropdown */
.user-dropdown {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background-color: #FAFAFA;
  border: 1px solid #D0D0D0;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.user-button:hover {
  background-color: #F5F5F5;
  border-color: #999;
}

.dropdown-arrow {
  font-size: 10px;
  color: #999;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background-color: #fff;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu .user-info {
  padding: 12px 14px;
  background-color: #F9F9F9;
  border-bottom: 1px solid #E5E5E5;
}

.dropdown-menu .user-info p {
  font-size: 12px;
  color: #666;
  margin: 2px 0;
}

.dropdown-menu hr {
  border: none;
  border-top: 1px solid #F0F0F0;
  margin: 0;
}

.dropdown-menu a {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: #1D1D1F;
  text-decoration: none;
  transition: background-color 0.15s;
}

.dropdown-menu a:hover {
  background-color: #F5F5F5;
}

/* ====================
   MAIN LAYOUT
   ==================== */
.main-container {
  display: flex;
  min-height: calc(100vh - 60px);
  background-color: #FAFAFA;
}

/* Sidebar */
.sidebar {
  width: 200px;
  background-color: #fff;
  border-right: 1px solid #E5E5E5;
  padding: 16px 12px;
  flex-shrink: 0;
}

.category-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.category-menu hr {
  border: none;
  border-top: 1px solid #F0F0F0;
  margin: 8px 0;
}

#categoryList {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.category-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 400;
}

.category-item:hover {
  background-color: #F5F5F5;
  color: #1D1D1F;
}

.category-item.active {
  background-color: #E3F2FD;
  color: #0071E3;
  font-weight: 500;
}

/* Content Area */
.content {
  flex: 1;
  padding: 24px 32px;
  background-color: #FAFAFA;
  overflow-y: auto;
}

.content-header {
  margin-bottom: 20px;
}

.content-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #1D1D1F;
}

.content-header p {
  font-size: 13px;
  color: #999;
}

/* ====================
   CARDS
   ==================== */
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card,
.site-card {
  background-color: #fff;
  border: 1px solid #E5E5E5;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card:hover,
.site-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border-color: #D0D0D0;
}

.card-thumbnail-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, #F5F5F7 0%, #E8E8ED 100%);
  display: block;
}

/* 오버레이 배지 */
.badge-overlay {
  position: absolute;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 2;
}

.level-overlay {
  top: 8px;
  left: 8px;
}

.status-overlay {
  bottom: 8px;
  right: 8px;
}

/* 즐겨찾기 버튼 오버레이 */
.favorite-button-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 3;
  padding: 4px;
  line-height: 1;
  color: #FFFFFF;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.favorite-button-overlay:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.favorite-button-overlay.active {
  color: #FFD700;
}

.card-content {
  padding: 14px 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
  line-height: 1.3;
  color: #1D1D1F;
}

/* 썸네일 없는 카드 - 텍스트 중앙 배치 */
.card-thumbnail-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAFAFA;
  padding: 20px;
}

.card-thumbnail-text .thumbnail-title {
  font-size: 24px;
  font-weight: 700;
  color: #1D1D1F;
  text-align: center;
  line-height: 1.3;
  word-break: keep-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.card-creator {
  font-size: 12px;
  color: #86868B;
  margin-bottom: 8px;
  font-weight: 400;
}

.card-description {
  font-size: 13px;
  color: #6E6E73;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ====================
   BADGES
   ==================== */
.badge,
.badge-overlay {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  display: inline-block;
  letter-spacing: 0.2px;
}

/* Level Badge - 원형 */
.level-overlay.badge-overlay {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Level Badges */
.level-1 { 
  background-color: rgba(232, 245, 233, 0.95); 
  color: #2E7D32;
  border: 1px solid rgba(165, 214, 167, 0.8);
}
.level-2 { 
  background-color: rgba(227, 242, 253, 0.95); 
  color: #1565C0;
  border: 1px solid rgba(144, 202, 249, 0.8);
}
.level-3 { 
  background-color: rgba(255, 243, 224, 0.95); 
  color: #EF6C00;
  border: 1px solid rgba(255, 204, 128, 0.8);
}
.level-4 { 
  background-color: rgba(252, 228, 236, 0.95); 
  color: #C2185B;
  border: 1px solid rgba(244, 143, 177, 0.8);
}
.level-5 { 
  background-color: rgba(243, 229, 245, 0.95); 
  color: #7B1FA2;
  border: 1px solid rgba(206, 147, 216, 0.8);
}

/* Status Badges */
.status-active { 
  background-color: rgba(232, 245, 233, 0.95); 
  color: #2E7D32;
  border: 1px solid rgba(165, 214, 167, 0.8);
}
.status-maintenance { 
  background-color: rgba(255, 243, 224, 0.95); 
  color: #EF6C00;
  border: 1px solid rgba(255, 204, 128, 0.8);
}
.status-inactive { 
  background-color: rgba(255, 235, 238, 0.95); 
  color: #C62828;
  border: 1px solid rgba(239, 154, 154, 0.8);
}
.status-development { 
  background-color: rgba(225, 245, 254, 0.95); 
  color: #0277BD;
  border: 1px solid rgba(129, 212, 250, 0.8);
}

/* ====================
   FAVORITE BUTTON (Legacy - 사용하지 않음)
   ==================== */
.favorite-button {
  background: none;
  border: none;
  font-size: 18px;
  padding: 4px;
  color: #D0D0D0;
  transition: all 0.25s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.favorite-button:hover {
  color: #FFB800;
  transform: scale(1.15);
}

.favorite-button.active {
  color: #FFB800;
}

/* ====================
   MODAL
   ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #E5E5E5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: #1D1D1F;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.close-modal:hover {
  background-color: #F5F5F5;
  color: #1D1D1F;
}

.modal-body {
  padding: 24px;
}

.modal-thumbnail {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  margin-bottom: 24px;
  border-radius: 8px;
  background: #F5F5F5;
}

.modal-info {
  display: grid;
  gap: 16px;
}

.info-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

.info-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.info-value {
  font-size: 14px;
  color: #1D1D1F;
  line-height: 1.5;
}

/* ====================
   LOADING & MESSAGES
   ==================== */
.loading-spinner {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid #F0F0F0;
  border-top-color: #0071E3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-message {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 14px;
}

/* ====================
   SITE DETAIL MODAL
   ==================== */
.site-detail-modal {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.site-detail-modal .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: 50%;
  font-size: 24px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.site-detail-modal .modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.modal-layout {
  display: flex;
  gap: 0;
}

.modal-left {
  flex: 1;
  min-width: 0;
}

.modal-right {
  width: 480px;
  flex-shrink: 0;
  background: #F8F8FA;
  padding: 20px;
  border-left: 1px solid #E5E5E5;
  border-radius: 0 12px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-section {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #EBEBEB;
  display: flex;
  flex-direction: column;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1D1D1F;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F0F0F0;
}

.modal-section-content {
  font-size: 13px;
  line-height: 1.7;
  color: #666;
  white-space: pre-wrap;
}

.guide-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #0071E3;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.guide-link:hover {
  background: #005BBB;
}

.site-detail-modal .modal-thumbnail {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px 0 0 0;
  margin: 0;
}

.site-detail-modal .modal-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-detail-modal .modal-body {
  padding: 24px;
}

.site-detail-modal .modal-body h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1D1D1F;
}

.modal-creator {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.modal-description {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 16px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-tags .tag-item {
  background-color: #E8F4FD;
  color: #0071E3;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.site-detail-modal .modal-info {
  margin-bottom: 20px;
}

.modal-category {
  display: inline-block;
  background-color: #F5F5F5;
  color: #666;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #E5E5E5;
}

.modal-actions button {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-actions .btn-secondary {
  background: #fff;
  border: 1px solid #E5E5E5;
  color: #1D1D1F;
}

.modal-actions .btn-secondary:hover {
  background: #F5F5F5;
}

.modal-actions .btn-secondary.active {
  background: #FFF3CD;
  border-color: #FFD600;
  color: #856404;
}

.modal-actions .btn-primary {
  background: #0071E3;
  border: none;
  color: #fff;
}

.modal-actions .btn-primary:hover {
  background: #0062CC;
}

/* ====================
   RESPONSIVE
   ==================== */
@media (max-width: 1024px) {
  .card-container {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  .header-container {
    gap: 16px;
  }
  
  .search-bar {
    max-width: 300px;
  }
  
  .sidebar {
    width: 180px;
    padding: 12px 8px;
  }
  
  .content {
    padding: 20px 16px;
  }
  
  .card-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    display: none;
  }
  
  .card-container {
    grid-template-columns: 1fr;
  }
}
