/* 
   Project Management System - Professional Compact Theme
   Version: 2.0 (High Density & Accessibility Focused)
   Date: 2026-02-02
*/

:root {
    /* --- Palette: Slate & Blue Professional --- */
    --primary: #0755C6;
    /* Strong professional blue */
    --primary-hover: #0647a7;
    --primary-subtle: #dceafe;

    --secondary: #475569;
    /* Slate 600 */
    --secondary-hover: #334155;

    --success: #16a34a;
    /* Accessible Green */
    --success-subtle: #dcfce7;
    --warning: #ca8a04;
    /* Darker yellow for text contrast */
    --warning-subtle: #fef9c3;
    --danger: #dc2626;
    --danger-subtle: #fee2e2;
    --info: #0891b2;
    --info-subtle: #cffafe;

    /* --- Surfaces --- */
    --bg-body: #f1f5f9;
    /* Slate 100 */
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    /* Slate 50 */

    /* --- Typography & Text --- */
    --font-sans: 'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
    --text-main: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    /* --- Borders & Effects --- */
    --border-color: #475569;
    /* Slate 300 */
    --border-subtle: #CCCCCC;
    /* Slate 200 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* --- Spacing System (Compact) --- */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
}

/* --- Global Reset & Typography --- */
body,
.app-shell {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 0.875rem;
    /* 14px base for compactness */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.app-shell {
    padding-top: 72px;
}

/* --- Accessibility: Global High Contrast Focus --- */
:focus-visible,
input:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #0f172a !important;
    /* Strong Slate (Black-ish) */
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px #ffffff !important;
    /* White outer ring/gap fill */
    z-index: 1000 !important;
    border-radius: 2px !important;
}

/* Dark mode adjustment */
[data-theme="dark"] :focus-visible {
    outline-color: #ffffff !important;
    box-shadow: 0 0 0 4px #0f172a !important;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: var(--space-sm);
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1.1rem;
}

h4 {
    font-size: 1rem;
}

a {
    color: var(--primary);
    text-decoration: underline;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* --- Layout Containers --- */
main,
.container,
.container-fluid {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
}

/* Screen reader only - hide visually but keep for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link - visible on focus for keyboard navigation */
.sr-only:focus {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
    width: auto !important;
    height: auto !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    background-color: var(--primary) !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    border-radius: 0 0 var(--radius-md) 0 !important;
    box-shadow: var(--shadow-md) !important;
    clip: auto !important;
    overflow: visible !important;
    white-space: nowrap !important;
}

.container-fluid {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
    max-width: 1920px;
    /* Prevent overly stretched content on ultrawide */
}

/* --- Navigation Bar (Compact) --- */
.navbar {
    background: #0755C6 !important;
    /* Client Blue - Updated for consistency */
    border-bottom: 2px solid var(--primary);
    height: 75px;
    padding-top: 2px;
    padding-bottom: 2px;
    box-shadow: var(--shadow-md);
}

/* FORCE ALL NAVBAR TEXT TO BE WHITE - SCOPED TO NAVBAR */
html body .navbar,
html body .navbar *:not(.dropdown-menu):not(.dropdown-menu *),
html body nav.navbar,
html body nav.navbar *:not(.dropdown-menu):not(.dropdown-menu *),
html body header .navbar,
html body header .navbar *:not(.dropdown-menu):not(.dropdown-menu *),
html body header nav,
html body header nav *:not(.dropdown-menu):not(.dropdown-menu *),
body .navbar,
body .navbar *:not(.dropdown-menu):not(.dropdown-menu *),
body nav.navbar,
body nav.navbar *:not(.dropdown-menu):not(.dropdown-menu *),
body header .navbar,
body header .navbar *:not(.dropdown-menu):not(.dropdown-menu *),
body header nav,
body header nav *:not(.dropdown-menu):not(.dropdown-menu *) {
    color: white !important;
}

/* Exception for dropdown menus */
html body .navbar .dropdown-menu,
html body .navbar .dropdown-menu *,
body .navbar .dropdown-menu,
body .navbar .dropdown-menu * {
    color: initial !important;
}

html body .navbar .dropdown-item,
body .navbar .dropdown-item {
    color: #212529 !important;
}

html body .navbar .text-muted,
body .navbar .text-muted {
    color: #6c757d !important;
}

html body .navbar .text-danger,
body .navbar .text-danger {
    color: #dc3545 !important;
}

.navbar.sticky-top {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1050 !important;
}

.navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1;
    margin-bottom: 0;
}

.brand-logo {
    height: 65px;
    min-height: 65px;
    width: auto;
    object-fit: contain;
    display: block;
}

