/* Global Styles */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif; /* IBM Plex Sans */
    background-color: #f4f4f4; /* Carbon background color */
    color: #161616; /* Carbon text color */
}
*{
    box-sizing: border-box;
}
/* Header Styles */
.header {
    background-color: #161616; /* Carbon header background */
    color: #fff; /* Carbon header text color */
    padding: 1rem 1rem; /* Carbon header padding */
    display: flex;
    align-items: center;
    height: 3rem; /* Carbon header height */
    position: relative; /* User requested non-fixed header */
    width: 100%;
    font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
}

.header__name {
    font-size: 1.25rem; /* Carbon header name font size */
    font-weight: 600; /* Carbon header name font weight */
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.header__name:hover {
    opacity: 0.8;
}

.header__name--prefix {
    font-weight: 400; /* Carbon header prefix font weight */
    opacity: 0.7;
    margin-right: 0.25rem;
}

.header__logo {
    width: 24px;
    height: 24px;
    margin-right: 0.5rem;
    display: inline-block;
}

/* Grid System (Basic Mimicry) */
.grid--full-width {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem; /* Gutter compensation */
    margin-left: -0.5rem; /* Gutter compensation */
}

.col-lg-16,
.col-lg-8 {
    padding-right: 0.5rem; /* Gutter */
    padding-left: 0.5rem; /* Gutter */
    box-sizing: border-box;
}

.col-lg-16 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-lg-8 {
    flex: 0 0 50%;
    max-width: 50%;
}

@media (max-width: 672px) {
    .col-lg-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Typography */
.type-gamma {
    font-size: 1.5rem; /* Example Carbon type size */
    font-weight: 600;
    line-height: 1.33;
}

.type-body-long-01 {
    font-size: 0.875rem; /* Example Carbon type size */
    font-weight: 400;
    line-height: 1.25;
}

.type-delta {
    font-size: 1.125rem; /* Example Carbon type size */
    font-weight: 600;
    line-height: 1.22;
}

/* Tile Styles */
.tile {
    background-color: #fff;
    padding: 1rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem; /* Spacing between tiles */
}

/* Button Styles */
.btn-set {
    display: flex;
    gap: 1rem; /* Spacing between buttons in a set */
    margin-top: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1rem; /* Carbon button padding */
    font-size: 0.875rem; /* Carbon button font size */
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    transition: background-color 70ms cubic-bezier(0.2, 0, 0.38, 0.9), border-color 70ms cubic-bezier(0.2, 0, 0.38, 0.9), opacity 70ms cubic-bezier(0.2, 0, 0.38, 0.9);
}

.btn--primary {
    background-color: #0f62fe; /* Carbon blue */
    color: #fff;
}

.btn--primary:hover {
    background-color: #0353e9;
}

.btn--secondary {
    background-color: #6f6f6f; /* Carbon gray */
    color: #fff;
}

.btn--secondary:hover {
    background-color: #525252;
}

.btn--ghost {
    background-color: transparent;
    color: #0f62fe; /* Carbon blue */
    border-color: transparent;
}

.btn--ghost:hover {
    background-color: rgba(15, 98, 254, 0.1);
}

.btn__icon {
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    fill: currentColor;
}

/* Form Elements */
.file-input {
    /* Basic styling for file input */
    padding: 0.5rem;
    border: 1px solid #8d8d8d;
    border-radius: 0.25rem;
    flex: 1;
}

.text-area {
    width: 100%;
    height: auto;
    font-family: 'IBM Plex Mono', 'Courier New', monospace; /* Mimic Carbon font */
    padding: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #8d8d8d;
    background-color: #fff;
    resize: vertical;
}

/* Other elements from original index.css */
.hidden {
    display: none !important;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.report-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

@media (max-width: 768px) {
    .report-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .report-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

.report-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .report-content {
        grid-template-columns: 1fr;
    }
}

.data-section,
.layout-section {
    background-color: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
}

.data-section h3,
.layout-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
}

.upload-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

#data-list {
    margin-top: 1rem;
}

.data-item {
    background-color: white;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.data-item-name {
    font-weight: 600;
}

.data-item-type {
    background-color: #8d8d8d;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
}

.charts-section {
    background-color: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: calc(100vh - 180px);
}

.charts-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

#charts-container {
    flex: 1 1 auto;
    min-height: 300px;
    background-color: white;
    border-radius: 4px;
    padding: 1rem;
    position: relative;
    overflow: auto;
}

.chart-wrapper {
    margin-bottom: 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.75rem;
    background: #fff;
    position: relative;
    min-height: 240px;
    height: 400px;
    width: 640px; /* default width for new wrappers; can be overridden inline */
}

.chart-wrapper:last-child {
    margin-bottom: 0;
}

.chart-wrapper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    cursor: move;
    color: #6f6f6f;
    user-select: none;
    height: 28px;
    padding: 0 4px;
}

.drag-handle {
    font-weight: 900;
    letter-spacing: 2px;
}

.chart-edit-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    color: #525252;
}

.chart-edit-btn:hover {
    background: #f4f4f4;
    border-color: #0f62fe;
    color: #0f62fe;
}

.chart-edit-btn svg {
    width: 16px;
    height: 16px;
}

.chart-wrapper.dragging {
    opacity: 0.6;
}

#charts-container.drag-over {
    border: 2px dashed #0f62fe;
}

/* Resizable chart container */
.chart-canvas-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    height: calc(100% - 28px);
    overflow: auto; /* allow inner scroll when content grows */
    border: 1px dashed rgba(0,0,0,0.1);
    border-radius: 4px;
}

