/* ===========================
   Global Styles
   =========================== */
:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --secondary-color: #2ECC71;
    --background-light: #F5F7FA;
    --text-dark: #333;
    --text-muted: #6c757d;
    --border-color: #E0E0E0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ===========================
   Header Styles
   =========================== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* ===========================
   Card Styles
   =========================== */
.card {
    border: none;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}

.card-title {
    color: var(--text-dark);
    font-weight: 600;
}

/* ===========================
   Upload Section
   =========================== */
.upload-section .input-group {
    max-width: 600px;
}

.input-group-text {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

#csvFileInput {
    border: 2px solid var(--border-color);
    transition: border-color 0.3s ease;
}

#csvFileInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(74, 144, 226, 0.25);
}

/* ===========================
   Info Section
   =========================== */
.info-section .card-body {
    background-color: #fff;
}

#fileName {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}

#dataCount {
    font-size: 1rem;
    padding: 0.35em 0.65em;
}

/* ===========================
   Visualization Section
   =========================== */
#chart-container {
    min-height: 500px;
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

/* D3.js Chart Styles */
.chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.axis {
    font-size: 12px;
}

.axis path,
.axis line {
    stroke: var(--text-muted);
    shape-rendering: crispEdges;
}

.axis text {
    fill: var(--text-dark);
    font-size: 11px;
}

.grid line {
    stroke: var(--border-color);
    stroke-opacity: 0.7;
    shape-rendering: crispEdges;
}

.grid path {
    stroke-width: 0;
}

.line-path {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.data-point {
    fill: var(--primary-color);
    stroke: white;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-point:hover {
    fill: var(--secondary-color);
    r: 8;
    stroke-width: 3;
}

/* ===========================
   Tooltip Styles
   =========================== */
.tooltip-custom {
    position: absolute;
    padding: 12px 16px;
    background: rgba(51, 51, 51, 0.95);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-custom::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(51, 51, 51, 0.95);
}

.tooltip-custom.show {
    opacity: 1;
}

.tooltip-custom .tooltip-date {
    font-weight: 600;
    margin-bottom: 4px;
}

.tooltip-custom .tooltip-value {
    color: var(--secondary-color);
    font-size: 16px;
    font-weight: 700;
}

/* ===========================
   Footer Styles
   =========================== */
footer {
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    font-weight: 600;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--primary-dark);
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 1rem;
    }

    #chart-container {
        min-height: 400px;
        padding: 15px;
    }

    .card-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    header h1 {
        font-size: 1.5rem;
    }

    #chart-container {
        min-height: 350px;
        padding: 10px;
    }
}

/* ===========================
   Animations
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}
