/* components.css - 공통 컴포넌트 스타일 정의 */

/* 카드 컴포넌트 */
.card {
  background-color: white;
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-gray-200);
  padding: 0.75rem;
  height: 100%;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-gray-800);
  margin: 0;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--color-gray-600);
  margin-top: 0.25rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.card-content {
  height: calc(100% - 2.25rem);
}

.summary-card {
  background-color: white;
  padding: 1.5rem;
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow);
  margin-bottom: 0;
  border: 1px solid var(--color-gray-200);
  height: 100%;
}

/* 버튼 컴포넌트 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: var(--rounded);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background-color: var(--color-gray-100);
  color: var(--color-gray-700);
}

.btn:hover {
  background-color: var(--color-gray-200);
}

.btn:active {
  transform: translateY(1px);
}

.btn i {
  margin-right: 0.25rem;
}

.btn.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn.btn-primary:hover {
  background-color: #20198e;
}

.btn.btn-outline {
  background-color: transparent;
  border-color: var(--color-gray-300);
}

.btn.btn-outline:hover {
  background-color: var(--color-gray-100);
}

.btn.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-group {
  display: flex;
  border-radius: var(--rounded);
  overflow: hidden;
}

.btn-group .btn {
  border-radius: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--rounded);
  border-bottom-left-radius: var(--rounded);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--rounded);
  border-bottom-right-radius: var(--rounded);
  border-right: none;
}

.btn-group .btn.active {
  background-color: var(--color-primary);
  color: white;
}

/* 필터 및 탭 컴포넌트 */
.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.24rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--rounded);
  background-color: white;
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: var(--color-gray-100);
}

.filter-btn.active {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.tran-filter-btn {
  padding: 0.24rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--rounded);
  background-color: white;
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tran-filter-btn:hover {
  background-color: var(--color-gray-100);
}

.tran-filter-btn.active {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.card-controls {
  display: flex;
  gap: 0.5rem;
}

.card-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-gray-200);
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-gray-600);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--color-primary);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 상태 표시 컴포넌트 */
.server-status-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: var(--rounded);
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.success {
  background-color: var(--color-success-light);
  color: var(--color-success-dark);
}

.status-badge.warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.status-badge.danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger-dark);
}

.status-badge.info {
  background-color: var(--color-info-light);
  color: var(--color-info-dark);
}

.status-badge i {
  margin-right: 0.25rem;
}

/* 상태 인디케이터 */
.instance-status {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--rounded-full);
  margin-right: 0.5rem;
}

.status-normal {
  background-color: var(--color-success);
}

.status-warning {
  background-color: var(--color-warning);
}

.status-error {
  background-color: var(--color-danger);
}

.status-inactive {
  background-color: var(--color-gray-400);
}

/* 테이블 컴포넌트 */
.instance-table,
.transaction-table,
.adapter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.813rem;
}

.instance-table th,
.instance-table td,
.transaction-table th,
.transaction-table td,
.adapter-table th,
.adapter-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-gray-200);
}

.instance-table th,
.transaction-table th,
.adapter-table th {
  font-weight: 600;
  color: var(--color-gray-600);
  background-color: var(--color-gray-50);
  font-size: 0.75rem;
}

.transaction-table th {
  padding: 0.875rem 1rem;
  border-bottom: 2px solid var(--color-gray-200);
}

.instance-table tr:last-child td,
.adapter-table tr:last-child td {
  border-bottom: none;
}

.transaction-table tr:hover {
  background-color: var(--color-gray-50);
}

.transaction-table .text-right {
  text-align: right;
}

.transaction-table .group-name {
  font-weight: 600;
  color: var(--color-gray-800);
}

/* 검색 컴포넌트 */
.search-container {
  position: relative;
  width: 100%;
  max-width: 300px;
}

/* 검색 컴포넌트 */
.search-container {
  position: relative;
  width: 250px;
}

.search-container i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-500);
}

#server-search {
  width: 100%;
  padding: 0.3rem 0.75rem 0.3rem 2rem;
  font-size: 0.813rem;
  border-radius: var(--rounded);
  border: 1px solid var(--color-gray-300);
  background-color: white;
}

