/* =============================================================================
   AG Grid Custom Styles
   ============================================================================= */

/* Base Alpine Theme Customization */
.ag-theme-alpine.styled-ag-grid {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", sans-serif;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
}

/* Header Styling */
.ag-theme-alpine.styled-ag-grid .ag-header {
    background: linear-gradient(180deg, #00172d 0%, #001424 100%);
    font-weight: bold;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.ag-theme-alpine.styled-ag-grid .ag-header-cell {
    padding: 0 8px;
}

.ag-theme-alpine.styled-ag-grid .ag-header-cell-label {
    font-weight: bold;
    letter-spacing: 0.02em;
    justify-content: center;
}

.ag-theme-alpine.styled-ag-grid .ag-header-cell:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Cell Styling */
.ag-theme-alpine.styled-ag-grid .ag-cell {
    border: none !important;
    line-height: var(--ag-row-height);
    display: flex;
    align-items: center;
    padding: 0 var(--ag-cell-horizontal-padding);
    transition: background-color 0.2s ease;
}

.ag-theme-alpine.styled-ag-grid .ag-cell-focus {
    outline: none !important;
    background-color: rgba(0, 199, 147, 0.1) !important;
}

/* Row Styling */
.ag-theme-alpine.styled-ag-grid .ag-row {
    transition: background-color 0.15s ease;
}

.ag-theme-alpine.styled-ag-grid .ag-row-even {
    background-color: var(--ag-even-row-background-color);
}

.ag-theme-alpine.styled-ag-grid .ag-row-odd {
    background-color: var(--ag-odd-row-background-color);
}

.ag-theme-alpine.styled-ag-grid .ag-row-hover {
    background-color: var(--ag-row-hover-color) !important;
    cursor: pointer;
}

.ag-theme-alpine.styled-ag-grid .ag-row-selected {
    background-color: var(--ag-selected-row-background-color) !important;
}

/* Text Alignment */
.ag-theme-alpine.styled-ag-grid .text-left {
    text-align: left;
    justify-content: flex-start;
}

.ag-theme-alpine.styled-ag-grid .text-center {
    text-align: center;
    justify-content: center;
}

.ag-theme-alpine.styled-ag-grid .text-right {
    text-align: right;
    justify-content: flex-end;
    padding-right: 12px;
}

/* Special Row Styles */
.ag-theme-alpine.styled-ag-grid .ag-row-title {
    background-color: #00c793 !important;
    color: white !important;
    font-weight: bold;
}

.ag-theme-alpine.styled-ag-grid .ag-row-subtitle {
    background-color: #00c793 !important;
    color: white !important;
    font-weight: bold;
}

.ag-theme-alpine.styled-ag-grid .ag-row-subtitle .ag-cell:first-child {
    padding-left: 24px;
}

.ag-theme-alpine.styled-ag-grid .ag-row-red-section {
    background-color: #ff004c !important;
    color: white !important;
    font-weight: bold;
}

.ag-theme-alpine.styled-ag-grid .ag-row-total {
    background-color: #e9ecef !important;
    font-weight: bold;
}

.ag-theme-alpine.styled-ag-grid .ag-row-summary {
    background-color: #FFB6C1 !important;
    font-weight: bold;
}

.ag-theme-alpine.styled-ag-grid .ag-row-info {
    background-color: #E8F4F8 !important;
    font-style: italic;
}

.ag-theme-alpine.styled-ag-grid .ag-row-emphasis {
    background-color: #fff3cd !important;
    font-weight: 500;
}

/* Sort and Filter Icons */
.ag-theme-alpine.styled-ag-grid .ag-sort-ascending-icon,
.ag-theme-alpine.styled-ag-grid .ag-sort-descending-icon {
    margin-left: 4px;
    opacity: 0.8;
}

.ag-theme-alpine.styled-ag-grid .ag-header-cell-sorted-asc,
.ag-theme-alpine.styled-ag-grid .ag-header-cell-sorted-desc {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Filtering */
.ag-theme-alpine.styled-ag-grid .ag-floating-filter {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.ag-theme-alpine.styled-ag-grid .ag-filter-input {
    border: 1px solid var(--ag-input-border-color);
    padding: 4px 8px;
    border-radius: 4px;
}

.ag-theme-alpine.styled-ag-grid .ag-filter-input:focus {
    border-color: var(--ag-input-focus-border-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 199, 147, 0.2);
}

/* Pagination */
.ag-theme-alpine.styled-ag-grid .ag-paging-panel {
    border-top: 1px solid #e9ecef;
    padding: 8px 12px;
    font-size: 12px;
    background-color: #f8f9fa;
}

/* Cell Editing */
.ag-theme-alpine.styled-ag-grid .ag-cell-inline-editing {
    border: 2px solid var(--ag-input-focus-border-color) !important;
    background: white !important;
    box-shadow: 0 2px 8px rgba(0, 199, 147, 0.2);
}

/* Range Selection */
.ag-theme-alpine.styled-ag-grid .ag-range-selected {
    background-color: var(--ag-range-selection-background-color) !important;
}

/* Scrollbars */
.ag-theme-alpine.styled-ag-grid ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.ag-theme-alpine.styled-ag-grid ::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.ag-theme-alpine.styled-ag-grid ::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.ag-theme-alpine.styled-ag-grid ::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Container Styling */
.ag-grid-container {
    position: relative;
    width: 100%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ag-theme-alpine.styled-ag-grid {
        --ag-font-size: 11px;
        --ag-row-height: 38px;
        --ag-header-height: 42px;
        --ag-cell-horizontal-padding: 6px;
    }
}

@media (max-width: 480px) {
    .ag-theme-alpine.styled-ag-grid {
        --ag-font-size: 10px;
        --ag-row-height: 32px;
        --ag-header-height: 36px;
        --ag-cell-horizontal-padding: 4px;
    }
}

/* Print Styles */
@media print {
    .ag-theme-alpine.styled-ag-grid {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    .ag-theme-alpine.styled-ag-grid .ag-header {
        background: #00172d !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ag-theme-alpine.styled-ag-grid .ag-row-even {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide interactive elements */
    .ag-theme-alpine.styled-ag-grid .ag-side-bar,
    .ag-theme-alpine.styled-ag-grid .ag-paging-panel,
    .ag-theme-alpine.styled-ag-grid .ag-status-bar,
    .ag-theme-alpine.styled-ag-grid .ag-floating-filter {
        display: none !important;
    }
}

/* Performance Optimizations */
.ag-theme-alpine.styled-ag-grid .ag-row {
    will-change: transform;
}

.ag-theme-alpine.styled-ag-grid .ag-cell {
    contain: layout style paint;
}