.chart-canvas-container canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Resize edges (drag anywhere on the chart-wrapper edges) */
.resize-edge {
    position: absolute;
    z-index: 2;
}
.resize-edge.n { top: 0; left: 0; right: 0; height: 8px; cursor: ns-resize; }
.resize-edge.s { bottom: 0; left: 0; right: 0; height: 8px; cursor: ns-resize; }
.resize-edge.e { top: 0; bottom: 0; right: 0; width: 8px; cursor: ew-resize; }
.resize-edge.w { top: 0; bottom: 0; left: 0; width: 8px; cursor: ew-resize; }

/* Field Cards for Layout Editor Hints */
.field-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.field-card {
    background-color: #e0e0e0; /* Light gray background */
    color: #161616; /* Dark text */
    padding: 0.25rem 0.75rem;
    border-radius: 1rem; /* Pill shape */
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #c6c6c6;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.field-card:hover {
    background-color: #c6c6c6;
}

/* Dataset Info and Tips */
.dataset-info {
    background-color: #f0f8ff;
    padding: 0.75rem;
    border-radius: 4px;
    border-left: 4px solid #0f62fe;
    margin-bottom: 1rem;
}

.generic-tips {
    background-color: #fff3cd;
    padding: 0.75rem;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
    margin-top: 1rem;
}

.generic-tips ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.generic-tips li {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Dataset Info */
.dataset-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f4f4f4;
    border-radius: 4px;
    border-left: 4px solid #0f62fe;
}

/* Generic Tips */
.generic-tips {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #f0f8ff;
    border-radius: 4px;
    border-left: 4px solid #0f62fe;
}

.generic-tips ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.generic-tips li {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #393939;
}

/* Field Groups */
.field-group {
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.group-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #393939;
    margin-right: 0.5rem;
    min-width: 100px;
}

/* Dataset Info */
.dataset-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #0f62fe;
}

.dataset-info p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

/* Suggestions */
.suggestions {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #e8f4fd;
    border-radius: 4px;
    border-left: 4px solid #0f62fe;
}

.suggestions ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.suggestions li {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #393939;
}

/* Chart Configuration Section */

.chart-config-section .form-group {
    margin-bottom: 1rem;
}

.chart-config-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #393939; /* Carbon text color */
}

.chart-config-section input[type="text"],
.chart-config-section select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #8d8d8d;
    border-radius: 0.25rem;
    font-size: 1rem;
    background-color: #fff;
    color: #161616;
    box-sizing: border-box;
}

.chart-config-section input[type="text"]:focus,
.chart-config-section select:focus {
    outline: none;
    border-color: #0f62fe; /* Carbon blue focus */
    box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.2); /* Carbon focus ring */
}

/* Drag and Drop Feedback */
.drag-over {
    border: 2px dashed #0f62fe; /* Carbon blue dashed border */
    background-color: rgba(15, 98, 254, 0.1); /* Light blue background */
}

/* Chart Summary */
.chart-summary {
    background-color: #f4f4f4;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
    font-size: 0.875rem;
    border-left: 4px solid #0f62fe;
}

.chart-summary p {
    margin: 0.25rem 0;
    color: #393939;
}

/* File Manager Styles */
.file-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
}

.file-manager-actions {
    display: flex;
    gap: 0.5rem;
}

.file-search-section {
    margin-bottom: 1rem;
}

.search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.search-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6f6f6f;
}

/* Tabs */
.file-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6f6f6f;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button:hover {
    color: #161616;
    background-color: #f4f4f4;
}

.tab-button.active {
    color: #0f62fe;
    border-bottom-color: #0f62fe;
}

.tab-icon {
    width: 16px;
    height: 16px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* File Card */
.file-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-card:hover {
    border-color: #0f62fe;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.file-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.file-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #161616;
    word-break: break-word;
    flex: 1;
    margin-right: 0.5rem;
}

.file-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.file-action-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 2px;
    color: #6f6f6f;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background-color: #f4f4f4;
    color: #161616;
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6f6f6f;
}

.file-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-chart-type {
    background: #e0e0e0;
    color: #161616;
    padding: 0.125rem 0.375rem;
    border-radius: 12px;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
}

.file-chart-type.bar { background: #e3f2fd; color: #1976d2; }
.file-chart-type.line { background: #e8f5e8; color: #2e7d32; }
.file-chart-type.pie { background: #fff3e0; color: #f57f17; }

.file-thumbnail {
    width: 100%;
    height: 120px;
    background: #f4f4f4;
    border-radius: 4px;
    margin: 0.75rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-thumbnail-placeholder {
    color: #6f6f6f;
    font-size: 0.75rem;
    text-align: center;
}

.file-size {
    font-weight: 500;
}

.file-date {
    font-style: italic;
}

.file-data-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #0f62fe;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6f6f6f;
}

.empty-state svg {
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #161616;
}

.empty-state p {
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    border-radius: 4px;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #161616;
}

.modal-body {
    padding: 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    background: #f4f4f4;
}

/* File Preview in Modal */
.file-preview {
    margin-bottom: 1rem;
}

.file-preview-thumbnail {
    width: 100%;
    max-height: 200px;
    background: #f4f4f4;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.file-preview-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.file-preview-meta-item {
    display: flex;
    flex-direction: column;
}

.file-preview-meta-label {
    font-weight: 600;
    color: #6f6f6f;
    margin-bottom: 0.25rem;
}

.file-preview-meta-value {
    color: #161616;
}

/* Rename Input */
.rename-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.rename-input:focus {
    outline: none;
    border-color: #0f62fe;
    box-shadow: 0 0 0 2px rgba(15, 98, 254, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .files-grid {
        grid-template-columns: 1fr;
    }
    
    .file-manager-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-stats {
        justify-content: space-between;
        margin-top: 0.5rem;
    }
    
    .modal-content {
        min-width: auto;
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}