/* Basic Reset & Body */
body {
    margin: 0;
    font-family: 'Roboto', Arial, sans-serif;
    /* Google Font */
    background-color: #f8f9fa;
    /* Very light grey background */
    color: #202124;
    /* Google's standard dark grey text */
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3 {
  color: #2c6e3c;
}

p {
    color: #5f6368;
    margin-bottom: 1.5em;
}

a {
    color: #1a73e8;
    /* Google Blue */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.portal-header {
    background-color: #ffffff;
    padding: 12px 0;
    border-bottom: 1px solid #dadce0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Removed sticky properties */
}

.portal-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    /* Allow wrapping on smaller screens */
}

.portal-header .logo {
    font-size: 1.4em;
    font-weight: 500;
    color: #5f6368;
    margin-right: 20px;
    display: flex; /* Added for alignment if needed */
    align-items: center; /* Vertically align items if logo div has other content */
}

.portal-header .logo img {
    width: 169px; /* Set exact width */
    height: 46px; /* Set exact height */
    display: block; /* Prevent extra space below image */
}

.portal-header nav {
    margin: 5px 0;
    /* Add some margin for wrapping */
}

.portal-header .container nav a { /* Increased specificity */
    margin: 0 12px;
    padding: 8px 0;
    color: #5f6368;
    font-weight: 500;
    font-size: 0.95rem; /* Changed em to rem */
    border-bottom: 2px solid transparent;
}

.portal-header .container nav a:hover { /* Increased specificity */
    color: #1a73e8;
    text-decoration: none;
}

.portal-header .container nav a.active { /* Increased specificity */
    color: #1a73e8;
    border-bottom: 2px solid #1a73e8;
}

/* --- Dropdown Styles --- */
.portal-header .nav-item.dropdown {
    position: relative; /* Context for absolute positioning */
    display: inline-block; /* Keep it inline with other nav items */
}

.portal-header .container .dropdown-toggle { /* Increased specificity */
    /* Style like other nav links */
    display: inline-block;
    margin: 0 12px;
    padding: 8px 0;
    color: #5f6368;
    font-weight: 500;
    font-size: 0.95rem; /* Changed em to rem */
    border-bottom: 2px solid transparent;
    cursor: pointer; /* Indicate it's clickable/hoverable */
    background: none;
    border: none;
}
.portal-header .container .dropdown-toggle:hover { /* Increased specificity */
    color: #1a73e8;
    text-decoration: none; /* Remove underline on hover for the toggle */
}


.portal-header .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 110;
    /* min-width removed as requested */
    padding: 10px 0;
}

.portal-header .container .dropdown:hover .dropdown-menu { /* Increased specificity */
    display: block; /* Show on hover */
}

.portal-header .dropdown-section {
    padding: 8px 15px 15px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem; /* Changed em to rem */
    line-height: 0.9rem;
}
.portal-header .dropdown-section:last-child {
    border-bottom: none;
    padding: 5px;
}

.portal-header .dropdown-section strong {
    display: block;
    margin-bottom: 0;
    color: #3c4043;
}

.portal-header .container .dropdown-menu a { /* Increased specificity */
    display: block; /* Make links take full width */
    padding: 0; /* Reset padding */
    margin: 0; /* Small vertical margin */
    color: #1a73e8; /* Link color */
    font-size: 0.9rem; /* Changed em to rem */
    font-weight: normal; /* Normal weight for dropdown links */
    border-bottom: none; /* Remove nav link border */
}
.portal-header .container .dropdown-menu a:hover { /* Increased specificity */
    text-decoration: underline; /* Underline on hover */
    background-color: transparent; /* No background on hover */
}

/* Specific styles for logout button */
#logout-button {
    text-decoration: none !important;
    font-size: 0.9em !important;
    font-weight: 500 !important;
}
#logout-button:hover {
    color: #0b5fce; /* Darker blue on hover */
    text-decoration: none !important;
    background-color: transparent !important;
}


.portal-header .user-info {
    font-size: 0.9em;
    color: #5f6368;
}

.portal-header .user-info span {
    margin-right: 15px;
}


/* Main Content */
.portal-main {
    padding: 0 0 30px 0;
    flex-grow: 1;
    /* Makes main content take available space */
}

/* Table Container - CONSOLIDATED RULES */
.data-table-container {
    /* Base properties */
    background-color: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.1);
    position: relative;
    
    /* Sizing and positioning */
    max-width: 100%;
    margin: 0 auto;
    overflow-x: auto;
    z-index: 1;
    /* padding-right removed from container */
}

/* Style for the inner table wrapper */
.table-scroll-wrapper {
    padding-right: 10px; /* Add padding here to allow space for shadow */
    width: 100%; /* Ensure it takes full width */
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Table cell sizing */
.data-table-container th,
.data-table-container td {
    padding: 6px 8px;
    font-size: 0.75rem;
}

/* First sticky column */
.data-table-container table th:first-child,
.data-table-container table td:first-child {
    position: sticky; /* Keep sticky */
    left: 0;
    background-color: #ffffff;
    z-index: 3;
    /* border-right removed */
    /* position: relative; removed */
}

/* Second sticky column */
.data-table-container table th:nth-child(2),
.data-table-container table td:nth-child(2) {
    position: sticky;
    left: var(--first-col-width, 0);
    background-color: #ffffff;
    z-index: 2;
    /* border-right removed */
    /* position: relative; removed */
    /* Re-add direct box-shadow */
    /* Permanent shadow AND border simulation for the second column */
    box-shadow: 2px 0 0 0 #dadce0, 4px 0 6px -2px rgba(0, 0, 0, 0.15); /* 2px border + shadow */
    text-align: right;
}

/* REMOVED conditional shadow rule for the first column */

/* Header cells in sticky columns need higher z-index */
.data-table-container thead th:first-child {
    z-index: 5;
    background-color: #f8f9fa !important;
}

.data-table-container thead th:nth-child(2) {
    z-index: 4;
    background-color: #f8f9fa !important;
}

table {
    width: 100%;
    border-collapse: separate; /* Change to separate */
    border-spacing: 0; /* Remove default spacing */
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    /* border-bottom removed from here */
    vertical-align: middle;
}

/* Explicitly add border-bottom to tbody cells */
tbody td {
    border-bottom: 1px solid #dadce0;
}

/* Thicker border for the insurance and profit margin rows */
tr.insurance-row td,
tr.profit-margin-row td {
    border-bottom-width: 2px;
    /* Optional: Use a slightly darker color if desired, e.g., #3c4043 */
}

thead th:first-child,
tbody td:first-child {
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
    /* No line after last row */
}

/* Footer */
.portal-footer {
    margin-top: auto;
    /* Push footer to bottom */
    padding: 20px 0;
    text-align: center;
    font-size: 0.85em;
    color: #5f6368;
    border-top: 1px solid #dadce0;
    background-color: #f8f9fa;
    /* Match body background */
}

/* Basic Responsiveness */
@media (max-width: 768px) {
    .portal-header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-header nav {
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .portal-header .user-info {
        margin-top: 5px;
        align-self: flex-start;
    }

    h1 {
        font-size: 1.8em;
    }

    th,
    td {
        padding: 10px 12px;
    }
}
