/* _new_layout.css (Merged and Final Version) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sidebar-width: 260px;
    --sidebar-bg: #1a2233;
    --sidebar-text: #adb5bd;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: #2a3447;
    
    --primary-accent: #007bff;
    --primary-accent-dark: #0069d9;
    --danger-red: #dc3545;
    
    --page-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --border-radius: 8px;
}

/* --- 1. Global Styles --- */
body {
    font-family: var(--font-sans);
    margin: 0;
    background-color: var(--page-bg);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
}

.layout-container {
    display: flex;
}

/* --- 2. Sidebar Layout --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
    /* --- THIS IS THE FIX: REMOVE THE Z-INDEX FROM HERE --- */
    /* z-index: 100; */ 
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text-hover);
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
    flex-shrink: 0;

}

.sidebar .main-nav { 
    flex-grow: 1; 
    overflow-y: auto;
    min-height: 0;   
}
.sidebar .nav-footer {
    flex-shrink: 0; /* Prevent the footer from shrinking */
    padding-top: 1rem; /* Add some space above the footer links */
    border-top: 1px solid #2a3447; /* A subtle separator line */
}

.sidebar nav a, .sidebar .nav-footer a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--sidebar-text);
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar nav a:hover, .sidebar .nav-footer a:hover {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}
.sidebar nav a.active {
    background-color: var(--primary-accent);
    color: var(--sidebar-text-hover);
}
.sidebar .nav-footer a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}

.sidebar svg { width: 20px; height: 20px; }

/* --- 3. Main Content Area --- */
.main-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem;
    box-sizing: border-box;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.top-bar h1 {
    font-size: 2rem;
    margin: 0;
}

.filter-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* --- 4. Cards & Widgets (Merged) --- */
.card, .widget-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.card h2, .widget-card h2 {
    margin-top: 0;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

/* --- 5. Forms & Buttons (Merged) --- */
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; }

button, .btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background-color: var(--primary-accent);
    color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: background-color 0.2s;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}
button:hover, .btn:hover { background-color: var(--primary-accent-dark); }
button:disabled { background-color: #e9ecef; color: #adb5bd; cursor: not-allowed; }

select, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 1rem;
    background-color: #fff;
}
input:read-only { background-color: var(--page-bg); }

.error { color: var(--danger-red); font-weight: 500; }

trix-editor {
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    min-height: 150px;
}

/* General Feedback 2: Set a better base width for all filters on desktop */
.top-bar .filter-group select, .top-bar .filter-group input {
    min-width: 120px; /* Base width for week/quarter/year */
}

/* General Feedback 1: Make the team filter specifically wider */
.top-bar .filter-group #teamFilter {
    min-width: 250px; /* 1.5x of a wider base */
}

/* --- 6. OKR Tree Toggle Styles --- */
.objective.has-children > .objective-title {
    cursor: pointer;
    user-select: none; /* Prevents text selection on click */
}

.toggle-icon {
    display: inline-block;
    width: 1em;
    text-align: center;
    transition: transform 0.2s ease-in-out;
    color: #6c757d;
    font-size: 0.8em;
    margin-right: 0.25rem;
}

.objective.collapsed .children-list {
    display: none;
}

.objective.collapsed > .objective-title .toggle-icon {
    transform: rotate(-90deg);
}

.status-lozenge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.9em;
}

.status-lozenge .status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}


.mobile-only {
    display: none;
}

.onboarding-highlight {
    position: relative;
    outline: 3px solid var(--primary-accent);
    box-shadow: 0 0 0 5px rgba(0, 123, 255, 0.2);
    border-radius: var(--border-radius);
    z-index: 1000;
}

