/*
 * OEUK Supply Chain Map Pro - Modern, Slick, Full-Width Styles
 * Author: Gemini AI
 */

/* 1. Global Reset, Full-Width Container, and Typography */
#scm-container {
    /* FULL WIDTH REQUIREMENT */
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #343a40; /* Dark gray for text */
    background-color: #f8f9fa; /* Light, modern background for the whole component */
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
}

/* 2. Header and Title Styles (Impactful - Includes Toggle Button) */
#scm-header {
    background-color: #003366; /* Deep Navy Blue (OEUK Primary Color) */
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); 
    margin-bottom: 0; 
    display: flex; /* Aligns Title and Button */
    justify-content: space-between; 
    align-items: center; 
}

#scm-header h2 {
    color: #FFFFFF; /* White Title */
    margin: 0;
    font-size: 2.25rem; 
    font-weight: 700;
}

/* 3. Filter Bar Layout (Below Header) */
#scm-filters-toggle-bar {
    background-color: #ffffff; /* White background for the filter bar */
    padding: 1rem 2rem; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); 
    margin-bottom: 1.5rem; 
}

#scm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem; 
    align-items: center;
    flex-grow: 1;
}

/* 4. Modern Filter Dropdown Styles */
.scm-filter {
    padding: 0.75rem 1.25rem;
    border: 1px solid #ced4da; 
    border-radius: 8px; 
    background-color: #fff;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
    height: 48px; 
}

.scm-filter:hover, .scm-filter:focus {
    border-color: #007bff; 
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
    outline: none;
}

/* 5. Modern Button Styles (View Toggle & Clear Filters) */
#scm-toggle-view, #scm-clear-filters {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
    height: 48px; 
}

/* Primary Button (Toggle View) */
#scm-toggle-view {
    background-color: #00aaff; /* OEUK Bright Blue */
    color: white;
}
#scm-toggle-view:hover {
    background-color: #007bbd;
    transform: translateY(-1px);
}

/* Secondary/Warning Button (Clear Filters) */
#scm-clear-filters {
    background-color: #dc3545; /* Modern Red/Danger color */
    color: white;
}

#scm-clear-filters:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}


/* 6. Main Content Layout (Map/List & Sidebar) */
#scm-main-content {
    display: flex;
    position: relative;
    height: 70vh;
    min-height: 550px; 
    margin: 0 2rem 2rem 2rem; 
}

/* Map and List Views */
#scm-map-view, #scm-list-view {
    flex-grow: 1;
    transition: width 0.3s ease, margin-right 0.3s ease;
    height: 100%;
    border-radius: 10px; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); 
    background-color: white;
}

/* FIX: Ensure only one view is displayed at a time */
.hidden-view {
    display: none !important; 
}
.active-view {
    display: block; 
    width: 100%; 
    height: 100%;
}

/* Filtered Results Header Styling - REMOVED (Element will be removed in JS) */
/* .scm-results-header {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #003366;
    font-size: 1.25rem;
    font-weight: 600;
} */


/* Preserve dynamic width logic for sidebar */
#scm-main-content.sidebar-open #scm-map-view,
#scm-main-content.sidebar-open #scm-list-view {
    width: calc(100% - 350px);
    margin-right: 350px;
}

/* 7. Slick Sidebar Styling */
#scm-sidebar {
    width: 0;
    overflow-x: hidden;
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    background-color: #ffffff;
    box-shadow: -6px 0 15px rgba(0, 0, 0, 0.15); 
    z-index: 20;
    padding: 0;
    transition: width 0.3s ease;
    border-left: 1px solid #dee2e6;
}

#scm-sidebar.open {
    width: 350px;
    padding: 1.5rem; 
}

/* Sidebar Inner Content */
.scm-sidebar-inner h3 {
    color: #003366;
    margin-top: 5px;
    border-bottom: 2px solid #00aaff; 
    padding-bottom: 10px;
    font-size: 1.5rem;
    font-weight: 600;
}

.scm-description {
    margin-bottom: 1.5rem;
    font-size: 1em;
    line-height: 1.6;
    color: #495057;
}

.sidebar-close {
    /* X button styling */
    top: 15px;
    right: 15px;
    font-size: 30px;
    color: #adb5bd;
    transition: color 0.2s;
}
.sidebar-close:hover {
    color: #343a40;
}


/* 8. List View Styling (Minimized Wasted Space & Modern Cards) */
#scm-list-view {
    padding: 1.5rem;
    overflow-y: auto;
    background-color: #f8f9fa; 
}

.scm-company-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.scm-list-item {
    background-color: white;
    border: 1px solid #e9ecef; 
    border-radius: 8px;
    padding: 1rem; /* Tighter padding to save space */
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.scm-list-item:hover {
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scm-list-item h4 {
    margin-top: 0;
    margin-bottom: 0.25rem; 
    color: #003366;
    font-size: 1.35rem;
    font-weight: 700;
}

/* Minimize wasted space in description/details text */
.scm-list-item-description {
    font-size: 0.95rem;
    color: #6c757d;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    max-height: 2.8em; /* Limit to approx 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
}


.scm-list-view-details {
    /* Details button for each list item */
    background-color: #6c757d; 
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.scm-list-view-details:hover {
    background-color: #5a6268;
}


/* 9. Modern Sidebar Term Tags */
.scm-term-list {
    padding: 0;
    margin: 1.5rem 0 0 0;
}

.scm-term-list li {
    margin-bottom: 15px;
    border-bottom: 1px dashed #e9ecef;
    padding-bottom: 15px;
    font-weight: 600;
    color: #343a40;
}

.scm-term-tag {
    display: inline-block;
    background-color: #e6f3ff; 
    color: #007bff; 
    padding: 4px 10px;
    border-radius: 15px; 
    margin-right: 8px;
    margin-top: 5px;
    font-size: 0.85em;
    font-weight: 500;
    white-space: nowrap;
}


/* 10. Responsive Layout for Mobile/Tablet */
@media (max-width: 1024px) {
    #scm-main-content {
        flex-direction: column;
        height: auto;
        min-height: 400px; 
        margin: 0 1rem 1rem 1rem;
    }
    
    #scm-map-view {
        height: 400px; 
    }

    /* Stack header bar elements */
    #scm-header {
        padding: 1rem;
    }
    #scm-header h2 {
        font-size: 1.5rem;
    }
    #scm-toggle-view {
        height: auto;
    }

    /* Stack filter bar elements */
    #scm-filters-toggle-bar {
        padding: 1rem;
    }

    #scm-filters {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .scm-filter, #scm-clear-filters {
        width: 100%;
    }

    /* Sidebar goes full-width on mobile, but maintains absolute positioning */
    #scm-sidebar {
        width: 0;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;
        transition: width 0.3s ease, transform 0.3s ease;
        transform: translateX(100%);
    }

    #scm-sidebar.open {
        width: 100%;
        transform: translateX(0); 
    }

    /* Remove the shrinking map/list view effect on small screens */
    #scm-main-content.sidebar-open #scm-map-view,
    #scm-main-content.sidebar-open #scm-list-view {
        width: 100%;
        margin-right: 0;
    }
}