/**
 * Visual Occupation Selector Styles
 * Mobile-optimized, color-coded, visually distinctive interface
 */

/* Base dropdown container */
#occupation-cascading-dropdown {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    background-color: #222;
    box-shadow: none;
    z-index: 1050;
}

#occupation-cascading-dropdown.active {
    max-height: 500px; /* Set a fixed max-height for desktop */
    border-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    overflow: visible;
}

.visual-occupation-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 500px; /* Match the container max-height */
}

/* Header with search */
.occupation-header {
    padding: 0 0 10px;
    background-color: #2a2a2a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    /* Add handle bar for mobile UI */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Add a visual handle for mobile */
.occupation-header:before {
    content: '';
    width: 40px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 8px 0;
}

.combined-navigation-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #222; /* Slightly darker than main background for contrast */
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 15px 12px;
    background-color: #242424; /* Even darker for search container */
}

/* Navigation header for back button and title */
/* Removed navigation-header */

/* Close button at the top */
.occupation-close-btn {
    width: 100%;
    height: auto;
    padding: 12px;
    background-color: rgba(204, 0, 0, 0.8);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 500;
    border-radius: 0;
}

.occupation-close-btn i {
    margin-right: 8px;
}

.occupation-close-btn:hover,
.occupation-close-btn:active {
    background-color: rgba(204, 0, 0, 1);
}

.search-icon {
    position: absolute;
    left: 25px; /* Adjusted position for the search icon */
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    pointer-events: none; /* Ensure clicks pass through to the input */
    z-index: 2;
}

#occupation-search {
    flex: 1;
    height: 44px;
    padding: 0 40px 0 40px; /* Normal padding for search icon */
    background-color: #333;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
    padding-left: 45px; /* Increased padding to accommodate the search icon */
}

#occupation-search:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    background-color: #3a3a3a;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Main body area */
.occupation-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Add bottom padding for better visual spacing now that footer is gone */
    padding-bottom: 15px;
}

/* Header title display alongside back button */
/* Removed header-title-display */

/* Back button in the navigation header */
.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    min-width: 36px;
    height: 36px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: absolute; /* Position absolutely in the header */
    left: 10px; /* Position at left side of header */
    top: 15px; /* Fixed distance from top */
    z-index: 5; /* Ensure it's above other elements */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.back-button i {
    font-size: 16px;
}

.back-button:hover,
.back-button:active {
    background-color: rgba(204, 0, 0, 0.8);
    border-color: rgba(204, 0, 0, 0.8);
    color: #fff;
}

.back-button.hidden {
    visibility: hidden;
    opacity: 0;
}

#search-back-button {
    top: unset;
}


/* Division grid view */
.division-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    background-color: #2a2a2a;
    -webkit-overflow-scrolling: touch;
}

/* Division separator for special options */
.division-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 15px 0 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.division-separator span {
    padding: 0 10px;
}

.division-separator:before,
.division-separator:after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Direct option cards (Unemployed, Retired, Pensioner) */
.division-card.direct-option {
    background-color: #2d2d2d;
    border-left-width: 3px;
    border-left-style: solid;
}

.division-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: #333;
    border-radius: 6px;
    padding: 8px 10px; /* Reduced vertical padding */
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-bottom: 5px; /* Ensure some space between cards */
}

.division-card:hover,
.division-card:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    background-color: #383838;
}

.division-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.division-text {
    flex: 1;
    overflow: hidden;
}

.division-name {
    font-weight: 500;
    color: #fff;
    margin-bottom: 2px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.division-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1;
}

/* List views */
.major-group-list,
.industry-group-list,
.industry-list {
    flex: 1;
    overflow-y: auto;
    background-color: #2a2a2a;
    -webkit-overflow-scrolling: touch;
    display: none;
}

.list-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px 8px 12px;
    text-align: center;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.major-group-header {
    background-color: rgba(0, 0, 0, 0.15);
}

.major-group-item {
    background-color: rgba(0, 102, 204, 0.1);
    transition: background-color 0.2s ease;
}

.major-group-item:hover {
    background-color: rgba(0, 102, 204, 0.2);
}

.industry-group-header {
    background-color: rgba(0, 0, 0, 0.25);
}

.industry-group-item {
    background-color: rgba(0, 153, 102, 0.1);
    transition: background-color 0.2s ease;
}

.industry-group-item:hover {
    background-color: rgba(0, 153, 102, 0.2);
}

.header-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.2);
}

.header-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
    flex: 1;
    text-align: center;
    padding: 0 40px; /* Space for the back button */
}

