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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.back-link {
    display: inline-block;
    margin-top: 15px;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: background 0.3s ease;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
main {
    padding: 40px 30px;
}

/* Sensor Selection Grid */
.sensor-selection {
    margin-bottom: 40px;
}

.sensor-selection h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 1.8rem;
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.sensor-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sensor-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.sensor-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.sensor-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #667eea;
}

.sensor-id {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
}

.view-button {
    display: inline-block;
    padding: 10px 24px;
    background: #667eea;
    color: white;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.sensor-card:hover .view-button {
    background: #764ba2;
}

/* Info Section */
.info-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-top: 40px;
}

.info-section h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.info-section p {
    margin-bottom: 10px;
    line-height: 1.8;
}

.last-update {
    font-weight: 600;
    color: #764ba2;
    margin-top: 20px;
}

/* Data Info */
.data-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.data-info p {
    margin: 5px 0;
    font-size: 1rem;
}

.data-info strong {
    color: #667eea;
}

/* Warning Box */
.warning-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.warning-box p {
    margin: 5px 0;
    color: #856404;
}

.warning-box strong {
    font-size: 1.1rem;
}

/* Plots Grid */
.plots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.plot-container {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.plot-container:hover {
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
}

.plot-container h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

.plot-wrapper {
    position: relative;
    width: 100%;
    min-height: 250px;
}

.plot-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.error-message {
    background: #f8d7da;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    color: #721c24;
}

.error-message p {
    margin: 5px 0;
}

.error-details {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.1);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 40px;
    color: white;
    cursor: pointer;
    font-weight: 300;
    line-height: 1;
    transition: color 0.3s ease;
    user-select: none;
}

.lightbox-close:hover {
    color: #667eea;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 20px 15px;
    }

    .sensor-selection h2 {
        font-size: 1.4rem;
    }

    .sensor-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .plots-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .info-section {
        padding: 20px;
    }

    .plot-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .sensor-card {
        padding: 20px;
    }

    .sensor-icon {
        font-size: 2.5rem;
    }

    .plot-wrapper {
        min-height: 200px;
    }
}
