﻿.data-grid-container {
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    background: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 11px;
    max-width: 70vw;
}

.grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.toolbar-left {
    display: flex;
    gap: 20px;
}

.toolbar-right {
    display: flex;
    gap: 10px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    cursor: pointer;
}

.btn-toolbar {
    padding: 6px 12px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.btn-toolbar:hover {
    background: #e9e9e9;
    border-color: #999;
}

.btn-toolbar:active {
    background: #d0d0d0;
    transform: translateY(1px);
}

.grid-header {
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
}

.group-panel {
    padding: 12px 15px;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.group-hint {
    color: #999;
    font-style: italic;
}

.group-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 3px;
    font-size: 12px;
}

.group-tag button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    color: #666;
}

.search-box {
    padding: 10px 15px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.grid-content {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
}

.data-grid-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-grid-table thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.column-header {
    padding: 6px 8px;
    background: #f8f8f8;
    border-bottom: 2px solid #ddd;
    border-right: 1px solid #e0e0e0;
    text-align: left;
    font-weight: 600;
    max-width: 200px;
    cursor: move;
    user-select: none;
    position: relative;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-header:last-child {
    border-right: none;
}

.group-header-row {
    background: #e8e8e8;
}

.group-column-header {
    padding: 6px 8px;
    background: #e0e0e0;
    border-bottom: 1px solid #ccc;
    border-right: 1px solid #ccc;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
}

.sub-column-header {
    background: #f0f0f0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: space-between;
}

.header-text {
    flex: 1;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-text:hover {
    color: #4CAF50;
}

.sort-indicator {
    font-size: 10px;
    color: #4CAF50;
}

.filter-button {
    border: none;
    background: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    color: #666;
    border-radius: 2px;
}

.filter-button:hover {
    background: #e0e0e0;
    color: #333;
}

.filter-button.filter-active {
    background: #4CAF50;
    color: white;
}

.filter-button.filter-active:hover {
    background: #45a049;
}

.data-grid-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.data-grid-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.data-grid-table tbody tr:hover {
    background: rgba(80, 169, 221, 0.49) !important;
    cursor: pointer;
}

.data-grid-table tbody tr.selected {
    background: rgba(57, 159, 219, 0.77) !important;
    border-left: 3px solid #399fdb;
}

.data-grid-table td {
    padding: 4px 8px;
    border-right: 1px solid #f0f0f0;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    max-width: 200px;
    text-overflow: ellipsis;
    max-height: 28px;
    line-height: 1.4;
}

.data-grid-table td:last-child {
    border-right: none;
}

.no-data {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px !important;
}

.grid-footer {
    padding: 8px 15px;
    background: #f8f8f8;
    border-top: 1px solid #ddd;
    font-size: 13px;
    color: #666;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-info {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
}

.pagination-controls {
    display: flex;
    gap: 2px;
    flex: 0 1 auto;
    justify-content: center;
}

.btn-page {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 12px;
    border-radius: 3px;
    min-width: 28px;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #999;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-page.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.page-size-selector {
    flex: 0 0 auto;
}

.page-size-selector select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    background: white;
}

.page-size-selector select:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Responsive: stack on very small screens */
@media (max-width: 600px) {
    .pagination-container {
        flex-direction: column;
        gap: 8px;
    }

    .pagination-info,
    .pagination-controls,
    .page-size-selector {
        width: 100%;
        justify-content: center;
    }
}

/* Toggle Button Styles */
.toggle-button {
    padding: 2px 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
}

.toggle-button.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.toggle-button.inactive {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.toggle-button:hover {
    opacity: 0.8;
}

/* Indicator Change Styles */
.indicator-positive {
    color: rgb(40, 167, 69);
    font-weight: 600;
}

.indicator-negative {
    color: rgb(220, 53, 69);
    font-weight: 600;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-button {
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.close-button:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.column-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    user-select: none;
}

.column-option:hover {
    background: #f5f5f5;
    padding-left: 10px;
    margin-left: -10px;
    padding-right: 10px;
    margin-right: -10px;
}

.column-option input[type="checkbox"] {
    cursor: pointer;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    padding: 8px 16px;
    background: white;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f0f0f0;
    border-color: #999;
}

.filter-menu-overlay {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: transparent;
}

.filter-menu {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 400px;
    z-index: 1000;
}

.filter-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    background: #f8f8f8;
}

.close-btn {
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.close-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.filter-menu-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.filter-option {
    margin-bottom: 12px;
}

.filter-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.filter-option input[type="text"],
.filter-option input[type="number"],
.filter-option input[type="date"] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.filter-option input[type="text"]:focus,
.filter-option input[type="number"]:focus,
.filter-option input[type="date"]:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    cursor: pointer;
}

.distinct-values {
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
}

.filter-menu-footer {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-apply {
    padding: 6px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-apply:hover {
    background: #45a049;
}

.btn-clear {
    padding: 6px 16px;
    background: white;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: #f0f0f0;
    border-color: #999;
}
