/* Profile Selector Layout */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 2rem;
}

.left-column {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.right-column {
    flex: 1;
    min-width: 300px;
}



/* Dimensions Box */
.dimensions-box {
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    flex: 2;
    min-width: 0;
}

.dimensions-box h3 {
    color: rgba(0, 0, 0, 0.379);
    font-size: 1.2rem;
    font-weight: 700;
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    margin: 0;
    z-index: 0;
}

.dimensions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

.dimension-item {
    padding: 6px 4px;
    border-radius: 6px;
    background: #f5f5f5;
    margin-bottom: 2px;
}

.dimension-header {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    /* text-transform: uppercase; */
    color: rgba(9, 78, 227, 0.952);
    letter-spacing: 0.5px;
}

.dimensions-subheader {
    font-size: 11px;
    font-weight: normal;
    color: rgba(0, 0, 0, 0.6);
}

.dimension-icon {
    color: var(--primary-color);
    font-size: 16px;
}

.dimension-title {
    font-weight: 700;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.87);
}

.dimension-description {
    margin: 0;
    padding-left: 22px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    line-height: 1.3;
}



.loading-icon {
    font-size: 32px !important;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.error-icon {
    font-size: 32px !important;
    color: #dc3545;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.custom-dimensions-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.dimension-selector {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    max-width: 100%;
    align-items: center;
}

#dimension-dropdown {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
    max-width: calc(100% - 120px);
    width: 100%;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#dimension-dropdown:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#dimension-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.9);
}

#dimension-dropdown option {
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
}

.add-dimension-btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.add-dimension-btn:hover {
    opacity: 0.7;
}

.add-dimension-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.selected-dimensions {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.selected-dimension {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.selected-dimension h4 {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.2;
    font-weight: 600;
    color: var(--text-color);
}

.selected-dimension p {
    margin: 0.2rem 0 0 0;
    font-size: 0.7rem;
    line-height: 1.3;
    color: var(--text-secondary-color);
}

.selected-dimension .dimension-icon {
    color: var(--success-color);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.remove-dimension {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
}

.remove-dimension:hover {
    background-color: rgba(var(--error-color-rgb), 0.1);
    border-radius: 50%;
}



.profile-grid-container {
    display: flex;
    flex-direction: row;    /* Side by side when space permits */
    flex-wrap: wrap;        /* Stack when narrow */
    gap: 20px;
   
}

.section-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 200px);  /* Dynamic height based on viewport */
}

.section-container:first-child {
    flex: 1;
    min-width: 300px;
    max-width: 350px;
}

.section-container:last-child {
    flex: 3;
}

.section-header {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.6);
    letter-spacing: 0.5px;
}

.profile-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    flex: 1;
    min-width: 0;
}

/* Removed unscoped .profile-card; use #profile-selector .profile-card */

/* Removed unscoped .profile-card icon rule; use #profile-selector .profile-card .profile-icon */

/* Removed unscoped .profile-card h3; use #profile-selector scoped rules */

/* Removed unscoped .profile-card:hover */

/* Removed unscoped .profile-card.selected */

.custom-card {
    border: 2px dashed var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

.custom-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-top: 8px;
}

.custom-dimensions-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.dimensions-list {
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.dimension-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Ensure checkboxes are properly styled */
.mdc-checkbox {
    padding: 0;
    margin-right: 8px;
}

/* Style scrollbars */
.profile-grid::-webkit-scrollbar,
.dimensions-box::-webkit-scrollbar {
    width: 6px;
}

.profile-grid::-webkit-scrollbar-track,
.dimensions-box::-webkit-scrollbar-track {
    background: transparent;
}

.profile-grid::-webkit-scrollbar-thumb,
.dimensions-box::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.profile-grid::-webkit-scrollbar-thumb:hover,
.dimensions-box::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Custom dimensions dialog adjustments */
.custom-dimensions-dialog .mdc-select {
    max-width: 100%;
    overflow: hidden;
}

.mdc-select__menu {
    max-width: 100%;
}

.mdc-list-item__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dimensions-header {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    /* text-transform: uppercase; */
    color: rgba(0, 0, 0, 0.6);
    letter-spacing: 0.5px;
}

.profile-selector {
    padding: 20px;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
}

.profile-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

/* Removed grid .profile-card; rely on #profile-selector scope styles */

/* Removed hover variant for unscoped .profile-card */

/* Removed selected variant for unscoped .profile-card */

.dimension-details {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 400px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Add media query while preserving existing styles */
@media (max-width: 1200px) {
    .dimension-details {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        max-height: none;
        margin-top: 20px;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* Profile Selector Layout - Enhanced Specificity */
#profile-selector.content-container {
    display: flex !important; /* Use !important to override any inline styles */
    gap: 2rem !important;
    height: auto !important;
    max-height: 400px !important; /* Increased from 400px for better content visibility */
    margin-bottom: 2rem !important;
}

/* Add mobile-specific stacking rules with increased specificity */
@media (max-width: 768px) {
    /* Make container stack vertically */
    #profile-selector.content-container {
        flex-direction: column !important;
        gap: 1.5rem !important; /* Slightly more space between stacked elements */
        height: auto !important; /* Allow container to grow based on stacked content */
        max-height: none !important; /* Remove max height constraint */
    }

    /* Ensure both grid and dimensions box have same height */
    #profile-selector .profile-grid,
    #profile-selector .dimensions-box {
        width: 100% !important; /* Take full width */
        flex: none !important; /* Reset flex values from desktop */
        max-height: 380px !important; /* Use same height as desktop */
        height: 380px !important; /* Fixed height on mobile */
        overflow-y: auto !important; /* Ensure internal scrolling works */
    }

    #profile-selector .dimensions-box h3 { /* Target the h3 within dimensions-box specifically on mobile */
        position: static !important; /* Override absolute positioning from desktop */
        top: auto !important;
        left: auto !important;
        width: auto !important; /* Allow natural width */
        text-align: left !important; /* Default text alignment */
        margin-top: 0 !important; /* Consistent with later rule, if needed */
        margin-bottom: 15px !important; /* Consistent with later rule */
        font-size: 1.1em !important; /* Consistent with later rule */
        /* color, text-transform, font-weight, letter-spacing will be inherited or taken from the later rule */
    }

    /* Ensure dimensions-grid goes to a single column */
    #profile-selector .dimensions-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }

    /* Ensure dimension items fill the width */
    #profile-selector .dimension-item {
        width: 100% !important; 
    }
}

