@charset "UTF-8";

/* ============================================================
   VARIABLES & BOOTSTRAP OVERRIDES
   ============================================================ */
:root {
    --brand-red:        #dc2626;
    --brand-red-dark:   #b21d1d;
    --brand-nav:        #21253f;
    --brand-card:       #e9ebf2;

    /* Bootstrap overrides */
    --bs-primary:            #dc2626;
    --bs-primary-rgb:        220, 38, 38;
    --bs-link-color:         #dc2626;
    --bs-link-hover-color:   #b21d1d;
    --bs-link-color-rgb:     220, 38, 38;
    --bs-card-bg:            #e9ebf2;
    --bs-card-border-width:  0;

    --bs-btn-font-size:      .9rem;
}

/* ============================================================
   BASE
   ============================================================ */
body {
    font-family: 'Gothic A1', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

a {
    color: var(--brand-red);
    text-decoration: none;
}
a:hover {
    color: var(--brand-red-dark);
    text-decoration: underline;
}

/* Bootstrap primary button */
.btn-primary {
    --bs-btn-bg:                var(--brand-red);
    --bs-btn-border-color:      var(--brand-red);
    --bs-btn-hover-bg:          var(--brand-red-dark);
    --bs-btn-hover-border-color: var(--brand-red-dark);
    --bs-btn-active-bg:         var(--brand-red-dark);
    --bs-btn-focus-shadow-rgb:  220, 38, 38;
}
.btn { font-weight: 600; font-size: .9rem; }

/* Pagination active */
.page-item.active .page-link {
    background-color: var(--brand-red);
    border-color: var(--brand-red);
}
.page-link { color: var(--brand-red); }
.page-link:hover { color: var(--brand-red-dark); }

/* Nav pills active */
.nav-pills .nav-link.active { background-color: var(--brand-red); }

/* Form focus ring */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.2);
}

h5, .h5 { font-size: 1.1rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }


/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}


/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 220px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    background-color: var(--brand-nav);
    transition: width 0.25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar.collapsed { width: 60px; }

.sidebar-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    flex-shrink: 0;
}

.sidebar-logo {
    height: 32px;
    width: auto;
    opacity: 1;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}
.sidebar.collapsed .sidebar-logo {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    padding: 0.3rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.sidebar-toggle-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.sidebar.collapsed .sidebar-toggle-btn { margin: 0 auto; }

.sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 0.5rem 0;
}
.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav li a.active {
    background: var(--brand-red);
    color: #fff;
}
.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.nav-label {
    transition: opacity 0.15s ease;
    overflow: hidden;
}
.sidebar.collapsed .nav-label {
    opacity: 0;
    max-width: 0;
}

.sidebar-nav hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 0.4rem 0.75rem;
}

/* Tooltips when collapsed */
.sidebar.collapsed .sidebar-nav li { position: relative; }
.sidebar.collapsed .sidebar-nav li a::after {
    content: attr(data-label);
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    padding: 0.2rem 0.65rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 1040;
}
.sidebar.collapsed .sidebar-nav li a:hover::after { opacity: 1; }

/* Mobile sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 220px !important; /* always full width on mobile */
    }
    .sidebar.show { transform: translateX(0); }
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    z-index: 1029;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.mobile-overlay.show { opacity: 1; visibility: visible; }
@media (min-width: 992px) { .mobile-overlay { display: none; } }


/* ============================================================
   MAIN CONTENT & TOP BAR
   ============================================================ */
.main-content {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
    background-color: var(--brand-nav);
}
.app-container.sidebar-collapsed .main-content { margin-left: 60px; }

@media (max-width: 991.98px) {
    .main-content { margin-left: 0; }
}

.main-header {
    height: 52px;
    background: var(--brand-nav);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 200;
}

/* Mobile hamburger (visible < 992px only) */
#sidebarToggleMobile {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}
@media (max-width: 991.98px) {
    #sidebarToggleMobile { display: block; }
}

