/* Modern Dash Application Styling */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Main Container */
#react-entry-point {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-top: 2rem;
    margin-bottom: 2rem;
    min-height: calc(100vh - 4rem);
}

/* Navigation */
.dash-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.dash-nav a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.dash-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

/* Page Header */
.page-header {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.page-header p {
    font-size: 1.2rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
}

/* Chart Containers */
.chart-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border: 1px solid #e1e8ed;
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

.chart-description {
    font-size: 1rem;
    color: #666;
    text-align: center;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Plotly Graph Styling */
.js-plotly-plot {
    border-radius: 10px;
    overflow: hidden;
}

.plotly .modebar {
    display: none !important;
}

/* Grid Layout for Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

@media (min-width: 1200px) {
    .charts-grid.two-column {
        grid-template-columns: 1fr 1fr;
    }
}

/* Statistics Cards */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Info Boxes */
.info-box {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin: 1.5rem 0;
    text-align: center;
}

.info-box h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.info-box p {
    margin: 0;
    opacity: 0.9;
}

/* Loading States */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
    font-size: 1.1rem;
}

/* Footer Styling */
footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.1);
}

footer img {
    vertical-align: middle;
    margin-left: 0.5rem;
}

footer a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    #react-entry-point {
        margin: 1rem;
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .dash-nav {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-container {
        padding: 1rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .chart-title {
        font-size: 1.2rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* Animation Effects */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-container {
    animation: fadeInUp 0.6s ease-out;
}

.chart-container:nth-child(even) {
    animation-delay: 0.1s;
}

.chart-container:nth-child(odd) {
    animation-delay: 0.2s;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

a:focus,
button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    body {
        background: white !important;
    }
    
    .dash-nav,
    footer {
        background: #f8f9fa !important;
        color: #333 !important;
    }
    
    .stat-card,
    .info-box {
        background: #f8f9fa !important;
        color: #333 !important;
    }
}

/* Device History Specific Styles */
.device-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.metric-selector {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border: 1px solid #e1e8ed;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.performance-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    font-weight: 600;
    text-align: center;
}

.performance-table td {
    padding: 0.8rem;
    text-align: center;
    border-bottom: 1px solid #e1e8ed;
    transition: background-color 0.3s ease;
}

.performance-table tr:hover td {
    background-color: #f8f9fa;
}

.performance-table tr:nth-child(even) td {
    background-color: #f8f9fa;
}

/* Enhanced Chart Styling */
.js-plotly-plot .plotly .modebar {
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.js-plotly-plot .plotly .modebar-btn {
    color: #2c3e50 !important;
}

.js-plotly-plot .plotly .modebar-btn:hover {
    background: #3498db !important;
    color: white !important;
}

/* Navigation Links Enhancement */
.nav-links-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.nav-link-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
}

.nav-link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    text-decoration: none;
    color: white;
}

/* Responsive adjustments for device history */
@media (max-width: 768px) {
    .device-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .performance-table th,
    .performance-table td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .nav-links-grid {
        gap: 0.5rem;
    }
}