.navbar .nav-link {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.2rem var(--space-sm) !important;
    border-radius: var(--radius-sm) !important;
    transition: background 0.15s;
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

/* Ensure navbar brand is white */
.navbar-brand {
    color: white !important;
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: white !important;
}

/* UNIVERSAL NAVBAR STYLING - APPLY EVERYWHERE */
html body .navbar,
html body nav.navbar,
html body header .navbar,
html body header nav,
body .navbar,
body nav.navbar,
body header .navbar,
body header nav {
    background-color: #0755C6 !important;
    background: #0755C6 !important;
}

html body .navbar-brand,
html body .navbar-brand:hover,
html body .navbar-brand:focus,
body .navbar-brand,
body .navbar-brand:hover,
body .navbar-brand:focus {
    color: white !important;
    text-decoration: none !important;
}

html body .navbar .nav-link,
html body .navbar .navbar-nav .nav-link,
body .navbar .nav-link,
body .navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

html body .navbar .nav-link:hover,
html body .navbar .navbar-nav .nav-link:hover,
body .navbar .nav-link:hover,
body .navbar .navbar-nav .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.dropdown-menu {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    padding: var(--space-xs) 0;
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown-item {
    padding: 0.3rem var(--space-lg);
    line-height: 1.4;
}

.dropdown-item:active {
    background-color: var(--primary);
}

/* --- Cards (High Density) --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
}

.card-header {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-sm) var(--space-lg);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: var(--space-lg);
    /* 1rem padding */
}

/* Ultra compact card variant */
.card-compact .card-body {
    padding: var(--space-sm);
}

/* --- Tables (Dense & Professional) --- */
.table {
    margin-bottom: 0;
    font-size: 0.85rem;
    border-color: var(--border-subtle);
}

.table th {
    background-color: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: var(--space-xs) var(--space-md);
    /* Reduced vertical padding */
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-subtle);
}

.table-hover tbody tr:hover {
    background-color: var(--primary-subtle);
}

.table-responsive {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: auto;
}

/* --- Buttons (Compact) --- */
.btn {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease-in-out;
}

.btn-sm,
.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: #fff;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-subtle);
    color: var(--text-main);
}

/* --- Forms (Clean & Focused) --- */
.form-control,
.form-select {
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.15);
    /* Accessible focus ring */
}

label {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* --- Badges & Status --- */
.badge {
    font-weight: 600;
    padding: 0.25em 0.6em;
    border-radius: 999px;
    font-size: 0.75em;
    letter-spacing: 0.02em;
}

.bg-success {
    background-color: var(--success) !important;
}

.bg-warning {
    background-color: var(--warning) !important;
    color: #fff;
}

.bg-danger {
    background-color: var(--danger) !important;
}

.bg-info {
    background-color: var(--info) !important;
}

/* Status Text Helpers */
.status-completed {
    color: var(--success);
    font-weight: 600;
}

.status-in-progress {
    color: var(--primary);
    font-weight: 600;
}

.status-on-hold {
    color: var(--warning);
    font-weight: 600;
}

.status-pending {
    color: var(--secondary);
}

/* --- Dashboard Widgets (Data Dense) --- */
.widget {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.widget h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.widget p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.widget i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.1;
    color: var(--text-main);
}

/* Widget Variations using border-left for subtle indication instead of full bg */
.widget-primary {
    border-left: 4px solid var(--primary);
}

.widget-success {
    border-left: 4px solid var(--success);
}

.widget-warning {
    border-left: 4px solid var(--warning);
}

.widget-danger {
    border-left: 4px solid var(--danger);
}

.widget-info {
    border-left: 4px solid var(--info);
}

/* --- Chat Interface --- */
#chatMessages {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-size: 0.85rem;
}

.message {
    background: #fff;
    border: 1px solid var(--border-subtle);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

/* --- Utilities --- */
.text-xs {
    font-size: 0.75rem;
}

.fw-medium {
    font-weight: 500;
}

.fw-semibold {
    font-weight: 600;
}

/* Focus Accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Issues Tab Enhancements (Professional) --- */
.issue-card-mini {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-size: 0.8rem;
}

.shadow-inner-sm {
    box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
}

.group-hover-target:hover {
    background-color: var(--bg-subtle) !important;
}

.group-hover-target:hover .opacity-100-hover {
    opacity: 1 !important;
}

.transition-colors {
    transition: color 0.15s ease, background-color 0.15s ease;
}

.text-primary-hover:hover {
    color: var(--primary-hover) !important;
    text-decoration: underline;
    cursor: pointer;
}

.cursor-pointer {
    cursor: pointer;
}

.tracking-wide {
    letter-spacing: 0.05em;
}

.theme-text-primary {
    color: var(--text-main);
}


/* Page URLs Card - Issues Tab Enhancement */
#pageUrlsCard .card-header:hover {
    background-color: #e9ecef !important;
}

