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

:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f0;
    --green: #2e7d32;
    --green-dim: #1b5e20;
    --green-light: #4caf50;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(46, 125, 50, 0.2);
    --shadow-glow-hover: 0 0 30px rgba(46, 125, 50, 0.3);
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --border-color-hover: #2e7d32;
    --gradient-1: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    --gradient-2: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(46, 125, 50, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--green-dim);
    border-radius: 5px;
    transition: var(--transition-normal);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--green);
    box-shadow: var(--shadow-glow);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

/*dashboard-container*/
.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/*header*/
.header {
    margin-bottom: 10px;
    padding: 30px;
    background: var(--gradient-2);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    width: 100%;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    animation: glowPulse 2s infinite;
}

.header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(46, 125, 50, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 10s infinite ease-in-out;
}

@keyframes glowPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, 20px) rotate(120deg); }
    66% { transform: translate(20px, -20px) rotate(240deg); }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--green);
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.server-status {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/*models-btn*/
.model-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.model-btn {
    padding: 12px 30px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    flex: 0 1 auto;
    min-width: 120px;
}

.model-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--green);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    opacity: 0.1;
    z-index: 0;
}

.model-btn:hover::before {
    width: 300px;
    height: 300px;
}

.model-btn:hover {
    border-color: var(--green);
    color: var(--green);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.model-btn.active {
    background: var(--green);
    color: white;
    border-color: var(--green);
    box-shadow: var(--shadow-glow);
    font-weight: 700;
}

.model-btn.active:hover {
    background: var(--green-dim);
    box-shadow: var(--shadow-glow-hover);
}

/*stats*/
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 50px;
    background: var(--gradient-1);
    opacity: 0.1;
    border-radius: 50% 0 0 0;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--green);
    box-shadow: var(--shadow-hover);
    background: var(--bg-card-hover);
}

.stat-card:hover::after {
    opacity: 0.2;
    width: 60px;
    height: 60px;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 5px;
    line-height: 1.2;
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/*metrics*/
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.metric-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.metric-card:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
    background: var(--bg-card-hover);
}

.metric-card h3 {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.chart-container {
    width: 100%;
    height: 350px;
}

/* YOLO Metrics Images Section */
.yolo-section {
    width: 100%;
    margin-bottom: 20px;
}

.yolo-section .curve-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    width: 100%;
}

.yolo-section .curve-card:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-glow-hover);
    transform: translateY(-3px);
}

.yolo-section .curve-card h3 {
    font-size: 1.2rem;
    margin-bottom: 25px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    font-weight: 600;
}

.yolo-section .text-center {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 350px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 12px;
    padding: 20px;
}

.yolo-section .text-center img {
    max-width: 90%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
    object-fit: contain;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.yolo-section .text-center img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow-hover);
    border-color: var(--green-light);
}

/*cm*/
.confusion-section {
    margin-bottom: 20px;
    width: 100%;
}

.confusion-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 35px 35px 35px 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    width: 100%;
}

.confusion-card:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-glow);
}

.confusion-card h3 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.confusion-chart {
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.js-plotly-plot {
    width: 100% !important;
    max-width: 100% !important;
}

.plotly {
    width: 100% !important;
    max-width: 100% !important;
}

/*curves-pr-roc*/
.curve-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    width: 100%;
}

.curve-card:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-glow);
}

.curve-card h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.curve-chart {
    width: 100%;
    height: 350px;
}

.loading-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.error-message {
    text-align: center;
    padding: 50px;
    color: #ff6b6b;
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid #ff6b6b;
}

/*plotly-section*/
.plotly-section {
    width: 100%;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr); 
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .yolo-section .text-center {
        min-height: 300px;
    }
    
    .yolo-section .text-center img {
        max-height: 350px;
    }
}

@media (max-width: 768px) {
    .stats-grid,
    .metrics-grid {
        grid-template-columns: 1fr; 
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header {
        padding: 20px;
    }
    
    .server-status {
        position: static;
        text-align: center;
        margin-top: 10px;
    }
    
    .model-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .model-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .confusion-chart {
        height: 350px;
    }
    
    .curve-chart {
        height: 300px;
    }
    
    .yolo-section .curve-card {
        padding: 15px;
    }
    
    .yolo-section .text-center {
        min-height: 250px;
        padding: 10px;
    }
    
    .yolo-section .text-center img {
        max-height: 250px;
        max-width: 95%;
    }
    
    .yolo-section .curve-card h3 {
        font-size: 1rem;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .dashboard {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .yolo-section .text-center {
        min-height: 200px;
    }
    
    .yolo-section .text-center img {
        max-height: 200px;
    }
}

/*print*/
@media print {
    .model-selector,
    .loading,
    #exportControls {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .stat-card,
    .metric-card,
    .confusion-card,
    .curve-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
    }
    
    .yolo-section .text-center img {
        max-height: 300px;
        page-break-inside: avoid;
    }
}

/*exp*/
#exportControls {
    position: fixed;
    top: 20px;
    right: 30px;
    z-index: 9999;
    animation: glowPulse 2s infinite;
}

#exportControls button {
    margin: 0;
    white-space: nowrap;
    background: white;
    color: var(--green);
    border: 1px solid var(--green);
}

#exportControls button:hover {
    background: var(--green);
    color: white;
}

@media (max-width: 768px) {
    #exportControls {
        top: 10px;
        right: 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    #exportControls button {
        min-width: 80px;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/*footer*/
.footer {
    width: 100%;
    padding: 20px 0;
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.footer p {
    margin: 0;
    color: var(--green);
    font-weight: 500;
}

.footer:hover {
    border-top-color: var(--green);
    transition: all var(--transition-normal);
}