.onboarding-tooltip {
    position: absolute;
    background-color: var(--primary-accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    z-index: 1001;
    font-size: 0.9em;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* --- Contribution Card Styles --- */
.star-btn { background: none; border: none; cursor: pointer; padding: 0.25rem; }
.star-btn svg { width: 20px; height: 20px; stroke: #6c757d; fill: none; transition: all 0.2s ease; }

/* User has manually starred this item */
.star-btn.starred svg { 
    fill: #ffc107; 
    stroke: #ffab00; 
}

/* NEW: AI has suggested this, but user has not confirmed */
.star-btn.ai-suggested svg {
    fill: #0775a8; /* A light blue fill */
    stroke: var(--primary-accent); /* A solid blue outline */
}

/* Make the star grow slightly on hover to invite interaction */
.star-btn:hover svg {
    transform: scale(1.2);
}

.welcome-content-wrapper {
    /* Center the whole block on the page */
    margin: 0 auto;
    padding: 3rem 2rem;
    max-width: 700px; /* Constrain the width for readability */
    text-align: center; /* Center the top-level headlines */
}

.welcome-title {
    font-weight: 600; /* Make the main title bolder */
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 2.5rem;
}

/* Left-align the list for scannability */
.welcome-benefits-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.welcome-benefits-list li {
    position: relative;
    padding-left: 2rem; /* Space for the checkmark icon */
    margin-bottom: 1.5rem;
}

/* Style the checkmark icon */
.welcome-benefits-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 2px; /* Adjust vertical alignment */
    color: var(--primary-accent);
    font-weight: bold;
    font-size: 1.2rem;
}

.welcome-benefits-list li strong {
    font-size: 1.05rem;
    font-weight: 600;
}

.welcome-benefits-list li p {
    margin: 0.25rem 0 0 0;
    color: #6c757d;
    line-height: 1.5;
}

.welcome-cta {
    margin-top: 2.5rem;
    font-weight: 500;
    font-size: 1.05rem;
}

/* --- Modal Overlay & Centering --- */
.modal {
    display: none; /* This is the default state: HIDDEN */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgba(0,0,0,0.6);
    padding: 1rem;
}

/* --- NEW RULE: Styles for when the modal is VISIBLE --- */
.modal.is-active {
    display: flex; /* Use Flexbox to center the content */
    align-items: center;
    justify-content: center;
}

/* --- Modal Content Box --- */
.modal-content {
    background-color: #fff;
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    width: 100%; /* Take up full width of container */
    max-width: 800px; /* But don't exceed 800px */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    /* Remove the old margin: 10% auto; */
}

/* --- Modal Header --- */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.modal-header #close-lineage-modal,
.modal-header .close-button { /* Generalize for other modals */
    font-size: 2rem;
    font-weight: bold;
    color: #888; /* Make it gray */
    cursor: pointer;
    line-height: 1;
    padding: 0 0.5rem;
    text-decoration: none;
}
.modal-header #close-lineage-modal:hover,
.modal-header .close-button:hover {
    color: #333; /* Darken on hover */
}

/* --- Lineage-Specific Content Styling --- */
#lineage-content pre {
    background: #f8f9fa;
    padding: 1rem;
    margin-top: 0.5rem;
    white-space: pre-wrap; /* Allow long lines to wrap */
    word-break: break-all; /* Break long words/URLs */
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace; /* Use a readable mono font */
    font-size: 0.85em; /* Increase font size slightly */
    max-height: 250px; /* Give the pre block its own scrollbar if needed */
    overflow-y: auto;
}
/* Media query for tablets and mobile phones */
@media (max-width: 992px) {
    /* Hide the sidebar by default on smaller screens */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 0 20px rgba(0,0,0,0.2);
        /* --- ADD THE Z-INDEX BACK, BUT ONLY FOR MOBILE --- */
        z-index: 100;
    }

    /* The 'show' class will slide the sidebar into view */
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Make main content full-width */
    .main-content-wrapper {
        width: 100%;
        margin-left: 0;
    }

    /* Style for the hamburger button */
    .hamburger-menu {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 101; /* Must be higher than the sidebar */
        background: var(--sidebar-bg);
        border: 1px solid #333;
        border-radius: 6px;
        padding: 0.5rem;
        cursor: pointer;
    }
    .hamburger-menu svg {
        width: 24px;
        height: 24px;
        stroke: var(--sidebar-text-hover);
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block; /* Or flex, depending on the element */
    }

    /* Style for the sidebar close button */
    .sidebar-close-btn {
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        font-size: 2rem;
        color: var(--sidebar-text);
        text-decoration: none;
        line-height: 1;
    }
    .sidebar-close-btn:hover {
        color: var(--sidebar-text-hover);
    }

     /* General Feedback 1 & 3: Fix page titles and hamburger overlap */
    .top-bar {
        flex-direction: column; /* Stack title and filters vertically */
        align-items: flex-start; /* Align to the left */
        gap: 1rem;
        padding-top: 3.5rem; /* Add space for the hamburger menu */
    }
    .top-bar h1 {
        font-size: 1.75rem; /* Make page titles smaller */
    }

    /* General Feedback 2: Make filters wider and readable */
    .filter-group {
        width: 100%;
        flex-direction: column; /* Stack filters vertically */
        align-items: stretch; /* Make them full width */
    }
    .filter-group label {
        margin-bottom: 0.25rem;
    }

    /* Widen filters on Desktop as well */
    .top-bar .filter-group select, .top-bar .filter-group input {
        min-width: 150px;
    }
    .main-content-wrapper {
        height: auto;
        overflow-y: visible;
    }

    .sticky-header {
        /* This rule now applies to any page with a sticky header */
        position: static;
        z-index: auto;
        box-shadow: none;
        border-bottom: none;
        margin: 0;
        padding: 0 0 2rem 0;
    }

    .scrollable-content {
        /* Revert this on mobile */
        overflow-y: visible;
        padding: 0;
    }
     .mobile-only {
        display: block; /* Or flex, depending on the element */
    }


}