/* Force icons to be visible even if Lucide is slow to swap them */
[data-lucide] {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    stroke: currentColor; /* Ensures they take the text color */
    fill: none;
}

/* Specific fix for the <i> tag before it becomes an <svg> */
i[data-lucide] {
    min-width: 18px;
    min-height: 18px;
}

/* IMMEDIATE STATE LOCK */
html.sidebar-is-collapsed .sidebar {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    padding: 2rem 0.5rem !important;
}

html.sidebar-is-collapsed .sidebar .logo,
html.sidebar-is-collapsed .sidebar .user-name,
html.sidebar-is-collapsed .sidebar .nav-links li a span {
    display: none !important;
}

/* STOP THE ICON JIGGLE */
/* This reserves an 18px square for icons so they don't 'pop' in */
.nav-links i, 
.nav-links svg, 
[data-lucide] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    display: inline-block !important;
    flex-shrink: 0;
}

/* Ensure icons are centered when collapsed */
html.sidebar-is-collapsed .nav-links li a {
    justify-content: center !important;
    gap: 0 !important;
}

/* If the top-level HTML has this class, force the sidebar to be small immediately */
.sidebar-is-collapsed .sidebar {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    padding: 2rem 0.5rem !important;
}

/* Hide the text elements instantly */
.sidebar-is-collapsed .sidebar .logo,
.sidebar-is-collapsed .sidebar .user-name,
.sidebar-is-collapsed .sidebar .nav-links li a span {
    display: none !important;
}

/* 1. Prevent Layout Shift: Reserve sidebar space immediately */
.dashboard-container {
    display: flex;
    height: 100vh;
    background-color: #f8fafc; /* Matches your --bg-light */
}


.sidebar {
    width: 260px;
    min-width: 260px; /* Added to prevent shrinking */
    max-width: 260px; /* Added to prevent expanding */
    background-color: var(--sidebar-dark);
    color: white;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box; /* Added to include padding in the 260px width */
    flex-shrink: 0; /* Added to ensure flexbox doesn't squash it */
    height: 100vh; /* Ensure it spans full viewport height */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.no-transition {
    transition: none !important;
}

/* Sidebar interaction */
.sidebar .logo {
    transition: opacity 0.2s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-left: auto;
    margin-top: -5px;

}


.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* --- Collapsed State --- */
.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    padding: 2rem 0.5rem;
}

/* When the sidebar has the .collapsed class, reset the margin to center the icon */
.sidebar.collapsed .toggle-btn {
    margin-left: 0;
    margin-right: 0;
    /* Ensure it stays perfectly in the middle of the 80px width */
    margin: 0 auto; 
}

.sidebar.collapsed .logo,
.sidebar.collapsed .user-name,
.sidebar.collapsed .nav-links li a span {
    display: none !important;
}

.sidebar.collapsed .nav-links li a {
    justify-content: center;
    padding: 0.8rem 0;
}

.sidebar.collapsed .user-profile-mini {
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

/* Footer Container */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    margin-top: auto; /* Safety push to the bottom */
}

/* User Profile Styling */
.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 1rem; /* Aligns with navigation text */
    margin-bottom: 0.5rem;
}

.user-profile-mini .avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

/* Logout Link Aesthetics */
.logout-nav {
    margin-top: 0;
    padding: 0;
    list-style: none;
}

.logout-link {
    color: #fca5a5 !important; /* Soft red text */
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1) !important; /* Subtle red hover */
    color: #ef4444 !important; /* Brighter red on hover */
}

/* 2. Prevent Icon Flicker: Reserve 18px square for every icon */
i[data-lucide] {
    width: 18px !important;
    height: 18px !important;
    display: inline-block;
    min-width: 18px;
    min-height: 18px;
    line-height: 1;
    vertical-align: middle;
}

:root {
    --primary: #2563eb;
    --bg-light: #f8fafc;
    --sidebar-dark: #1e293b;
    --text-main: #334155;
}

/* target all anchor (link) tags */
a {
    text-decoration: none; /* Removes the underline */
    color: inherit;        /* Makes the link take the color of the text around it */
    display: block;        /* Makes the entire area clickable, not just the text */
}

/* Optional: Ensure visited links don't turn purple */
a:visited {
    color: inherit;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
}