#pageUrlsList.show~.card-header #urlsToggleIcon,
#pageUrlsList.collapsing~.card-header #urlsToggleIcon {
    transform: rotate(90deg);
}

/* Enhanced Issues Table */
.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Responsive table for issues */
@media (max-width: 1400px) {
    #finalIssuesBody .table-responsive {
        overflow-x: auto;
    }
}

/* Issues Tab - Pages Table */
#issuesPageList .issues-page-row {
    transition: background-color 0.2s ease;
}

#issuesPageList .issues-page-row:hover {
    background-color: #f8f9fa;
}

#issuesPageList .issues-page-row.table-active {
    background-color: #e7f3ff;
    border-left: 3px solid #0d6efd;
}

#issuesPageList .issues-page-row.table-active td:first-child {
    border-left: none;
}

/* --- Issue Content Consistency --- */
/* Force exact same styling between Summernote editor and table view */
/* Override all Summernote default styles to match our custom spacing */

/* Base paragraph styling - match Summernote exactly */
.issue-summernote p,
.card-body.issue-content p,
#finalIssueDetails p,
.note-editable p {
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    line-height: 1.42857143 !important;
    font-size: 14px !important;
}

/* Last paragraph should have no bottom margin */
.issue-summernote p:last-child,
.card-body.issue-content p:last-child,
#finalIssueDetails p:last-child,
.note-editable p:last-child {
    margin-bottom: 0 !important;
}

/* Lists styling */
.issue-summernote ul,
.issue-summernote ol,
.card-body.issue-content ul,
.card-body.issue-content ol,
#finalIssueDetails ul,
#finalIssueDetails ol,
.note-editable ul,
.note-editable ol {
    margin: 0 0 10px 0 !important;
    padding-left: 40px !important;
    line-height: 1.42857143 !important;
}

.issue-summernote li,
.card-body.issue-content li,
#finalIssueDetails li,
.note-editable li {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.42857143 !important;
}

/* Headings styling */
.issue-summernote h1,
.issue-summernote h2,
.issue-summernote h3,
.issue-summernote h4,
.issue-summernote h5,
.issue-summernote h6,
.card-body.issue-content h1,
.card-body.issue-content h2,
.card-body.issue-content h3,
.card-body.issue-content h4,
.card-body.issue-content h5,
.card-body.issue-content h6,
#finalIssueDetails h1,
#finalIssueDetails h2,
#finalIssueDetails h3,
#finalIssueDetails h4,
#finalIssueDetails h5,
#finalIssueDetails h6,
.note-editable h1,
.note-editable h2,
.note-editable h3,
.note-editable h4,
.note-editable h5,
.note-editable h6 {
    margin: 10px 0 10px 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
    font-weight: 500 !important;
}

/* First element should not have top margin */
.issue-summernote *:first-child,
.card-body.issue-content *:first-child,
#finalIssueDetails *:first-child,
.note-editable *:first-child {
    margin-top: 0 !important;
}

/* Strong/bold text */
.issue-summernote strong,
.issue-summernote b,
.card-body.issue-content strong,
.card-body.issue-content b,
#finalIssueDetails strong,
#finalIssueDetails b,
.note-editable strong,
.note-editable b {
    font-weight: 700 !important;
}

/* Line breaks */
.issue-summernote br,
.card-body.issue-content br,
#finalIssueDetails br,
.note-editable br {
    line-height: 1.42857143 !important;
}

/* Divs and other block elements */
.issue-summernote div,
.card-body.issue-content div,
#finalIssueDetails div,
.note-editable div {
    line-height: 1.42857143 !important;
}

/* Ensure card body has same font size and family */
.card-body.issue-content {
    font-size: 14px !important;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    line-height: 1.42857143 !important;
    color: #000 !important;
}

/* Match Summernote's default text color and font */
.note-editable {
    font-size: 14px !important;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    line-height: 1.42857143 !important;
    color: #000 !important;
}

/* Issue Image Styles */
.issue-image-thumb {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: inline-block;
    margin: 0.25rem;
}

.issue-image-thumb:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.issue-content img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
    display: inline-block;
}

.issue-content .issue-image-thumb {
    max-width: 200px;
    max-height: 150px;
    object-fit: cover;
}

.editable-issue-image {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

/* Issue Image Modal */
#issueImageModal .modal-body {
    text-align: center;
    overflow: hidden;
}

#issueImagePreview {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

#issueImagePreview {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}