@import "custom.css";

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container {
    min-height: 100%; /* Changed from height to min-height */
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden; /* Prevent container overflow */
    position: relative; /* For positioning context */
}

.grid-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 40px;
    gap: 15px;
}

.search-container {
    display: flex;
    align-items: center;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #dde2eb;
    border-radius: 4px;
    width: 250px;
    font-size: 14px;
    margin-right: 8px;
}

.search-input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.clear-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #dde2eb;
    padding: 3px 9px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.clear-btn:hover {
    background-color: #e0e0e0;
}

.export-btn {
    background-color: transparent;
    border: none;
    padding: 8px 16px 5px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}


.grid-container {
    flex: 0 1 auto; /* Changed from flex: 1 */
    height: 1000px !important; /* Set to 1000px with !important to override AG Grid's inline styles */
    width: 100%; /* Full width of container */
    overflow-x: hidden; /* Horizontal scrolling */
    overflow-y: auto !important; /* Enable vertical scrolling */
    margin-bottom: 20px; /* Added space before legend */
}

/* Set a fixed height for the AG Grid body */
.ag-body-viewport {
    max-height: 800px !important; /* Set to 900px to allow scrolling within the grid body */
    overflow-y: auto !important; /* Enable vertical scrolling */
}

/* Custom scrollbar styling for better visibility */
.grid-container::-webkit-scrollbar,
.ag-body-viewport::-webkit-scrollbar {
    height: 12px;
    background-color: #f5f5f5;
}

.grid-container::-webkit-scrollbar-thumb,
.ag-body-viewport::-webkit-scrollbar-thumb {
    background-color: #0078d4;
    border-radius: 6px;
}

.grid-container::-webkit-scrollbar-track,
.ag-body-viewport::-webkit-scrollbar-track {
    background-color: #f5f5f5;
    border-radius: 6px;
}

.legend {
    margin-top: 20px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 5px;
    position: relative; /* Ensure it's in the normal flow */
}

.ag-header-cell-label {
    white-space: normal !important;
    word-break: break-word !important;
}

/* Make header rows sticky */
.ag-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}


/* Hide all column separators by default */
.ag-header-cell::after {
    display: none !important;
}

/* Show left separator for header group cells */
.project-financing-header.ag-header-group-cell::before,
.mobilization-header.ag-header-group-cell::before,
.development-impact-header.ag-header-group-cell::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #dde2eb;
}

/* Show right separator for header group cells */
.project-financing-header.ag-header-group-cell::after,
.mobilization-header.ag-header-group-cell::after,
.development-impact-header.ag-header-group-cell::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #dde2eb;
    display: block !important;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 5px;
    width: 70%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
}

.show-more-link {
    color: #0078d4;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.9em;
}

.show-more-link:hover {
    text-decoration: none;
}

#modal-title {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

#modal-text {
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
}

/* Tab styles */
.tabs-container {
    margin: 20px 0 10px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #dde2eb;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 10px 20px;
    background-color: #f8f8f8;
    border: 1px solid #dde2eb;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    cursor: pointer;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.6);
    position: relative;
    bottom: -1px;
}

.tab-btn.active {
    background-color: #fff;
    color: #0078d4;
    border-bottom: 1px solid #fff;
    font-weight: 600;
}

.tab-btn:hover:not(.active) {
    background-color: #f0f0f0;
}

.tab-content {
    display: none;
}

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

#pws-tbl,
#miga-tbl {
    height: auto !important;
}