/* Ensure the main-content respects the sidebar's space */
.main-content {
    flex-grow: 1;
    min-width: 0; /* Important for grid/flex child scaling */
    padding: 2rem;
    overflow-y: auto;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.status-badge.review {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.nav-links {
    list-style: none; /* Removes bullet points */
    padding: 0;
    margin-top: 0.5rem;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links li a {
    display: flex; /* Aligns icon and text in a row */
    align-items: center;
    gap: 12px; /* Adds space between icon and text */
    padding: 0.8rem 0.75rem;
    color: #94a3b8;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
    
}

.nav-links i {
    width: 18px;
    height: 18px;
    stroke-width: 2px; /* Controls the thickness of the icon lines */
}

/* Hover effect: Subtle background change */
.nav-links li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white; /* Brighten text on hover */
}

/* Active state: Highlight the page the user is currently on */
.nav-links li.active a {
    background-color: var(--primary); /* That blue we defined earlier */
    color: white;
    font-weight: 600;
}

.upload-zone {
    text-align: center;
    padding: 3rem 2rem;
    border: 2px dashed #cbd5e1; /* Dashed border for drag-drop feel */
    background: #ffffff;
    transition: border-color 0.3s ease;
    margin-bottom: 2rem;
}

.upload-zone:hover {
    border-color: var(--primary);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.drop-area {
    margin-top: 1.5rem;
}

.btn-secondary {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-secondary:hover {
    background: #f1f5f9;
}

.delete-btn-hover:hover {
    background-color: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #b91c1c !important;
}

/* Progress Bar Styling */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-top: 2rem;
    overflow: hidden;
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.4s ease;
}

#upload-section {
    display: none; /* Hidden by default */
}

/* Hero Card Wrapper */
.hero-action-card {
    background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
    color: white;
    padding: 2.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.3);
}

.action-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.text-group h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.text-group p {
    margin: 0;
    opacity: 0.85;
    font-size: 1.1rem;
    line-height: 1.5;
    max-width: 600px;
}

/* The "Main Event" Button */
.btn-hero {
    background: white;
    color: #2563eb;
    border: none;
    padding: 1.2rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-hero:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Nested Upload Zone Styling */
.upload-zone {
    display: none; /* Controlled by JS */
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    text-align: center;
}

.upload-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
}

.active-bids-list {
    margin-top: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
}

.badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.bids-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.bid-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.bid-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}

.bid-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.status-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
}