.header-count {
    font-size: 12px;
    background-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.95);
    padding: 4px 10px;
    border-radius: 15px;
    margin-top: 5px;
    display: inline-block;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px; /* Reduced vertical padding */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.list-item:hover,
.list-item:active {
    background-color: #383838;
}

.item-content {
    flex: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.item-icon {
    width: 28px;
    height: 28px;
    background-color: rgba(139, 0, 0, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #c00;
    font-size: 14px;
    flex-shrink: 0;
}

/* Different styles for different list types */
.major-group-item .item-icon {
    background-color: rgba(0, 102, 204, 0.2);
    color: #0066cc;
}

.industry-group-item .item-icon {
    background-color: rgba(0, 153, 102, 0.2);
    color: #009966;
}

.industry-item .item-icon {
    background-color: rgba(150, 50, 50, 0.2);
    color: rgba(220, 70, 70, 0.9);
}

.item-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-size: 14px;
}

.item-count {
    font-size: 12px;
    background-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    line-height: 1;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    display: inline-block;
    text-align: center;
}

.item-arrow {
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

.list-item:hover .item-arrow {
    transform: translateX(3px);
    color: #c00;
}

.item-select {
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    margin-left: 10px;
    transition: color 0.2s ease;
}

.list-item:hover .item-select,
.list-item:active .item-select {
    color: #c00;
}

/* Search results */
.search-results {
    flex: 1;
    overflow-y: auto;
    background-color: #2a2a2a;
    -webkit-overflow-scrolling: touch;
    display: none;
}

.search-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #333;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    position: relative;
    min-height: 30px;
}

.search-count {
    color: #fff;
    font-size: 14px;
    text-align: center;
    opacity: 0.8;
    flex: 1;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover,
.search-result-item:active {
    background-color: #383838;
}

.result-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 8px;
}

.result-path {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.path-segment {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    transition: background-color 0.2s ease;
}

.search-result-item:hover .path-segment,
.search-result-item:active .path-segment {
    background-color: rgba(255, 255, 255, 0.15);
}

.result-select {
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    margin-left: 10px;
    transition: color 0.2s ease;
}

.search-result-item:hover .result-select,
.search-result-item:active .result-select {
    color: #c00;
}

/* No results state */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.no-results-icon {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 15px;
}

.no-results-message {
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
    font-size: 16px;
}

.no-results-help {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Footer removed as requested */

/* Highlight in search results */
.highlight {
    background-color: rgba(204, 0, 0, 0.3);
    color: #fff;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

/* Dropdown button styling */
.occupation-dropdown-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #333;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.occupation-dropdown-btn:hover,
.occupation-dropdown-btn:active {
    border-color: #c00;
}

.occupation-dropdown-btn i {
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.2s ease;
}

.occupation-dropdown-btn:hover i {
    color: #c00;
}

.occupation-dropdown-btn .selected-value {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.occupation-dropdown-btn .selected-value.placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#occupation-cascading-dropdown {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    box-shadow: none;
}

#occupation-cascading-dropdown.active {
    max-height: 500px;
    border-color: var(--border-color);
    box-shadow: var(--box-shadow);
    overflow: visible;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    /* Make the dropdown overlay but not fullscreen on small devices */
    #occupation-cascading-dropdown.active {
        position: fixed;
        top: 20%;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 80vh;
        max-height: none;
        z-index: 9999;
        margin: 0;
        border-radius: 12px 12px 0 0;
        border: none;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
    }
    
    .visual-occupation-container {
        height: 80vh;
        max-height: 80vh;
    }
    
    /* No need for grid adjustments since we're using column layout */
    
    /* More compact touch targets for optimized space */
    .list-item,
    .search-result-item {
        padding: 12px 15px; /* Reduced from 18px for better vertical space usage */
    }
    
    /* Larger path navigation */
    .path-item {
        padding: 8px 12px;
    }
    
    /* Optimize search for mobile */
    #occupation-search {
        height: 44px; /* Reduced from 50px */
        border-radius: 22px;
        font-size: 15px;
    }
    
    /* More vertical space optimization */
    .occupation-header:before {
        margin: 6px 0; /* Reduced handle bar margin */
    }
    
    .search-container {
        padding: 6px 15px 10px; /* Reduced padding */
    }
    
    /* Smaller icons for better space usage */
    .item-icon {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    
    /* Adjust list-header for mobile */
    .list-header {
        padding: 12px 8px;
    }
    
    /* Back button for mobile */
    .back-button {
        min-width: 32px;
        height: 32px;
        left: 8px;
    }
}