/* --- Profile Selector Container --- */
#profile-selector {
    max-width: 1000px;
    margin: 20px auto; 
    display: block; /* Ensure it behaves as a block */
}

/* --- Tab Bar Styling --- */
#profile-selector .profile-selector-header {
    display: flex;
    flex-direction: column; /* stack buttons under tab bar */
    align-items: stretch;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    gap: 2px; /* tighter coupling between tab and buttons */
}
#profile-selector .profile-selector-tab-bar {
     flex: 1 1 auto;
     min-width: 0;
     margin-bottom: 0; /* remove extra space under tabs if any */
}
#profile-selector .profile-selector-tab-bar .mdc-tab--active {
    background-color: var(--primary-color, #2196f3);
    border-color: var(--primary-color, #2196f3); 
    border-bottom: none; 
    border-radius: 6px 6px 0 0; 
    margin-bottom: -1px; /* Overlap border */
}
#profile-selector .profile-selector-tab-bar .mdc-tab--active .mdc-tab__text-label {
    color: white;
}
#profile-selector .profile-selector-tab-bar .mdc-tab--active .mdc-tab-indicator {
    display: none;
}
/* Make tabs a bit narrower to create space for buttons */
#profile-selector .profile-selector-tab-bar .mdc-tab {
    min-width: 120px;
    padding: 0 12px;
}
/* Add rule for inactive tab text color */
#profile-selector .profile-selector-tab-bar .mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label {
    color: var(--primary-color, #2196f3); /* Use primary blue for inactive tab text */
}
#profile-selector .profile-selector-tab-bar .mdc-tab:not(.mdc-tab--active):hover .mdc-tab__ripple::before,
#profile-selector .profile-selector-tab-bar .mdc-tab:not(.mdc-tab--active) .mdc-tab__ripple::after {
    background-color: rgba(0, 0, 0, 0.06);
}

/* --- Styling for Logged-Out Custom Profiles Tab --- */
/* Remove positioning styles from the tab itself */
#profile-selector #custom-profiles-tab {
    /* position: relative; */ /* Removed */
    /* overflow: visible; */ /* Removed */
    /* padding-bottom: 20px; */ /* Removed */
}

#profile-selector.is-logged-out #custom-profiles-tab .mdc-tab__text-label {
    color: #9e9e9e !important; /* Grey color for logged-out text, !important might be needed */
}

/* Style the button when it appears in the custom grid for logged-out users */
#profile-selector.is-logged-out .profile-grid.custom-grid .custom-profiles-activate-button {
    background-color: var(--primary-color, #2196f3); /* Primary blue */
    color: white;
    display: inline-flex; /* Make it visible */
    margin: 20px auto; /* Center it somewhat */
    padding: 10px 20px;
}

/* --- Adjacent Create Button --- */
/* New adjacent buttons container */
#profile-selector .profile-manager-adjacent-buttons {
     position: static; /* participate in flow; won't overlap content */
     display: none; /* toggled by JS when Custom tab active */
     gap: 8px;
     z-index: 0;
     margin-top: 0; /* tuck right under the tab */
}