/* Breadcrumbs in dark top bar */
.main-header .breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
    font-size: 0.8rem;
    flex-grow: 1;
}
.main-header .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255,255,255,0.35);
}
.main-header .breadcrumb-item a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
}
.main-header .breadcrumb-item a:hover { color: #fff; }
.main-header .breadcrumb-item.active {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
}

/* User dropdown in dark top bar */
.main-header .dropdown-toggle {
    color: rgba(255,255,255,0.8);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
}
.main-header .dropdown-toggle:hover { color: #fff; }

.main-header .dropdown-menu {
    background-color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.main-header .dropdown-item:hover,
.main-header .dropdown-item:focus {
    background-color: transparent;
    color: var(--brand-red);
}
.main-header .dropdown-divider { border-color: rgba(0,0,0,0.1); }


/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area {
    flex: 1;
    background-color: #d7dae7;
    border-top-left-radius: 12px;
}

/* Content area handles outer spacing; container-fluid provides inner layout */
.content-area .container-fluid {
    padding: 1.5rem 1.5rem 3rem;
}


/* ============================================================
   PAGE HEADER ROW  (title left, action buttons right)
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}


/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 50rem;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-new        { background: #dbeafe; color: #1e40af; }
.status-scheduled  { background: #fef3c7; color: #92400e; }
.status-production { background: #dcfce7; color: #166534; }
.status-proof      { background: #fde68a; color: #92400e; }
.status-hold       { background: #fee2e2; color: #991b1b; }
.status-printing   { background: #e0e7ff; color: #3730a3; }
.status-invoicing  { background: #f3e8ff; color: #6b21a8; }

.priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 50rem;
    font-size: 0.72rem;
    font-weight: 600;
}
.priority-low  { background: #9ef7d9; color: #085b40; }
.priority-med  { background: #fdeccf; color: #945f06; }
.priority-high { background: #fee2e2; color: #bd1010; }

.client-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 50rem;
    font-size: 0.72rem;
    font-weight: 600;
}
.client-ongoing { background: #c7ebfc; color: #086189; }
.client-project { background: #f8d6d6; color: #861616; }


/* ============================================================
   FLASH MESSAGES
   Slides down from top-center, auto-hides after 3s (app.js)
   ============================================================ */
.flash {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    max-width: 600px;
    padding: 1rem 1.5rem;
    background-color: #198754;
    color: #fff;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-align: center;
    animation: flashSlideDown 0.3s ease-out;
}
.flash p { margin: 0; font-weight: 500; }
.flash.flash-error   { background-color: #dc3545; }
.flash.flash-warning { background-color: #ffc107; color: #333; }

@keyframes flashSlideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-100%); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* ============================================================
   MODALS
   ============================================================ */
.modal-content { --bs-modal-bg: #e9ebf2; }


/* ============================================================
   CARDS
   ============================================================ */
.card {
    background-color: var(--brand-card);
    border: none;
}
.card-header {
    background-color: transparent;
    font-weight: 700;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.card-footer {
    background-color: transparent;
    border-top: 1px solid rgba(0,0,0,0.08);
}

/* Tab card header (job detail) */
.job-tab-header {
    background-color: #d7dae7;
    border-bottom: none;
    padding-bottom: 0;
}
.job-tab-header .nav-tabs.card-header-tabs {
    margin-bottom: 0;
    border-bottom: none;
}
.job-tab-header .nav-tabs .nav-link {
    color: #475569;
    border-color: transparent;
    border-radius: 0.375rem 0.375rem 0 0;
}
.job-tab-header .nav-tabs .nav-link:hover:not(.active) {
    border-color: transparent;
    background-color: rgba(0,0,0,0.05);
}
.job-tab-header .nav-tabs .nav-link.active {
    background-color: #e9ebf2;
    border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) #e9ebf2;
    color: #0f172a;
    font-weight: 600;
}

/* Card row: side-by-side cards with flex ratios */
.card-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
.card-row .card { flex: 1; min-width: 0; }
.card-row .card.flex-2 { flex: 2; }
@media (max-width: 767.98px) {
    .card-row { flex-direction: column; }
}

/* Animated save button card (job detail) */
.save-button-card {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin-bottom 0.3s ease-out;
    overflow: hidden;
}
.save-button-card.save-button-hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}
.save-button-card:not(.save-button-hidden) {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 1rem;
}

/* Stat card */
.stat-card { text-align: center; }
.stat-card .stat-value { font-size: 2.5rem; font-weight: 800; color: var(--brand-red); }
.stat-card .stat-label { font-size: 0.75rem; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; }


/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-control,
.form-select {
    background-color: #fff;
    border: none;
    height: 38px;
    font-size: .875rem;
    padding: .3rem .75rem .3rem .75rem
}
textarea.form-control { height: auto; }

/* Compact select for use inside table rows */
.form-select-compact {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.75rem;
    height: auto;
}


/* ============================================================
   TABLES
   ============================================================ */
.table > :not(caption) > * > * { padding: 0.5rem 0.75rem; }

.table thead tr > * {
    background-color: transparent;
    border-bottom: 2px solid #d7dae7 !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: transparent;
    background-color: #e0e3ed;
}
.table-striped > tbody > tr:nth-of-type(even) > * {
    --bs-table-bg-type: transparent;
    background-color: #e9ebf2;
}

/* Table links: inherit text color, brand red on hover */
.table td a { color: inherit; text-decoration: none; }
.table td a:hover { color: var(--brand-red); text-decoration: underline; }

/* Job-specific table */
.job-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    font-weight: 700;
}
.job-table td { font-size: 0.75rem; }
.job-table .job-number { font-weight: 700; color: var(--brand-red); }

/* Time-specific table */
.time-table .time-hours { font-weight: 700; text-align: right; }
.time-table .time-total td { border-top: 2px solid #e2e8f0; font-weight: 800; }

/* Sortable column headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2rem;
}
.sortable-header:hover { background-color: #e0e3ed; }
.sortable-header::after { content: "↕"; position: absolute; right: 0.75rem; color: #94a3b8; }
.sortable-header.sort-asc::after  { content: "↑"; color: var(--brand-red); }
.sortable-header.sort-desc::after { content: "↓"; color: var(--brand-red); }


/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    background-color: #e9ebf2;
    border-radius: 0.5rem;
    gap: 0.125rem;
}


/* ============================================================
   TWO-COLUMN FLOW LAYOUT
   ============================================================ */
.col-flow-2 { column-count: 1; }
@media (min-width: 992px) {
    .col-flow-2 { column-count: 2; column-gap: 2.5rem; }
}
@media (min-width: 1200px) {
    .team-list { column-count: 2; gap: 0.5rem; }
}


/* ============================================================
   QUILL RICH TEXT EDITOR
   ============================================================ */
.ql-toolbar {
    border-top: 1px solid #cbd5e1 !important;
    border-left: 1px solid #cbd5e1 !important;
    border-right: 1px solid #cbd5e1 !important;
    border-bottom: none !important;
    background: #f8fafc;
    border-radius: 0.5rem 0.5rem 0 0;
}
.ql-container {
    border-bottom: 1px solid #cbd5e1 !important;
    border-left: 1px solid #cbd5e1 !important;
    border-right: 1px solid #cbd5e1 !important;
    border-top: none !important;
    border-radius: 0 0 0.5rem 0.5rem;
    font-family: 'Gothic A1', sans-serif;
    font-size: 0.875rem;
}
.ql-editor { padding: 1rem; min-height: 120px; }
.ql-editor.ql-blank::before { color: #64748b; font-style: normal; }

/* Comments */
.comment-item { background-color: #f8fafc; }
.comment-item .comment-author { color: var(--brand-red); }
.comment-item .comment-content { line-height: 1.6; }
.comment-item .comment-content p { margin-bottom: 0.5rem; }
.comment-item .comment-content p:last-child { margin-bottom: 0; }
.comment-item .comment-content ul,
.comment-item .comment-content ol { margin-bottom: 0.5rem; padding-left: 1.5rem; }
.comment-item .comment-content a { color: var(--brand-red); text-decoration: underline; }


/* ============================================================
   TIMESHEET CHART
   ============================================================ */
.timesheet-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}
.chart-bar {
    position: relative;
    background-color: #e2e8f0;
    border-radius: 4px 4px 0 0;
    min-height: 20px;
    flex: 1;
    max-width: 60px;
    transition: all 0.3s ease;
}
.chart-bar:hover { background-color: #c0cddf; }
.chart-bar-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(135deg, var(--brand-red) 0%, #e35252 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
}
.chart-bar-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    color: #475569;
    white-space: nowrap;
    font-weight: 600;
}
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: #475569; }
.legend-item .legend-color { width: 12px; height: 12px; border-radius: 2px; }
.legend-item.legend-billable .legend-color { background-color: var(--brand-red); }
.legend-item.legend-non-billable .legend-color { background-color: #94a3b8; }


/* ============================================================
   UTILITIES
   ============================================================ */
.js-hidden { display: none; }

.text-small { font-size: 0.75rem; }

/* Preserve the #successCheck pattern used in job list */
#successCheck {
    color: var(--brand-red);
    position: absolute;
    top: 0; right: 0;
    font-size: 150%;
    background-color: #fff;
    padding: 15px;
    border-bottom-left-radius: 5px;
}