.status-tag.drafting { background: #fef3c7; color: #92400e; }
.status-tag.review { background: #e0e7ff; color: #4338ca; }
.status-tag.approved { background: #dcfce7; color: #15803d; }

.deadline { color: #64748b; font-size: 0.85rem; }

.client-name { color: #64748b; margin-bottom: 1.5rem; font-size: 0.9rem; }

.progress-container-mini { margin-bottom: 1.5rem; }

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.progress-bar-mini {
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
}

.progress-bar-mini .fill {
    height: 100%;
    background: #2563eb;
    border-radius: 10px;
}

.btn-outline {
    width: 100%;
    background: transparent;
    border: 1px solid #cbd5e1;
    padding: 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #334155;
    transition: all 0.2s;
}

.btn-outline:hover { background: #f8fafc; border-color: #2563eb; color: #2563eb; }

.status-tag.scoping {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

/* Login Page Styles */
.auth-page {
    background: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 400px;
    border: 1px solid #e2e8f0;
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header p { color: #64748b; margin-top: 0.5rem; }

.input-group { margin-bottom: 1.5rem; }
.input-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.5rem; color: #334155; }
.input-group input { 
    width: 100%; padding: 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; 
    font-size: 1rem; transition: border-color 0.2s;
}
.input-group input:focus { outline: none; border-color: #2563eb; }

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: #64748b; }
.auth-footer a { color: #2563eb; text-decoration: none; font-weight: 600; }

.btn-sso {
    transition: background-color 0.2s, box-shadow 0.2s;
}

.btn-sso:hover {
    background-color: #f8fafc !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.auth-divider span {
    background: white;
}

.trust-links a:hover {
    color: var(--primary) !important;
}


/* Workspace Page Styles */
/* Workspace Layout Tweaks */
.workspace-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-top: 24px;
    height: calc(100vh - 160px); /* Adjust based on your header height */
}

.editor-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-toolbar {
    padding: 10px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    gap: 10px;
}

#ai-content-editor {
    flex: 1;
    padding: 20px;
    border: none;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
    outline: none;
    color: #374151;
}

.workspace-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.requirements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.requirements-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4b5563;
    cursor: pointer;
}

/* Premium Export Button Styling */
.btn-export-premium {
    background: #059669; /* Emerald 600 - signals success/completion */
    color: white;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.2), 0 2px 4px -1px rgba(5, 150, 105, 0.1);
    height: 42px; /* Matches your other header buttons */
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

.btn-export-premium:hover {
    background: #047857; /* Darker Emerald */
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.3);
}

.btn-export-premium:active {
    transform: translateY(0);
}

/* Add a subtle pulse animation to draw the eye once it appears */
#download-pdf-btn[style*="display: inline-flex"], 
#download-pdf-btn[style*="display: flex"] {
    animation: premiumPulse 2s infinite;
}

@keyframes premiumPulse {
    0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0); }
    100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* --- Workspace Sidebar & Sections --- */

/* The outer card that holds the list */
.sections-container {
    display: flex;
    flex-direction: column;
    max-height: 400px; /* Adjust this height to fit your screen preference */
    background: white;
}

/* The actual list that will scroll */
.sections-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto; /* This is the magic line for scrolling */
    padding-right: 8px; /* Space for the scrollbar */
    flex-grow: 1;
}

/* Custom Scrollbar to make it look 'SaaS-y' */
.sections-menu::-webkit-scrollbar {
    width: 6px;
}

.sections-menu::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.sections-menu::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.sections-menu::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.section-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.section-item:hover { 
    border-color: var(--primary); 
    background: #ffffff;
    transform: translateX(4px); /* Subtle 'active' feel on hover */
}

.section-item.active { 
    background: #eff6ff; 
    border-color: var(--primary); 
}

/* Magic AI Button Styling */
.btn-ai-magic {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-left: auto; /* Pushes button to the right of the toolbar */
    transition: transform 0.2s;
}

.btn-ai-magic:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* Animation for the AI Draft button */
.spin {
    animation: rotation 2s infinite linear;
    display: inline-block;
}

@keyframes rotation {
    from { transform: rotate(0deg); }
    to { transform: rotate(359deg); }
}

.badge.status-empty {
    background: #f1f5f9; /* Light grey */
    color: #64748b;      /* Slate grey text */
    border: 1px solid #e2e8f0;
}

/* Editor Footer for word counts */
.editor-footer {
    padding: 10px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: #64748b;
}

.editor-footer .stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-ready { background: #dcfce7; color: #166534; }
.status-attention { background: #fef9c3; color: #854d0e; }

.section-q {
    font-size: 0.85rem;
    margin-top: 5px;
    color: #475569;
}

/* Header Action Styling */
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-secondary-outline {
    background: white;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* Ensure icons in buttons are sized correctly */
.header-actions i {
    width: 16px;
    height: 16px;
}

/* Only targets buttons inside the Workspace header */
.header-actions .btn-primary, 
.header-actions .btn-hero,
.header-actions .btn-secondary-outline {
    display: inline-flex;    /* Fits the button size to content */
    align-items: center;     /* Centers text & icon vertically */
    justify-content: center; /* Centers text & icon horizontally */
    line-height: 1;          /* Removes extra 'lead' space under text */
    padding-top: 0;          /* Resets any uneven padding */
    padding-bottom: 0;
    height: 42px;            /* Gives a consistent, centered height */
}

/* Ensures the icon stays aligned with the text */
.header-actions button i {
    display: flex;
    align-items: center;
    margin-right: 8px; /* Consistent gap between icon and text */
}

/* --- Updated Modal Styles --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); /* Darkens the background */
    backdrop-filter: blur(4px);        /* Subtle blur for depth */
    align-items: center;               /* Centering logic */
    justify-content: center;
}

.modal-content {
    background: white; 
    padding: 2rem;
    border-radius: 12px; 
    width: 90%;
    max-width: 550px; /* Wider for RFP text */
    text-align: left; /* Changed from center to left for better readability */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: modalSlideUp 0.3s ease-out;
}

/* New sub-classes for the Archive View */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1rem;
}

.modal-header h2 { margin: 0; font-size: 1.25rem; }

.close-modal {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
}

.summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.2rem;
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
    color: #475569;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out forwards;
}

.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Knowledge Base Styles */
/* Ensure the upload zone is visible and styled correctly inside the hero card */
.hero-action-card .upload-zone {
    display: none; /* Controlled by JS */
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    color: white;
    animation: slideDown 0.3s ease-out;
}

/* Custom Danger Hover for Delete Buttons */
.btn-secondary-outline.btn-danger-hover:hover {
    background-color: #fff1f2 !important; /* Soft Red */
    border-color: #fecaca !important;     /* Light Red Border */
    color: #ef4444 !important;            /* Bright Red Icon/Text */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-action-card .upload-icon {
    color: white; /* Make the icon white to match the blue card theme */
}

.hero-action-card .upload-header h3 {
    margin-top: 0;
    color: white;
}

.hero-action-card .btn-secondary {
    background: white;
    color: var(--primary);
    border: none;
}



/* RFP Library Styles */
/* Search & Filter Bar */
.search-filter-bar {
    display: flex;
    gap: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.search-input-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 8px 15px;
    border-radius: 8px;
    gap: 10px;
}

.search-input-wrapper input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.95rem;
}

.search-filter-bar select {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
}

/* Library Table */
.library-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.library-table th {
    padding: 12px 15px;
    border-bottom: 2px solid #f1f5f9;
    color: #64748b;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.library-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #334155;
}

.library-table tr:hover {
    background-color: #f8fafc;
}

/* Status Pill for Won/Lost */
.status-pill {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pill.won {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-pill.lost {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-pill.pending {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* --- Bid Card Action Buttons --- */
.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
}

.card-actions .btn-outline {
    flex: 1; /* Makes "Open Workspace" take available space */
}

/* Square icon button for archiving */
.btn-archive-action {
    width: 42px;
    height: 42px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-archive-action:hover {
    background: #f1f5f9;
    color: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions-cell .btn-secondary-outline {
    padding: 6px 10px;
    height: 32px; /* Slightly smaller for table rows */
    font-size: 0.85rem;
}

.actions-cell i {
    width: 14px;
    height: 14px;
}

/* Ensure modal action buttons are centered */
#confirm-modal .modal-content div[style*="display: flex"] button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Updated Analytics Grid & Containers */
.analytics-grid {
    display: grid; 
    grid-template-columns: 1fr 1fr; /* Adjusted ratio for better balance */
    gap: 24px; 
    margin-top: 1rem;
    align-items: start; /* Prevents containers from stretching weirdly */
    width: 100%;
}

.analytics-grid .card {
    min-width: 0; 
}

.chart-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 1.25rem; /* Slightly tighter padding */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the wrapper and title */
    min-height: 280px;  /* Reduced from 350px */
    width: 100%;
    box-sizing: border-box;
}

.chart-container h3 {
    width: 100%; /* Keep title left-aligned */
    margin: 0 0 0.5rem 0;
    font-size: 1rem; /* Slightly smaller text */
    color: #1e293b;
}

/* This wrapper is the "secret sauce" for Chart.js */
.chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 240px; /* This is the "Size Controller" - adjust as needed */
    margin: 0 auto;
}
.chart-wrapper canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
}

/* --- HYBRID LOGIN & SSO STYLES --- */

/* The 'OR' Divider */
.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
    z-index: 1;
}

.auth-divider span {
    background: white;
    padding: 0 12px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

/* SSO Button Container */
.sso-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Individual SSO Buttons */
.btn-sso {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #334155;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sso:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-sso:active {
    transform: translateY(0);
}

.btn-sso img {
    width: 20px;
    height: 20px;
}

/* Accessibility: Focus state for keyboard users */
.btn-sso:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Settings Page Styles */
/* Settings Specific Styles */
.settings-grid {
    display: grid;
    gap: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

/* The Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider { background-color: #2563eb; }
input:checked + .slider:before { transform: translateX(22px); }

/* Table styling */
.settings-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.settings-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #f1f5f9;
    color: #64748b;
    font-size: 0.85rem;
}
.settings-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.role-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.role-badge.admin { background: #fee2e2; color: #991b1b; }
.role-badge.manager { background: #fef3c7; color: #92400e; }
.role-badge.standard { background: #f1f5f9; color: #475569; }

/* --- COLLAPSED AVATAR FIX (V2) --- */

/* 1. Hide name and role text when collapsed */
html.sidebar-is-collapsed .sidebar-footer .user-info,
.sidebar.collapsed .sidebar-footer .user-info {
    display: none !important;
}

/* 2. Force footer to stay in a column and center its items */
html.sidebar-is-collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-footer {
    display: flex !important;
    flex-direction: column !important; /* Forces logout to stay below avatar */
    align-items: center !important;    /* Centers everything horizontally */
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 1.5rem;                       /* Adds nice spacing between avatar and logout */
}

/* 3. Center the profile mini-container */
html.sidebar-is-collapsed .user-profile-mini,
.sidebar.collapsed .user-profile-mini {
    padding: 0 !important;
    margin: 0 auto !important;
    justify-content: center !important;
}

/* 4. Fix the Logout link alignment when collapsed */
html.sidebar-is-collapsed .logout-nav,
.sidebar.collapsed .logout-nav {
    width: 100%;
    display: flex;
    justify-content: center;
}

html.sidebar-is-collapsed .logout-link,
.sidebar.collapsed .logout-link {
    justify-content: center !important;
    padding: 0.8rem 0 !important;
    width: 100%;
}

/* Styling for Knowledge Base Status */
.status-tag.processing-tag {
    background: #fef9c3; /* Soft Yellow */
    color: #854d0e;
    border: 1px solid #fde047;
}

.status-tag.ready-tag {
    background: #dcfce7; /* Soft Green */
    color: #166534;
}

/* Optional: Pulse effect while AI is working */
.pulse {
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0px rgba(59, 130, 246, 0.2); }
    100% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}

/* Ensure the logo container doesn't squeeze the image */
.sidebar .logo {
    padding: 0; /* Remove inherited padding if necessary */
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
}

/* Make the image responsive to the sidebar width */
.logo-img {
    max-width: 100%;  /* Ensures it never overflows the sidebar */
    height: auto;     /* Maintains aspect ratio */
    display: block;
}

/* Specific adjustment for when the sidebar is collapsed */
.sidebar.collapsed .logo,
html.sidebar-is-collapsed .sidebar .logo {
    display: none !important; /* This matches your existing logic */
}

/* --- TEAM HUB SPECIFIC STYLING --- */

/* Stats Grid for Management Overview */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

/* Review Table Styling */
.table-container {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden; /* Keeps header corners rounded */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead {
    background-color: #f8fafc;
}

th {
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #f1f5f9;
}

/* Urgent / Status Indicators */
.urgent {
    color: #ef4444;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}



/* Action Button */
.btn-review {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-review:hover {
    background: #1d4ed8;
}

/* Loading State for Dynamic Table */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- TEAM HUB TABLE ALIGNMENT FIX --- */

.table-container table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Forces columns to respect set widths */
}

/* Base cell styling */
.table-container th, 
.table-container td {
    padding: 1rem 1.5rem;
    text-align: left;
    vertical-align: middle;
    line-height: 1.4;
}

/* Column Width Logic */
.table-container th:nth-child(1), .table-container td:nth-child(1) { width: 30%; } /* Tender Name */
.table-container th:nth-child(2), .table-container td:nth-child(2) { width: 25%; } /* Submitted By */
.table-container th:nth-child(3), .table-container td:nth-child(3) { width: 15%; } /* Date */
.table-container th:nth-child(4), .table-container td:nth-child(4) { width: 15%; } /* Deadline */
.table-container th:nth-child(5), .table-container td:nth-child(5) { width: 15%; text-align: right; } /* Action */

/* Header Text Styling */
.table-container th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

/* Fix for the "Submitted By" multi-line text */
.table-container td strong { display: block; color: #1e293b; }
.table-container td small {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Urgent dot alignment - CLEANED (No ::before) */
.urgent {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ef4444;
    font-weight: 700;
}

/* Review Button alignment */
.btn-review {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

/* --- REVIEWER WORKSPACE SPECIFICS --- */

.review-page #review-editor {
    width: 100%;
    flex-grow: 1;
    padding: 2rem;
    border: none;
    resize: none;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
    background: white;
}

.review-page #review-editor:focus {
    outline: none;
}

.sections-menu .question-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sections-menu .question-item:hover {
    background: #f1f5f9;
}

.sections-menu .question-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    font-weight: 600;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pending { background: #cbd5e1; }
.status-approved { background: #10b981; }
.status-flagged { background: #ef4444; }

.action-buttons-group {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

/* Add this inside your style.innerHTML backticks */
#mobile-restriction-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #ffffff;
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

@media (max-width: 1024px) {
    #mobile-restriction-overlay {
        display: flex;
    }
    /* Hide the rest of the app to prevent interaction */
    body > *:not(#mobile-restriction-overlay) {
        display: none !important;
    }
}

/* Mobile Restriction Styles */
#mobile-restriction-overlay {
    display: none; /* Hidden by default on PC */
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #ffffff;
    z-index: 100000;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    #mobile-restriction-overlay {
        display: flex; /* Only show on mobile */
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }
    body > *:not(#mobile-restriction-overlay) {
        display: none !important;
    }
}