/**
 * Dashboard Styles
 * Generic styles for n8n data visualization dashboards
 */

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

body {
    font-family: 'RedHatDisplay', 'Overpass', 'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #151515;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Logo Bar */
.logo-bar {
    background: #ffffff;
    padding: 20px 40px;
    border-bottom: 1px solid #d2d2d2;
}

.redhat-logo {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.redhat-logo img {
    height: 50px;
    width: auto;
}

/* Header */
.header {
    background: #EE0000;
    color: white;
    padding: 60px 40px;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.1) 100%);
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1.25em;
    line-height: 1.6;
    max-width: 900px;
    font-weight: 300;
}

/* Diagrams Section */
.diagrams-section {
    padding: 60px 40px;
    background: #ffffff;
}

.diagrams-section-title {
    font-size: 2em;
    font-weight: 700;
    color: #151515;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.diagrams-section-subtitle {
    font-size: 1.1em;
    color: #6a6e73;
    margin-bottom: 0;
    font-weight: 400;
}

/* Diagrams Header with Time Range Selector */
.diagrams-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 40px;
}

.diagrams-header-left {
    flex: 1;
}

.diagrams-header-right {
    flex-shrink: 0;
}

.time-range-selector {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    background: #f5f5f5;
    padding: 16px 20px;
    border-radius: 4px;
    border: 1px solid #d2d2d2;
}

.time-range-selector .selector-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-range-selector label {
    font-weight: 600;
    color: #151515;
    font-size: 0.9em;
    white-space: nowrap;
}

.time-range-selector select {
    padding: 10px 36px 10px 14px;
    border: 1px solid #d2d2d2;
    border-radius: 3px;
    font-size: 0.95em;
    color: #151515;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23151515' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    cursor: pointer;
    min-width: 160px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

.time-range-selector select:hover {
    border-color: #EE0000;
    background-color: #fafafa;
}

.time-range-selector select:focus {
    outline: none;
    border-color: #EE0000;
    box-shadow: 0 0 0 3px rgba(238, 0, 0, 0.15);
}

.custom-date-range {
    display: none;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #d2d2d2;
    width: 100%;
}

.custom-date-range.visible {
    display: flex;
}

.custom-date-range input[type="date"] {
    padding: 10px 12px;
    border: 1px solid #d2d2d2;
    border-radius: 3px;
    font-size: 0.9em;
    color: #151515;
    background: white;
    font-family: inherit;
    transition: all 0.2s ease;
}

.custom-date-range input[type="date"]:hover {
    border-color: #EE0000;
}

.custom-date-range input[type="date"]:focus {
    outline: none;
    border-color: #EE0000;
    box-shadow: 0 0 0 3px rgba(238, 0, 0, 0.15);
}

.custom-date-range span {
    color: #6a6e73;
    font-size: 0.9em;
    font-weight: 500;
}

.custom-date-range .apply-btn {
    padding: 10px 20px;
    background: #EE0000;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(238, 0, 0, 0.2);
}

.custom-date-range .apply-btn:hover {
    background: #CC0000;
    box-shadow: 0 4px 8px rgba(238, 0, 0, 0.3);
    transform: translateY(-1px);
}

.custom-date-range .apply-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(238, 0, 0, 0.2);
}

.selected-range {
    display: none;
    padding: 10px 14px;
    background: #e8e8e8;
    border-radius: 3px;
    font-size: 0.85em;
    color: #151515;
    text-align: center;
    border-top: 1px solid #d2d2d2;
    margin-top: 0;
}

.selected-range.visible {
    display: block;
}

.selected-range .range-label {
    color: #6a6e73;
    margin-right: 6px;
}

.selected-range .range-dates {
    font-weight: 600;
}

.diagrams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Diagram Cards */
.diagram-card {
    background: #fafafa;
    border: 1px solid #d2d2d2;
    border-radius: 3px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    min-height: 400px;
}

.diagram-card:hover {
    border-color: #EE0000;
    box-shadow: 0 4px 12px rgba(238, 0, 0, 0.15);
}

.diagram-card img {
    width: 100%;
    height: auto;
    display: block;
    background: white;
    border-bottom: 1px solid #d2d2d2;
    cursor: pointer;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.diagram-card img.loaded {
    opacity: 1;
}

.diagram-card img:hover {
    opacity: 0.9;
}

/* Diagram Loader */
.diagram-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
}

.diagram-loader.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #EE0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    color: #6a6e73;
    font-size: 0.9em;
    font-weight: 500;
}

/* Diagram Content Container */
.diagram-content {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #d2d2d2;
    min-height: 200px;
}

/* Diagram Labels */
.diagram-label {
    padding: 16px 20px 8px;
    font-size: 1.1em;
    font-weight: 600;
    color: #151515;
    background: #fafafa;
}

.diagram-description {
    padding: 0 20px 16px;
    font-size: 0.95em;
    color: #6a6e73;
    background: #fafafa;
    line-height: 1.5;
}

/* Table Type */
.diagram-table {
    width: 100%;
    border-collapse: collapse;
}

.diagram-table th {
    background: #151515;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.diagram-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.diagram-table tr:hover {
    background: #f5f5f5;
}

/* Bar Chart Type */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bar-label {
    width: 120px;
    font-weight: 500;
    font-size: 0.9em;
    color: #151515;
}

