/* =========================================
   8. 대시보드 전용 CSS (Complete v7.3 - Mobile Optimized)
   - 8개 KPI (2줄 x 4개, 1:1:1:1)
   - 최근 예약 테이블 ⭐ NEW
   - 차트 섹션 (50% : 50%, height 동일)
   - 모바일 전용 높이 축소 ⭐ NEW
   ========================================= */

/* ==================== 컨테이너 ==================== */
.dashboard-wrapper {
    padding: 2rem;
    max-width: none !important;
    margin: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* ==================== 헤더 ==================== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.dashboard-refresh-btn {
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dashboard-refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ==================== KPI 카드 그리드 (2줄 x 4개) ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 1:1:1:1 */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ==================== KPI 카드 ==================== */
.kpi-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 100px;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.kpi-card-icon {
    font-size: 48px !important;
    line-height: 1;
    flex-shrink: 0;
}

.kpi-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kpi-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
}

.kpi-card-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
}

.kpi-card-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.kpi-card-unit {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
}

/* ==================== KPI 카드 색상 ==================== */
.kpi-card-blue .kpi-card-value { color: #3b82f6; }
.kpi-card-green .kpi-card-value { color: #10b981; }
.kpi-card-purple .kpi-card-value { color: #8b5cf6; }
.kpi-card-pink .kpi-card-value { color: #ec4899; }
.kpi-card-orange .kpi-card-value { color: #f59e0b; }
.kpi-card-teal .kpi-card-value { color: #14b8a6; }
.kpi-card-red .kpi-card-value { color: #ef4444; }
.kpi-card-indigo .kpi-card-value { color: #6366f1; }

/* ==================== 최근 예약 섹션 ⭐ NEW ==================== */
.recent-reservations {
    margin: 2rem 0;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-message {
    text-align: center;
    color: #6b7280;
    padding: 2.5rem 1.25rem;
    font-size: 15px;
}

/* 테이블 래퍼 */
.reservations-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* 테이블 스타일 */
.reservations-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.reservations-table thead {
    background-color: #f9fafb;
}

.reservations-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.reservations-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

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

.reservations-table tbody tr:last-child {
    border-bottom: none;
}

.reservations-table tbody td {
    padding: 0.75rem 1rem;
    color: #1f2937;
}

.reservations-table tbody td.amount {
    font-weight: 600;
    color: #3b82f6;
}

/* 상태 뱃지 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-confirmed {
    background-color: #d1fae5;
    color: #065f46;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ==================== 차트 섹션 (50% : 50%) ==================== */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 50% : 50% */
    gap: 1.5rem;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-card-title {
    margin: 0 0 1rem 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

/* 차트 높이 550px - 1:1 비율 */
.chart-container {
    height: 550px;
    position: relative;
}

.empty-chart {
    height: 550px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 14px;
}

/* ==================== 인기 투어 리스트 ==================== */
.popular-tours-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 550px;
    overflow-y: auto;
}

.tour-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    transition: all 0.2s;
}

.tour-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.tour-rank {
    font-size: 24px;
    min-width: 36px;
    text-align: center;
}

.tour-info {
    flex: 1;
}

.tour-name {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.tour-stats {
    display: flex;
    gap: 1rem;
    font-size: 13px;
    color: #6b7280;
}

.tour-progress {
    margin-top: 0.5rem;
}

.tour-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 12px;
    color: #6b7280;
}

.tour-progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ==================== 반응형 ==================== */
@media (max-width: 1400px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr); /* 2x2 */
    }
}

@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr; /* 세로 배치 */
    }
    
    .chart-container,
    .empty-chart,
    .popular-tours-list {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .dashboard-wrapper {
        padding: 1rem;
    }
    
    /* 제목 옆에 새로고침을 같은 줄로 (세로 배치 → 가로 유지) */
    .dashboard-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    .dashboard-title {
        font-size: 22px; /* 너무 줄이면 이모지 비트맵이 뭉개져 보임 */
    }
    /* ⭐ 새로고침 버튼 컴팩트 */
    .dashboard-refresh-btn {
        height: 30px;
        padding: 0 12px;
        font-size: 12px;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr); /* 2x4 배치 유지 */
        gap: 0.75rem; /* 1.5rem → 0.75rem */
    }
    
    /* ⭐ 모바일 전용: KPI 카드 높이 낮춤, 가로는 그리드 1:1 */
    .kpi-card {
        padding: 0.75rem;
        gap: 0.625rem;
        min-height: 70px;
        height: 70px;
        max-height: 70px;
    }
    
    .kpi-card-icon {
        font-size: 32px !important;
    }
    
    .kpi-card-content {
        gap: 0.125rem;
    }
    
    .kpi-card-title {
        font-size: 10px;
    }
    
    .kpi-card-value {
        font-size: 16px;
    }
    
    .kpi-card-unit {
        font-size: 11px;
    }
    
    /* 반응형 테이블 */
    .reservations-table {
        font-size: 13px;
    }
    
    .reservations-table thead th,
    .reservations-table tbody td {
        padding: 0.625rem 0.75rem;
    }
    
    .section-title {
        font-size: 18px;
    }
}

/* ==================== 매출 리포트 고도화 ==================== */

/* 성장률 카드 그리드 */
.sr-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* 2열 그리드 (요일별+플랫폼별) */
.sr-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* 매출 카드 공통 */
.sr-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 성장률 배지 */
.sr-growth-up { color: #10b981; font-weight: 700; font-size: 18px; }
.sr-growth-down { color: #ef4444; font-weight: 700; font-size: 18px; }
.sr-growth-none { color: #9ca3af; font-size: 13px; }

/* 요일별 바 */
.sr-day-bar {
    height: 22px;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.sr-day-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 6px;
    transition: width 0.5s;
}

/* 매출 리포트 반응형 */
@media (max-width: 1024px) {
    .sr-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sr-grid-3 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .sr-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .sr-card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .sr-grid-3,
    .sr-grid-2 {
        gap: 0.5rem;
    }
}

/* ── 회차 마감 날짜 내비게이션: 화살표·날짜입력·오늘 높이 통일 ──
   인라인 padding만으로는 date input(브라우저 기본 크롬)과 버튼 높이가 어긋남.
   터치 기기에서는 44px 터치 타깃으로 확대. */
.sc-navctl {
    height: 34px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
input.sc-navctl { display: inline-block; }  /* date input은 flex가 내부 크롬을 깨뜨림 */

@media (pointer: coarse) {
    /* 44px 터치 타깃은 주변 버튼(약 30px)보다 커서 툴바가 두꺼워 보임 — 데스크톱과 동일 높이 유지 */
    .sc-navctl {
        height: 34px;
        font-size: 13px !important;
    }
    button.sc-navctl { min-width: 40px; }
    input.sc-navctl { width: 138px !important; }
}