/* Size and density for the adjacent buttons */
#profile-selector .profile-manager-adjacent-buttons .mdc-button {
    height: 34px;
    padding: 0 10px;
    flex: 1 1 0; /* equal widths to fill the container */
}
#profile-selector .profile-manager-adjacent-buttons .mdc-button .mdc-button__label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap; /* prevent wrapping */
}
#profile-selector .profile-manager-adjacent-buttons .mdc-button .mdc-button__icon {
    font-size: 18px;
    margin-right: 4px;
}

/* Ensure ripple uses brand blue (override MDC purple defaults) */
#profile-selector .profile-manager-adjacent-buttons .mdc-button .mdc-button__ripple::before,
#profile-selector .profile-manager-adjacent-buttons .mdc-button .mdc-button__ripple::after {
    background-color: var(--primary-color) !important;
}

/* Ensure outlined button colors follow brand */
#profile-selector .profile-manager-adjacent-buttons .mdc-button.mdc-button--outlined,
#profile-selector .profile-manager-adjacent-buttons .mdc-button.mdc-button--outlined .mdc-button__label,
#profile-selector .profile-manager-adjacent-buttons .mdc-button.mdc-button--outlined .mdc-button__icon {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* On smaller screens, put buttons under the tabs and right-align */
@media (max-width: 900px) {
    #profile-selector .profile-manager-adjacent-buttons {
        width: 100%;
        justify-content: space-between;
        margin-top: 6px;
    }
}

/* --- Tab Panel Styling --- */
#profile-selector .profile-tab-content-panels {
     /* Container for the panels below the tabs */
}
#profile-selector .profile-tab-panel {
    display: none; 
}
#profile-selector .profile-tab-panel.active {
    display: block; 
}

/* --- Content Layout within Panels --- */
#profile-selector .profile-content-wrapper {
    display: flex;
    gap: 20px; 
    align-items: flex-start; 
    padding: 15px; 
    border: 1px solid #e0e0e0; 
    border-top: none;
}

/* --- Profile Grid (List) Styling --- */
#profile-selector .profile-grid {
    flex: 1; /* 1/3 width */
    display: flex; 
    flex-direction: column;
    gap: 10px; 
    max-height: 400px; 
    overflow-y: auto; 
    padding-right: 10px; 
}

/* --- Dimensions Box Styling --- */
#profile-selector .dimensions-box {
    flex: 2; /* 2/3 width */
    max-height: 400px; 
    overflow-y: auto; 
}
#profile-selector .dimensions-box h3 {
     margin-top: 0; 
     margin-bottom: 15px;
     font-size: 1.1em;
     color: var(--text-primary);
     text-transform: uppercase;
     font-weight: 600;
     letter-spacing: 0.5px;
}
#profile-selector .dimensions-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
    gap: 15px; 
}

/* --- Profile Card Styling (List Item Look) --- */
#profile-selector .profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    background-color: white;
    min-height: 65px;
    box-sizing: border-box;
}
#profile-selector .profile-card:hover {
    background-color: #f5f5f5;
}
#profile-selector .profile-card.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-light, #e3f2fd);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
#profile-selector .profile-card .profile-icon {
    font-size: 28px; 
    color: var(--primary-color);
    margin-bottom: 0; 
     flex-shrink: 0; 
}
#profile-selector .profile-card .profile-text-content {
     flex-grow: 1; 
}
#profile-selector .profile-card .profile-name {
    font-weight: 500; 
    margin-bottom: 2px; 
    font-size: 0.9em; 
    color: var(--text-primary);
     display: block; 
}
/* Hiding description as per previous step */
/* #profile-selector .profile-card .profile-description { ... } */

/* --- Dimension Item Styling --- */
#profile-selector .dimension-item {
    margin-bottom: 0;
    padding: 8px 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    background-color: #fdfdfd;
    position: relative;
}
#profile-selector .dimension-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    padding-right: 60px; /* reserve space for pill to avoid overlap */
}
#profile-selector .dimension-icon {
    color: var(--primary-color);
    font-size: 1.1em;
}
#profile-selector .dimension-title {
    font-weight: 600;
}
#profile-selector .dimension-weight-pill {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 10px;
    padding: 4px 6px;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
    cursor: pointer;
}
#profile-selector .dimension-description {
    font-size: 0.85em;
    line-height: 1.3;
}
#profile-selector .dimension-criteria {
     font-size: 0.85em;
     color: #666;
     margin-left: 28px; 
     margin-top: 5px;
     background-color: #f8f8f8;
     padding: 5px 8px;
     border-radius: 4px;
}
#profile-selector .dimension-criteria i {
     color: var(--primary-color);
}

/* --- Custom Panel Header (No longer used) --- */
/* #profile-selector .custom-panel-header { ... } */

/* --- Helper Classes --- */
#profile-selector .empty-message,
#profile-selector .loading-message {
     text-align: center;
     padding: 20px;
     color: var(--text-secondary);
     font-style: italic;
} 