.bar-container {
    flex: 1;
    height: 28px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #EE0000, #CC0000);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.85em;
    min-width: 40px;
}

/* Stats Grid Type */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.stat-card {
    background: #f5f5f5;
    border-radius: 3px;
    padding: 20px 15px;
    text-align: center;
    border-left: 4px solid #EE0000;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: #151515;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85em;
    color: #6a6e73;
    font-weight: 500;
}

/* Sankey Diagram Type */
.sankey-diagram {
    width: 100%;
    height: 280px;
    position: relative;
}

.sankey-diagram canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Doughnut Diagram Type */
.doughnut-diagram {
    width: 100%;
    height: 280px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doughnut-diagram canvas {
    max-width: 100%;
    max-height: 100%;
}

.doughnut-summary {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.doughnut-summary-value {
    font-size: 2em;
    font-weight: 700;
    color: #151515;
}

.doughnut-summary-label {
    font-size: 0.85em;
    color: #6a6e73;
}

/* Knots Timeline Diagram Type */
.knots-diagram {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 10px;
    position: relative;
}

.knots-diagram::before {
    content: '';
    position: absolute;
    top: 65px;
    left: 40px;
    right: 40px;
    height: 4px;
    background: linear-gradient(90deg, #c3e88d 0%, #c3e88d 25%, #ffcb6b 25%, #ffcb6b 50%, #82aaff 50%, #82aaff 75%, #c792ea 75%, #c792ea 100%);
    border-radius: 2px;
    z-index: 1;
}

.knot-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 2;
}

.knot-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 3px solid;
}

.knot-circle.green {
    background: #e8f5e9;
    border-color: #81c784;
    color: #4caf50;
}

.knot-circle.yellow {
    background: #fff8e1;
    border-color: #ffd54f;
    color: #ff9800;
}

.knot-circle.blue {
    background: #e3f2fd;
    border-color: #64b5f6;
    color: #2196f3;
}

.knot-circle.purple {
    background: #f3e5f5;
    border-color: #ba68c8;
    color: #9c27b0;
}

.knot-label {
    font-size: 0.85em;
    font-weight: 600;
    color: #151515;
    text-align: center;
    margin-bottom: 8px;
}

.knot-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #151515;
    margin-top: 12px;
    text-align: center;
}

/* Chat Info Section */
.chat-info {
    padding: 40px;
    background: #f0f0f0;
    border-top: 4px solid #EE0000;
}

.chat-info-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.chat-info p {
    color: #151515;
    font-size: 1.3em;
    font-weight: 500;
    margin: 0;
    padding: 24px 32px;
    background: white;
    border-radius: 3px;
    border-left: 4px solid #EE0000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-info p::before {
    content: '💬 ';
    font-size: 1.2em;
}

.red-accent {
    color: #EE0000;
    font-weight: 700;
}

/* Footer Banner */
.footer-banner {
    background: #151515;
    color: white;
    padding: 20px 40px;
    text-align: center;
    font-size: 0.9em;
}

.footer-banner a {
    color: #EE0000;
    text-decoration: none;
    font-weight: 600;
}

.footer-banner a:hover {
    text-decoration: underline;
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(21, 21, 21, 0.95);
    animation: fadeIn 0.3s ease;
}

.lightbox-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 3px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    background: white;
    padding: 20px;
}

.lightbox-html-content {
    display: none;
    background: white;
    border-radius: 3px;
    padding: 30px;
    min-width: 400px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-html-content.active {
    display: block;
}

.lightbox-html-content .sankey-diagram {
    height: 400px;
    min-width: 600px;
}

.lightbox-html-content .doughnut-diagram {
    height: 400px;
    min-width: 400px;
}

.lightbox-html-content .stats-grid {
    gap: 25px;
    min-width: 400px;
}

.lightbox-html-content .stat-card {
    padding: 30px 25px;
}

.lightbox-html-content .stat-value {
    font-size: 2.5em;
}

.lightbox-html-content .diagram-table {
    font-size: 1.1em;
}

.lightbox-html-content .diagram-table th,
.lightbox-html-content .diagram-table td {
    padding: 14px 18px;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    transition: transform 0.2s ease;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-title {
    position: absolute;
    bottom: -50px;
    left: 0;
    color: white;
    font-size: 1.2em;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo-bar {
        padding: 15px 20px;
    }

    .redhat-logo img {
        height: 35px;
    }

    .header {
        padding: 40px 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .header p {
        font-size: 1.1em;
    }

    .diagrams-section {
        padding: 40px 20px;
    }

    .diagrams-section-title {
        font-size: 1.6em;
    }

    .diagrams-header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .diagrams-header-right {
        width: 100%;
    }

    .time-range-selector {
        align-items: stretch;
        padding: 14px 16px;
    }

    .time-range-selector .selector-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .time-range-selector select {
        width: 100%;
    }

    .custom-date-range {
        flex-wrap: wrap;
    }

    .custom-date-range input[type="date"] {
        flex: 1;
        min-width: 120px;
    }

    .custom-date-range .apply-btn {
        width: 100%;
        margin-top: 8px;
    }

    .diagrams-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .chat-info {
        padding: 30px 20px;
    }

    .chat-info p {
        font-size: 1.1em;
        padding: 20px;
    }
}

