/* kimap/modules/unified-window.css */

/* --- Backdrop & Shell --- */
#unified-backdrop {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
    opacity: 0; 
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

#unified-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

#unified-shell {
    width: 95%; /* Wider default for maps */
    max-width: 1600px;
    height: 85vh;
    background-color: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* --- The Header (Container) --- */
#unified-header {
    background-color: var(--pico-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Tabs left, Controls right */
    flex-shrink: 0;
    padding-right: 1rem; /* Space for close button */
}

/* --- The Tabs (Scrollable Area) --- */
#unified-tabs {
    display: flex;
    gap: 2px;
    height: 100%;
    align-items: flex-end;
    
    /* Horizontal Scrolling Magic */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox: Hide scrollbar */
    -ms-overflow-style: none; /* IE/Edge: Hide scrollbar */
    
    flex-grow: 1; /* Take up all available space */
    margin-right: 1rem; /* Gap before the close button */
    padding-left: 0.5rem;
    
    /* Smooth Scroll Behavior */
    scroll-behavior: smooth;
    mask-image: linear-gradient(to right, transparent 0%, black 20px, black 95%, transparent 100%);
}

/* Webkit (Chrome/Safari) Scrollbar Hiding */
#unified-tabs::-webkit-scrollbar {
    display: none;
}

/* --- Individual Tab Buttons --- */
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--pico-muted-color);
    padding: 0 1.2rem;
    height: 100%;
    
    /* Text Handling */
    white-space: nowrap; /* FORCE single line */
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    
    /* Flex alignment to center text vertically */
    display: flex;
    align-items: center;
    justify-content: center;
    
    flex-shrink: 0; /* Prevent squishing */
}

.tab-btn:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--pico-contrast);
}

.tab-btn.active {
    border-bottom-color: var(--pico-primary);
    color: var(--pico-primary);
    background-color: rgba(255,255,255,0.03);
}

/* --- Window Controls (Right Side) --- */
.header-controls {
    flex-shrink: 0; /* Never shrink */
    background: var(--pico-background-color); /* Cover scrolling tabs */
    z-index: 10;
    height: 100%;
    display: flex;
    align-items: center;
}

.close-button {
    font-size: 1.5rem;
    color: var(--pico-muted-color);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.5rem;
}
.close-button:hover {
    color: var(--pico-contrast);
}

/* --- Content Stage --- */
#unified-stage {
    flex-grow: 1;
    overflow: hidden; /* Internal panes handle their own scrolling */
    position: relative;
    background-color: #111; /* Fallback dark background */
}

/* --- Warehouse (Hidden Storage) --- */
#pane-warehouse {
    display: none !important;
}

/* Generic Pane Class (applied to all windows) */
.window-pane {
    width: 100%;
    height: 100%;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- TAB CAROUSEL STYLING --- */

/* 1. The Wrapper */
.tab-carousel-container {
    display: flex;
    align-items: center;
    flex-grow: 1; /* Take up all space to the left of the Close button */
    overflow: hidden; /* Contain the scrolling area */
    position: relative;
    margin-right: 15px; /* Spacing from the Window Controls */
}

/* 2. The Scroll Buttons */
.tab-scroll-btn {
    background: transparent;
    border: none;
    color: var(--pico-muted-color);
    cursor: pointer;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    z-index: 2;
    transition: color 0.2s, transform 0.1s, text-shadow 0.2s; /* Added transitions */
}

/* A. Remove the "Lingering Box" (Pico Override) */
.tab-scroll-btn:focus {
    outline: none;
    box-shadow: none;
    background: transparent; /* Ensure Pico doesn't add a background */
}

/* B. Hover State (Inner Highlight) */
.tab-scroll-btn:hover {
    color: var(--pico-primary); /* Your primary cyan/gold color */
    transform: scale(1.1); /* Slight swell effect */
}

/* C. Click State (Pulse of Light) */
.tab-scroll-btn:active {
    transform: scale(0.95); /* Tactile press down */
    color: #fff; /* Flash to white */
    /* Creates a glowing burst effect */
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 0 15px var(--pico-primary); 
}

/* D. Hidden State (Preserve Layout) */
.tab-scroll-btn.hidden {
    visibility: hidden; 
    pointer-events: none;
    opacity: 0; /* Optional: smooth fade out if you want to animate this class change */
}

/* The Tab Strip (The scrolling part) */
#unified-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto; /* Allow horizontal scroll */
    scroll-behavior: smooth; /* Smooth JS scrolling */
    
    /* HIDE SCROLLBARS */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    
    /* Make sure buttons don't shrink */
    flex-grow: 1;
    white-space: nowrap;
    padding: 0 5px;
}

/* Hide scrollbar for Chrome/Safari/Webkit */
#unified-tabs::-webkit-scrollbar {
    display: none;
}

/* Ensure tabs don't squash */
.tab-btn {
    flex-shrink: 0; 
}