/* 기본 스타일 리셋 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* 컨테이너 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 헤더 */
.header {
  text-align: center;
  margin-bottom: 40px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.title-section h1 {
  font-size: 3.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.title-section p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0;
}

/* 사용자 섹션 */
.user-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
}

.user-name {
  color: white;
  font-weight: 600;
  font-size: 1rem;
}

.logout-btn,
.history-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn {
  background: rgba(255, 107, 107, 0.9);
  color: white;
}

.logout-btn:hover {
  background: rgba(255, 107, 107, 1);
  transform: translateY(-2px);
}

.history-btn {
  background: rgba(74, 144, 226, 0.9);
  color: white;
}

.history-btn:hover {
  background: rgba(74, 144, 226, 1);
  transform: translateY(-2px);
}

/* 로그인 필요 메시지 */
.login-required {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.login-required h3 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 15px;
}

.login-required p {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 25px;
}

.quick-login-btn {
  padding: 15px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-login-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* 모달 스타일 */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

.history-modal {
  max-width: 900px;
  width: 95%;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 2rem;
  cursor: pointer;
  color: #aaa;
  transition: color 0.3s ease;
}

.close:hover {
  color: #333;
}

/* 메인 콘텐츠 */
.main-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 입력 섹션 */
.input-section {
  margin-bottom: 30px;
}

.input-group {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.url-input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid #e1e5e9;
  border-radius: 25px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.url-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.analyze-btn {
  padding: 15px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.analyze-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.analyze-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 로딩 */
.loading {
  text-align: center;
  padding: 40px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  margin: 20px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-detail {
  color: #666;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* 결과 */
.results {
  margin: 30px 0;
}

.result-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-left: 5px solid #667eea;
  transition: transform 0.3s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.category-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 15px;
}

/* 카테고리별 색상 */
.category-restaurant {
  background: #fef3e2;
  color: #f59e0b;
}
.category-news {
  background: #dbeafe;
  color: #3b82f6;
}
.category-blog {
  background: #f3e8ff;
  color: #8b5cf6;
}
.category-cafe {
  background: #ecfdf5;
  color: #10b981;
}
.category-social {
  background: #fce7f3;
  color: #ec4899;
}
.category-ecommerce {
  background: #fff1f2;
  color: #ef4444;
}
.category-video {
  background: #fef2f2;
  color: #dc2626;
}
.category-file {
  background: #f0f9ff;
  color: #0ea5e9;
}
.category-unknown {
  background: #f9fafb;
  color: #6b7280;
}

.result-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 10px;
  line-height: 1.4;
}

.result-url {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 15px;
  word-break: break-all;
}

.result-summary {
  background: #f8fafc;
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.result-details {
  border-top: 1px solid #e5e7eb;
  padding-top: 15px;
  margin-top: 15px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}

.detail-value {
  color: #6b7280;
  font-size: 0.9rem;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.confidence-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 5px;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(to right, #ef4444, #f59e0b, #10b981);
  transition: width 0.3s ease;
}

/* 예시 링크 */
.examples {
  margin: 40px 0;
}

.examples h3 {
  color: #374151;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.example-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.example-link {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.example-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* 통계 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 10px;
}

.stat-label {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.9rem;
}

/* 최근 분석 */
.recent-analysis {
  margin-top: 40px;
}

.recent-analysis h3 {
  color: #374151;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: white;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.recent-item:hover {
  transform: translateX(5px);
}

.recent-domain {
  font-weight: 600;
  color: #374151;
  flex: 1;
}

.recent-category {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 10px;
}

.recent-time {
  color: #6b7280;
  font-size: 0.85rem;
  min-width: 80px;
  text-align: right;
}

/* 히스토리 모달 */
.history-filters {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  align-items: center;
}

.history-filters select {
  padding: 10px 15px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

.history-filters select:focus {
  outline: none;
  border-color: #667eea;
}

.refresh-btn {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  background: #5a67d8;
  transform: translateY(-1px);
}

.history-list {
  max-height: 500px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.history-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.history-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e0;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-item-title {
  font-weight: 600;
  color: #2d3748;
  font-size: 1.1rem;
}

.history-item-date {
  color: #718096;
  font-size: 0.9rem;
}

.history-item-url {
  color: #4a5568;
  font-size: 0.9rem;
  margin-bottom: 10px;
  word-break: break-all;
}

.history-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delete-btn {
  background: #fed7d7;
  color: #c53030;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

.delete-btn:hover {
  background: #feb2b2;
}

/* 페이지네이션 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  background: white;
  color: #4a5568;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
  background: #667eea;
  color: white;
}

.pagination button.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 빈 상태 메시지 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: #374151;
}

.empty-state p {
  font-size: 1rem;
  line-height: 1.6;
}

/* 토스트 메시지 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  z-index: 1001;
  animation: toastSlideIn 0.3s ease;
}

.toast.success {
  background: #10b981;
}

.toast.error {
  background: #ef4444;
}

.toast.info {
  background: #3b82f6;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 애니메이션 효과 */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .title-section h1 {
    font-size: 2.5rem;
  }

  .title-section p {
    font-size: 1rem;
  }

  .input-group {
    flex-direction: column;
  }

  .url-input {
    margin-bottom: 10px;
  }

  .example-links {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .recent-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .recent-time {
    min-width: auto;
    text-align: left;
  }

  .modal-content {
    margin: 10% auto;
    padding: 20px;
    width: 95%;
  }

  .history-modal {
    margin: 5% auto;
  }

  .history-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .history-filters select {
    width: 100%;
  }

  .history-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .history-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a67d8;
}

/* 포커스 효과 개선 */
button:focus,
input:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}
