/* ==========================================
   R To R - 퀀트 투자 구독 플랫폼 스타일
   Primary Color: R To R Blue (#2F6FE6)
   UX/UI 전면 개선 버전
   ========================================== */

/* ========== 기본 설정 ========== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ========== 컨테이너 시스템 (개선) ========== */
/* 메인 컨테이너 - 더 넉넉한 좌우 여백 */
.container-custom {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

@media (min-width: 480px) {
  .container-custom {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (min-width: 640px) {
  .container-custom {
    padding-left: 32px;
    padding-right: 32px;
  }
}

@media (min-width: 768px) {
  .container-custom {
    padding-left: 40px;
    padding-right: 40px;
  }
}

@media (min-width: 1024px) {
  .container-custom {
    padding-left: 56px;
    padding-right: 56px;
  }
}

@media (min-width: 1280px) {
  .container-custom {
    max-width: 1400px;
    padding-left: 80px;
    padding-right: 80px;
  }
}

@media (min-width: 1536px) {
  .container-custom {
    padding-left: 100px;
    padding-right: 100px;
  }
}

/* ========== 섹션 스타일 (개선) ========== */
.section {
  padding-top: 56px;
  padding-bottom: 56px;
}

@media (min-width: 640px) {
  .section {
    padding-top: 64px;
    padding-bottom: 64px;
  }
}

@media (min-width: 768px) {
  .section {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}

@media (min-width: 1024px) {
  .section {
    padding-top: 96px;
    padding-bottom: 96px;
  }
}

/* ========== 버튼 시스템 (개선) ========== */
/* 기본 버튼 스타일 */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

/* Primary 버튼 */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background-color: #2F6FE6;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(47, 111, 230, 0.25);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover {
  background-color: #2563eb;
  box-shadow: 0 4px 12px rgba(47, 111, 230, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary 버튼 */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-secondary:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
}

/* Ghost 버튼 */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background-color: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-ghost:hover {
  background-color: #f3f4f6;
  color: #111827;
}

/* 버튼 크기 변형 */
.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
  border-radius: 12px;
}

@media (min-width: 640px) {
  .btn-lg {
    padding: 16px 32px;
    font-size: 16px;
  }
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
  gap: 6px;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  gap: 4px;
}

/* ========== 카드 시스템 (개선) ========== */
.card {
  background: white;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* 포트폴리오 카드 */
.portfolio-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.25s ease;
}

@media (min-width: 640px) {
  .portfolio-card {
    padding: 24px;
  }
}

.portfolio-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* 환급 경고 */
.refund-warning {
  border-color: #fca5a5 !important;
  background: linear-gradient(to bottom, #fef2f2, white);
}

/* ========== 배지 시스템 (개선) ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

@media (min-width: 640px) {
  .badge {
    font-size: 12px;
  }
}

.badge-warning {
  background-color: #fef2f2;
  color: #dc2626;
}

.badge-info {
  background-color: #eff6ff;
  color: #2563eb;
}

/* ========== 입력 필드 (개선) ========== */
.input-field {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  color: #111827;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: all 0.2s ease;
}

@media (min-width: 640px) {
  .input-field {
    padding: 14px 18px;
    font-size: 15px;
  }
}

.input-field:focus {
  border-color: #2F6FE6;
  box-shadow: 0 0 0 3px rgba(47, 111, 230, 0.1);
}

.input-field::placeholder {
  color: #9ca3af;
}

/* Select 드롭다운 스타일 */
select.input-field {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

@media (min-width: 640px) {
  select.input-field {
    padding-right: 44px;
    background-position: right 16px center;
  }
}

select.input-field:focus {
  border-color: #2F6FE6;
  box-shadow: 0 0 0 3px rgba(47, 111, 230, 0.1);
}

/* ========== 텍스트 스타일 ========== */
.gradient-text {
  background: linear-gradient(135deg, #2F6FE6 0%, #1d4ed8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.accent-line {
  height: 4px;
  width: 48px;
  background: linear-gradient(90deg, #2F6FE6, #60a5fa);
  border-radius: 2px;
}

/* ========== 히어로 섹션 ========== */
.hero-gradient {
  background: linear-gradient(135deg, #f0f7ff 0%, #e0efff 50%, #dbeafe 100%);
}

/* ========== 테이블 (개선) ========== */
.data-table {
  width: 100%;
  font-size: 13px;
}

@media (min-width: 640px) {
  .data-table {
    font-size: 14px;
  }
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #6b7280;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
}

@media (min-width: 640px) {
  .data-table th,
  .data-table td {
    padding: 14px 20px;
  }
}

.data-table tbody tr:hover td {
  background-color: #f9fafb;
}

/* 벤치마크 테이블 */
.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

@media (min-width: 640px) {
  .benchmark-table {
    font-size: 14px;
  }
}

.benchmark-table th,
.benchmark-table td {
  padding: 12px 14px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

@media (min-width: 640px) {
  .benchmark-table th,
  .benchmark-table td {
    padding: 14px 18px;
  }
}

.benchmark-table th {
  background-color: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.benchmark-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: #6b7280;
  background-color: #f9fafb;
}

/* ========== 기간 탭 (개선) ========== */
.period-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background-color: #f3f4f6;
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.period-tab {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .period-tab {
    padding: 8px 14px;
    font-size: 13px;
  }
}

.period-tab:hover {
  color: #374151;
}

.period-tab.active {
  background-color: white;
  color: #2F6FE6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ========== 지표 카드 (개선) ========== */
.metric-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

@media (min-width: 640px) {
  .metric-card {
    padding: 24px;
    border-radius: 14px;
  }
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

@media (min-width: 640px) {
  .metric-value {
    font-size: 28px;
  }
}

.metric-label {
  font-size: 12px;
  color: #6b7280;
}

@media (min-width: 640px) {
  .metric-label {
    font-size: 13px;
  }
}

/* ========== 정보 카드 (개선) ========== */
.info-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}

@media (min-width: 640px) {
  .info-card {
    gap: 16px;
    padding: 24px;
    border-radius: 14px;
  }
}

.info-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #eff6ff;
  border-radius: 12px;
}

@media (min-width: 640px) {
  .info-card-icon {
    width: 48px;
    height: 48px;
  }
}

/* ========== 섹션 타이틀 (개선) ========== */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .section-title {
    font-size: 18px;
    margin-bottom: 20px;
  }
}

/* ========== 전략 박스 ========== */
.strategy-box {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}

@media (min-width: 640px) {
  .strategy-box {
    padding: 24px;
    border-radius: 14px;
  }
}

/* ========== 구독 버튼 ========== */
.subscribe-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background-color: #2F6FE6;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(47, 111, 230, 0.3);
}

@media (min-width: 640px) {
  .subscribe-btn {
    padding: 16px 24px;
    font-size: 16px;
  }
}

.subscribe-btn:hover {
  background-color: #2563eb;
  box-shadow: 0 6px 16px rgba(47, 111, 230, 0.4);
  transform: translateY(-1px);
}

/* ========== 드롭다운 ========== */
.dropdown-menu {
  position: absolute;
  right: 0;
  margin-top: 8px;
  width: 200px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
  z-index: 50;
  overflow: hidden;
}

/* ========== 유틸리티 (개선) ========== */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.1);
}

.card-hover {
  transition: all 0.25s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.12);
}

/* 블러 효과 */
.blur-overlay {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.content-blur {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
}

/* 라이브 인디케이터 */
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.live-indicator {
  animation: live-pulse 2s ease-in-out infinite;
}

/* 즐겨찾기 버튼 */
.favorite-btn {
  padding: 8px;
  border-radius: 8px;
  color: #d1d5db;
  transition: all 0.2s ease;
}

.favorite-btn:hover {
  background-color: #fef3c7;
  color: #f59e0b;
}

.favorite-btn.active {
  color: #f59e0b;
}

/* ========== 폼 스타일 (개선) ========== */
.form-group {
  margin-bottom: 18px;
}

@media (min-width: 640px) {
  .form-group {
    margin-bottom: 20px;
  }
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.form-error {
  margin-top: 6px;
  font-size: 13px;
  color: #dc2626;
}

/* ========== 스켈레톤 ========== */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== 토스트 ========== */
.toast {
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.3s ease;
}

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

.toast-success {
  background-color: #22c55e;
  color: white;
}

.toast-error {
  background-color: #ef4444;
  color: white;
}

.toast-info {
  background-color: #2F6FE6;
  color: white;
}

/* ========== 그리드 시스템 (추가) ========== */
.grid-gap-comfortable {
  gap: 20px;
}

@media (min-width: 640px) {
  .grid-gap-comfortable {
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .grid-gap-comfortable {
    gap: 28px;
  }
}

/* ========== 특수 섹션 스타일 ========== */
/* 히어로 섹션 내부 여백 */
.hero-section-inner {
  padding-top: 48px;
  padding-bottom: 48px;
}

@media (min-width: 640px) {
  .hero-section-inner {
    padding-top: 64px;
    padding-bottom: 64px;
  }
}

@media (min-width: 768px) {
  .hero-section-inner {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}

@media (min-width: 1024px) {
  .hero-section-inner {
    padding-top: 96px;
    padding-bottom: 96px;
  }
}

/* ========== 통계 카드 (개선) ========== */
.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

@media (min-width: 640px) {
  .stat-card {
    padding: 20px;
  }
}

/* ========== 반응형 텍스트 크기 ========== */
.text-responsive-heading {
  font-size: 24px;
  line-height: 1.3;
}

@media (min-width: 640px) {
  .text-responsive-heading {
    font-size: 28px;
  }
}

@media (min-width: 768px) {
  .text-responsive-heading {
    font-size: 32px;
  }
}

@media (min-width: 1024px) {
  .text-responsive-heading {
    font-size: 36px;
  }
}

/* ========== CTA 섹션 박스 ========== */
.cta-box {
  padding: 32px 24px;
  border-radius: 16px;
}

@media (min-width: 640px) {
  .cta-box {
    padding: 40px 32px;
    border-radius: 20px;
  }
}

@media (min-width: 768px) {
  .cta-box {
    padding: 48px 40px;
    border-radius: 24px;
  }
}

/* ========== 반응형 조정 (전면 개선) ========== */
@media (max-width: 480px) {
  .container-custom {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .section {
    padding-top: 40px;
    padding-bottom: 40px;
  }
  
  .btn-primary,
  .btn-secondary {
    padding: 10px 18px;
    font-size: 14px;
  }
  
  .btn-lg {
    padding: 12px 24px;
    font-size: 14px;
  }
  
  .portfolio-card {
    padding: 16px;
  }
  
  .metric-card {
    padding: 16px;
  }
  
  .info-card {
    padding: 16px;
    flex-direction: column;
    gap: 12px;
  }
  
  .metric-value {
    font-size: 22px;
  }
  
  .section-title {
    font-size: 15px;
    margin-bottom: 14px;
  }
}

/* 중간 화면 (태블릿) */
@media (min-width: 481px) and (max-width: 767px) {
  .section {
    padding-top: 48px;
    padding-bottom: 48px;
  }
}

/* ========== 기간별 수익률 그리드 (반응형 개선) ========== */
.period-returns-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
  .period-returns-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .period-returns-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ========== Shadow 유틸리티 ========== */
.shadow-blue {
  box-shadow: 0 4px 12px rgba(47, 111, 230, 0.25);
}

.shadow-blue-lg {
  box-shadow: 0 8px 24px rgba(47, 111, 230, 0.3);
}

/* ========== 관리자 페이지 탭 버튼 (개선) ========== */
.admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .admin-tab-btn {
    padding: 12px 20px;
    font-size: 14px;
    gap: 10px;
  }
}

.admin-tab-btn:hover {
  color: #374151;
  background-color: #f9fafb;
  border-color: #d1d5db;
}

.admin-tab-btn-active {
  color: #2F6FE6;
  background-color: #eff6ff;
  border-color: #2F6FE6;
  font-weight: 600;
}

.admin-tab-btn-active:hover {
  color: #2F6FE6;
  background-color: #eff6ff;
  border-color: #2F6FE6;
}

/* 이전 admin-tab 스타일 호환성 유지 */
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-tab:hover {
  color: #374151;
  background-color: #f3f4f6;
}

.admin-tab-active {
  color: #2F6FE6;
  background-color: #eff6ff;
  font-weight: 600;
}

/* ========== 데이터 탭 (포트폴리오 상세페이지) ========== */
.data-tab {
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.data-tab:hover {
  color: #374151;
  background-color: #f9fafb;
}

.data-tab.active {
  color: #2F6FE6;
  border-bottom-color: #2F6FE6;
  background-color: #eff6ff;
}

.data-panel {
  /* 기본 스타일 */
}

.data-panel.hidden {
  display: none;
}