#server-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* 차트 컨테이너 */
.chart-container {
  height: 184px;
  width: 100%;
  background-color: white;
  border-radius: var(--rounded-md);
  overflow: hidden;
  position: relative;
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-gray-400);
  font-size: 1.5rem;
  font-weight: 500;
}

/* 로딩 애니메이션 */
.loading {
  position: relative;
}

.loading:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--rounded-md);
  z-index: 10;
}

.loading:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  margin-left: -12px;
  border-radius: 50%;
  border: 2px solid rgba(79, 70, 229, 0.3);
  border-top-color: var(--color-primary);
  animation: spin 0.8s linear infinite;
  z-index: 11;
}

/* 메트릭 컴포넌트 */
.metric-group {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.6875rem;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-weight: 600;
  color: var(--color-gray-800);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
}

.metric-value.success {
  color: var(--color-success);
}

.metric-value.warning {
  color: var(--color-warning);
}

.metric-value.danger {
  color: var(--color-danger);
}

.metric-change {
  font-size: 0.6875rem;
  color: var(--color-success);
  margin-left: 0.375rem;
  font-weight: normal;
}

.clickable {
  color: var(--color-primary);
  cursor: pointer;
}

.clickable:hover {
  text-decoration: underline;
}

/* 토글 버튼 */
.toggle-details {
  background: none;
  border: none;
  color: var(--color-gray-500);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  border-radius: var(--rounded);
}

.toggle-details:hover {
  color: var(--color-primary);
  background-color: var(--color-gray-100);
}

.toggle-details.open {
  transform: rotate(180deg);
}

/* 테이블 컴포넌트 */
.table-container {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table th,
table td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--color-gray-200);
}

table th {
  font-weight: 600;
  color: var(--color-gray-700);
  background-color: var(--color-gray-50);
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td {
  background-color: var(--color-gray-50);
}

/* 알림 컴포넌트 */
.alert {
  padding: 0.75rem;
  border-radius: var(--rounded);
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
}

.alert-icon {
  margin-right: 0.5rem;
  font-size: 1rem;
  flex-shrink: 0;
}

.alert-content {
  flex-grow: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.alert-message {
  margin: 0;
}

.alert.alert-info {
  background-color: var(--color-info-light);
  color: var(--color-info-dark);
}

.alert.alert-success {
  background-color: var(--color-success-light);
  color: var(--color-success-dark);
}

.alert.alert-warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.alert.alert-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger-dark);
}

/* 로딩 스피너 */
.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid rgba(var(--color-primary-rgb), 0.3);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 페이지네이션 */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.pagination-item {
  margin: 0 0.25rem;
}

.pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--rounded);
  font-size: 0.875rem;
  color: var(--color-gray-700);
  text-decoration: none;
  transition: all 0.2s ease;
}

.pagination-link:hover {
  background-color: var(--color-gray-100);
}

.pagination-link.active {
  background-color: var(--color-primary);
  color: white;
}

.pagination-link.disabled {
  color: var(--color-gray-400);
  pointer-events: none;
}

/* 툴팁 */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  width: 120px;
  background-color: var(--color-gray-800);
  color: white;
  text-align: center;
  border-radius: var(--rounded);
  padding: 0.4rem 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 0.75rem;
  pointer-events: none;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--color-gray-800) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* 애니메이션 */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* 새로고침 버튼 애니메이션 */
.refresh-btn-spin {
  animation: spin 1s linear infinite;
}

/* 컴팩트 모드 추가 스타일 */
.compact-mode .card {
  padding: 0.5rem;
}

.compact-mode .card-header {
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
}

.compact-mode .card-title {
  font-size: 0.95rem;
}

.compact-mode table th,
.compact-mode table td {
  padding: 0.3rem 0.4rem;
}

.compact-mode .section-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
}

/* peak 필터 스타일 */
.peak-filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.peak-filter-btn {
  padding: 0.24rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--rounded);
  background-color: white;
  color: var(--color-gray-700);
  border: 1px solid var(--color-gray-300);
  cursor: pointer;
  transition: all 0.2s ease;
}

.peak-filter-btn:hover {
  background-color: var(--color-gray-100);
}

.peak-filter-btn.active {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}