/* src/components/AppHeader/AppHeader.css */

/* Base header layout */
.header-info-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon-box {
    /* Removed fixed width, height, min-width for flexibility - now using max/min on the img itself */
    /* Removed border-radius: 50%; for square/rectangular shape */
    /* Removed background-color: #e0f2fe; as it's no longer a solid background circle */
    
    /* Allow the box to size based on its content (the image) */
    width: auto; 
    height: auto;
    min-width: 60px; /* NEW: Ensure a minimum width for the box, even if no logo or small logo */
    min-height: 60px; /* NEW: Ensure a minimum height for the box, to contain default icon and small logos */

    overflow: hidden; /* Keep overflow hidden just in case, though object-fit should prevent it */
    
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Keep shadow for a subtle lift */
    transition: background-color 0.3s;
    padding: 5px; /* Keep padding for internal spacing around the logo */
    border-radius: 8px; /* Add a slight border-radius for a softer rectangular look */
}

.header-logo-img {
    /* NEW: Set max dimensions directly on the image to control its size */
    max-width: 200px; /* Allow the logo to be wider */
    max-height: 70px; /* Allow the logo to be taller */
    width: 100%; /* Ensures it scales down within its parent's width */
    height: 100%; /* Ensures it scales down within its parent's height */
    object-fit: contain; /* This is crucial: scales the image to fit without cropping, preserving aspect ratio */
    display: block; /* Ensures no extra space below the image */
}

.default-icon {
    font-size: 2em;
    line-height: 1; /* Center vertically */
}

.header-title-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden; /* Hide overflow for long titles */
}

.header-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2px !important; /* Adjust spacing */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.header-subtitle {
    font-size: 0.95rem;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 15px; /* Spacing between buttons */
}

/* NEW: Styles for uniform header buttons */
.header-buttons .btn {
    min-width: 140px; /* Example min-width, adjust as needed */
    display: flex; /* Ensure flex for centering content */
    justify-content: center; /* Center content horizontally */
    align-items: center; /* Center content vertically */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    padding: 12px 15px; /* Adjust padding to be more consistent with min-width */
}

/* Specific adjustment for the user profile button to make it square */
.header-buttons #userProfileBtn {
    min-width: 50px; /* Make it smaller/square, align with the icon box size */
    width: 50px;
    height: 50px;
    padding: 0; /* Remove padding to make it a true square */
}
.header-buttons #userProfileBtn svg {
    margin-right: 0; /* No margin right for icon-only button */
}


/* Dark Theme specific header styles */
body.dark-theme .header-icon-box {
    background-color: transparent; /* Make background transparent in dark mode */
}

body.dark-theme .default-icon {
    color: #4299e1; /* Lighter icon in dark mode */
}

body.dark-theme .header-title {
    color: #e2e8f0; /* Light text for dark theme */
}

body.dark-theme .header-subtitle {
    color: #a0aec0; /* Lighter grey for dark theme subtitle */
}

/* Dropdown Styles */
.dropdown-container {
    position: relative; /* Essential for positioning the dropdown menu */
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px); /* Position below the button with some space */
    right: 0; /* Align to the right of the button */
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    min-width: 220px; /* Ensure enough width for text */
    z-index: 50; /* Ensure it appears above other content */
    padding: 8px 0;
    list-style: none; /* If using ul/li */
    margin: 0;

    /* Initial state: hidden by default using display: none */
    display: none; 
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-out, visibility 0.2s ease-out, transform 0.2s ease-out;
}

.dropdown-menu.show {
    /* Show state: overridden by JS when 'show' class is added */
    display: block; /* Make sure it overrides Tailwind's hidden if present */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex; /* Use flex for icon and text alignment */
    align-items: center;
    width: 100%;
    padding: 12px 20px; /* Padding for click area */
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    color: #374151;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #e0f2fe; /* Light blue on hover */
    color: #2563eb;
}

/* Styles for the dropdown divider */
.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 8px 0; /* Vertical spacing for the divider */
}

/* --- CHANGED: Added background color to dropdown headers --- */
.dropdown-header {
    padding: 8px 20px 4px; /* Padding to align with items */
    font-size: 0.75rem;     /* Smaller font */
    font-weight: 700;         /* Bold */
    color: #6b7280;          /* Muted grey color */
    text-transform: uppercase;/* Uppercase to look like a title */
    letter-spacing: 0.05em;   /* A bit of letter spacing */
    pointer-events: none;     /* Make it non-interactive */
    background-color: #f9fafb; /* Subtle background shade */
}
/* --- END CHANGED BLOCK --- */


/* Dark Theme Dropdown Styles */
body.dark-theme .dropdown-menu {
    background-color: #2d3748;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

body.dark-theme .dropdown-item {
    color: #e2e8f0;
}

body.dark-theme .dropdown-item:hover {
    background-color: #4a5568; /* Darker blue on hover */
    color: #63b3ed;
}

body.dark-theme .dropdown-divider {
    background-color: #4a5568; /* Darker divider in dark theme */
}

/* --- CHANGED: Added dark theme style for dropdown headers --- */
body.dark-theme .dropdown-header {
    color: #a0aec0; /* Lighter grey for dark mode */
    background-color: #4a5568; /* Darker background for dark mode */
}
/* --- END CHANGED BLOCK --- */

/* Theme Toggle Slider Styles (Based on your provided image) */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px; /* Width of the switch */
    height: 34px; /* Height of the switch */
    margin-left: 10px; /* Spacing from label */
    flex-shrink: 0; /* Prevent it from shrinking in flex container */
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2d3748; /* Dark background for dark mode (initial) */
    transition: .4s;
    border-radius: 34px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px; /* Height of the circle */
    width: 26px; /* Width of the circle */
    left: 4px; /* Initial position for dark mode */
    bottom: 4px;
    background-color: white; /* Color of the circle */
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Checked (Light Mode) State */
input:checked + .slider {
    background-color: #e0e0e0; /* Light background for light mode */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
}

input:checked + .slider:before {
    transform: translateX(26px); /* Move circle to the right */
    background-color: #333; /* Darker circle in light mode */
}

/* Slider Icons (Moon/Sun) */
.slider-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em; /* Adjust size as needed */
    transition: opacity 0.4s ease-in-out;
    pointer-events: none; /* Ensure clicks go through to the input */
}

.moon-icon {
    left: 8px; /* Position of moon icon */
    opacity: 1; /* Visible in dark mode */
    color: white;
}

.sun-icon {
    right: 8px; /* Position of sun icon */
    opacity: 0; /* Hidden in dark mode */
    color: #333;
}

/* When checked (light mode) */
input:checked ~ .moon-icon {
    opacity: 0; /* Hide moon icon */
}

input:checked ~ .sun-icon {
    opacity: 1; /* Show sun icon */
}

/* Dark Theme specifics for the slider */
body.dark-theme .theme-switch .slider {
    background-color: #2d3748; /* Ensures slider background is dark in dark theme */
}
body.dark-theme .theme-switch input:checked + .slider {
    background-color: #e0e0e0; /* Still light in checked state, regardless of body theme */
}
body.dark-theme .theme-switch .moon-icon {
    color: white; /* Moon icon always white */
}
body.dark-theme .theme-switch .sun-icon {
    color: #333; /* Sun icon always dark */
}

/* Ensure dropdown item containing the slider handles flex correctly */
.dropdown-item.flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

