/* 대시보드 페이지 스타일 - 최신 트렌드 반영 */

/* 메인 헤더 스타일 */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 2px solid var(--gray-100);
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    flex: 1;
    min-width: 200px;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.header-desc {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-700);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--gray-100);
}

/* 레이아웃 */
.app-container {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    border-radius: 24px 0 0 0;
    overflow: hidden;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

/* 대시보드 콘텐츠 */
.dashboard-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

/* 기간 선택 */
.period-select {
    min-width: 120px;
    border: 2px solid var(--gray-200);
    background: white;
    font-weight: 500;
}

/* KPI 섹션 */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    border-radius: 20px;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

.kpi-card.revenue::before { background: linear-gradient(90deg, #10b981 0%, #34d399 100%); }
.kpi-card.customers::before { background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%); }
.kpi-card.quotes::before { background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%); }
.kpi-card.expenses::before { background: linear-gradient(90deg, #ef4444 0%, #f87171 100%); }

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.kpi-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    font-size: 1.5rem;
    opacity: 0.8;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.kpi-change {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--gray-50);
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.kpi-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.kpi-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.change-icon {
    font-size: 0.875rem;
}

.change-period {
    color: var(--gray-500);
    font-weight: 400;
}

.kpi-chart {
    margin-top: 1rem;
    height: 50px;
}

/* 차트 섹션 */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1400px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

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

.chart-btn {
    padding: 0.375rem 0.875rem;
    background: var(--gray-100);
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.chart-body {
    height: 300px;
    position: relative;
}

/* 테이블 섹션 */
.tables-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .tables-section {
        grid-template-columns: 1fr;
    }
}

.table-container {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--gray-100);
}

.table-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.view-all {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-all:hover {
    color: var(--primary-dark);
    transform: translateX(2px);
}

.table-body {
    max-height: 400px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.data-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-100);
}

.data-table td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-50);
}

.data-table tbody tr {
    transition: all 0.2s;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.03) 0%, rgba(79, 70, 229, 0.01) 100%);
}

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

.text-success {
    color: var(--success);
    font-weight: 600;
}

.text-danger {
    color: var(--danger);
    font-weight: 600;
}

/* 타임라인 섹션 */
.timeline-section {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.timeline-section h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-time {
    position: absolute;
    left: -3rem;
    top: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
}

.timeline-marker {
    position: absolute;
    left: -2.375rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    z-index: 1;
}

.timeline-content {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1rem;
    margin-left: 0.5rem;
}

.timeline-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.timeline-desc {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

/* 애니메이션 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card {
    animation: slideUp 0.5s ease-out;
    animation-fill-mode: both;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

/* 스파크라인 차트 */
canvas {
    max-width: 100%;
    height: auto !important;
}

/* 반응형 디자인 */
@media (max-width: 1400px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .tables-section {
        grid-template-columns: 1fr;
    }

    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        border-radius: 0;
    }

    .dashboard-content {
        padding: 1rem;
    }

    .kpi-section {
        grid-template-columns: 1fr;
    }

    .header-title h1 {
        font-size: 1.25rem;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .timeline {
        padding-left: 2rem;
    }

    .timeline-time {
        position: relative;
        left: 0;
        margin-bottom: 0.5rem;
    }
}

/* 스켈레톤 로딩 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* 툴팁 */
.tooltip {
    position: absolute;
    background: var(--gray-900);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip.show {
    opacity: 1;
}

/* 드롭다운 애니메이션 */
.dropdown-enter {
    opacity: 0;
    transform: translateY(-10px);
}

.dropdown-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}