/* Views styling for Carbon Updates Dashboard - Enhanced UI */

:root {
    --view-bg-color: #ffffff; /* Slightly off-white for content background */
    --table-header-bg: #f8f9fa;
    --table-row-hover-bg: #e9ecef;
    --table-border-color: #dee2e6;
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    --button-details-bg: #3498db; /* Blue for details */
    --button-details-hover-bg: #2980b9;
    --button-locate-bg: #2ecc71; /* Green for locate */
    --button-locate-hover-bg: #27ae60;
    --summary-bg: #2c3e50; /* Darker background for better contrast */
    --summary-border: #34495e;
    --summary-text-color: #ffffff; /* White text for better contrast */
    --summary-value-color: #4caf50; /* Bright green for values */
}

.view-container {
    display: none;
    width: 100%;
    height: 100%;
    overflow: auto;
}

.view-container.active {
    display: block;
}

/* Project View Specific Styles - Enhanced */
.project-view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 40px); /* Adjust if footer height changes */
    background-color: var(--view-bg-color);
    z-index: 5;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.project-view-panel.hidden {
    display: none;
}

/* Keep panel header styling consistent */
.panel-header {
    padding: 15px 20px; /* Increased padding */
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%); /* Match main header */
    color: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.3rem; /* Slightly larger */
    font-weight: 600;
}

.panel-controls {
    display: flex;
    gap: 10px;
}

.refresh-button {
    background: none;
    border: none;
    color: white; /* White icon on gradient header */
    cursor: pointer;
    font-size: 1.1rem; /* Slightly larger */
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s, transform 0.2s;
}

.refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.project-view-content {
    flex: 1;
    padding: 20px; /* Increased padding */
    overflow: visible; /* Changed from auto to visible to allow sticky elements to work */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Increased gap */
    padding-bottom: 30px;
}

/* Removed project-filters section */

.project-table-container {
    flex: 1;
    overflow: auto;
    border: none; /* Remove border, use shadow */
    border-radius: 8px; /* Rounded corners */
    box-shadow: var(--card-shadow);
    background-color: #fff; /* Ensure background for shadow */
    /* Adjust max-height if needed, consider summary height */
    max-height: calc(100vh - 220px); /* Approximate calculation */
    position: relative; /* Added to create a new stacking context */
}

.project-table {
    width: 100%;
    border-collapse: collapse;
}

.project-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--table-header-bg);
}

.project-table th {
    background-color: var(--table-header-bg);
    padding: 15px 20px; /* Increased padding */
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--table-border-color);
}

.project-table td {
    padding: 15px 20px; /* Increased padding */
    border-top: 1px solid var(--table-border-color);
    font-size: 0.95rem;
    vertical-align: middle;
}

.project-table tbody tr:nth-child(even) {
    background-color: #fdfdfd; /* Very subtle striping */
}

.project-table tbody tr:hover {
    background-color: var(--table-row-hover-bg);
}

/* Enhanced Action Buttons */
.action-button {
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px; /* Pill shape */
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 8px;
    transition: all 0.2s ease;
    display: inline-flex; /* Align icon and text */
    align-items: center;
    gap: 5px;
}

.action-button i {
    font-size: 0.9em; /* Adjust icon size relative to text */
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.action-button.view-details {
    background-color: var(--button-details-bg);
}
.action-button.view-details:hover {
    background-color: var(--button-details-hover-bg);
}

.action-button.locate-map {
    background-color: var(--button-locate-bg);
}
.action-button.locate-map:hover {
    background-color: var(--button-locate-hover-bg);
}

.loading-message, .error-message {
    padding: 30px;
    text-align: center;
    color: var(--text-light);
    font-style: italic;
}

.error-message {
    color: var(--error-color);
}

/* Enhanced Project Summary */
.project-summary {
    display: flex;
    justify-content: space-around; /* Distribute items evenly */
    padding: 20px;
    background-color: var(--summary-bg);
    border-radius: 8px;
    border: 1px solid var(--summary-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Make summary sticky at the bottom */
    position: sticky;
    bottom: 0;
    z-index: 8;
    margin-top: auto; /* Push to bottom if content is short */
    width: calc(100% - 40px); /* Account for parent padding */
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.summary-label {
    font-size: 0.85rem;
    color: var(--summary-text-color);
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 1.4rem; /* Larger value */
    font-weight: 600;
    color: var(--summary-value-color);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Ensure footer is visible and not overlapped */
.footer {
    position: relative;
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .project-summary {
        flex-direction: column;
        gap: 15px;
        align-items: stretch; /* Stretch items */
    }
    
    .action-button {
        padding: 10px 15px;
        margin-bottom: 8px;
        display: flex; /* Use flex for centering */
        justify-content: center;
        width: auto; /* Don't force full width */
        text-align: center;
    }
    
    .project-table-container {
        max-height: calc(100vh - 300px); /* Re-evaluate if needed */
    }
    
    .project-table th,
    .project-table td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .project-table td:last-child {
        /* Stack buttons vertically on small screens */
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
}
