/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #222;
    background-color: #f4f6f9;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1 {
    font-size: 22px;
    margin: 0;
    font-weight: 600;
}

h2 {
    font-size: 18px;
    margin: 0;
}

h3 {
    font-size: 16px;
    margin: 0;
}

p {
    margin: 8px 0 12px 0;
}

small {
    font-size: 12px;
    color: #555;
}

/* ============================================================
   APP HEADER & NAVIGATION
   ============================================================ */

.app-header {
    background: #ffffff;
    border-bottom: 1px solid #d0d0d0;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #ffffff;
}

.top-nav a {
    margin-right: 18px;
    text-decoration: none;
    color: #003366;
    font-weight: bold;
}

.top-nav a:last-child {
    margin-right: 0;
}

/* ============================================================
   PAGE HEADER (TITLE + ACTIONS)
   ============================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 18px 24px;
    background: #f6f7f9;
    border-top: 1px solid #e2e2e2;
    border-bottom: 1px solid #e2e2e2;
}

.page-header-left {
    display: flex;
    flex-direction: column;
}

.page-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
}

.page-header-right,
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
}

.header-actions select,
.header-actions input {
    padding: 6px 8px;
    font-size: 13px;
}

/* ============================================================
   PAGE CONTAINER
   ============================================================ */

.page-container {
    background: #ffffff;
    padding: 24px;
    margin: 24px;
    border: 1px solid #dcdcdc;
}

/* ============================================================
   TABS
   ============================================================ */

.tabs {
    display: flex;
    gap: 6px;
    margin: 8px 0 16px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #ccc;
}

.tabs a {
    padding: 6px 12px;
   background: #f0f0f0;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    text-decoration: none;
    font-weight: bold;
    color: #003366;
}

.tabs a.active {
  /*  background: #ffffff; */
    background: #C00000;
    border-bottom: 1px solid #ffffff;
/*    color: #000; */
color: white;
}

/* ============================================================
   SECTION STRUCTURE
   ============================================================ */

.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ccc;
}

/* ============================================================
   INLINE GRID (USED BY ACTIVITIES – KEEP AS-IS)
   ============================================================ */

.inline-form-headings,
.inline-form {
    display: grid;
    gap: 8px;
    align-items: center;
}

.inline-form input,
.inline-form select {
    width: 100%;
    padding: 6px 8px;
    font-size: 14px;
}

.inline-form button {
    white-space: nowrap;
}

/* ============================================================
   DETAIL GRID (USED BY activity_view.php – KEEP AS-IS)
   ============================================================ */

.detail-grid {
    max-width: 900px;
}

.detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    padding: 6px 0;
    align-items: start;
}

.detail-label {
    font-weight: bold;
    color: #222;
    padding-top: 6px;
}

.detail-value {
    font-size: 14px;
    line-height: 1.4;
    color: #222;
}

.detail-grid input,
.detail-grid select,
.detail-grid textarea {
    width: 100%;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.4;
    padding: 6px 8px;
}

.detail-grid textarea {
    min-height: 90px;
}

.detail-actions {
    margin-top: 8px;
}

/* ============================================================
   LEGACY PROJECT FORMS (CRITICAL FIX)
   Applies ONLY to old project tabs like Risks / Decisions
   ============================================================ */

.section form:not(.inline-form):not(.detail-grid) label {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 13px;
}

.section form:not(.inline-form):not(.detail-grid) input,
.section form:not(.inline-form):not(.detail-grid) select,
.section form:not(.inline-form):not(.detail-grid) textarea {
    display: block;
    width: 420px;
    max-width: 100%;
    padding: 6px 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* ============================================================
   TABLES & CRUD GRIDS
   ============================================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

th,
td {
    padding: 10px;
    border: 1px solid #d0d0d0;
    vertical-align: middle;
}

th {
    background: #f1f1f1;
    font-weight: 600;
    text-align: left;
}

tr:nth-child(even) {
    background: #fafafa;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */

.badge {
    display: inline-block;
    min-width: 56px;
    text-align: center;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 12px;
    color: #ffffff;
}

.badge.green { background-color: #2e7d32; }
.badge.amber { background-color: #ed6c02; }
.badge.red   { background-color: #c62828; }
.badge.grey  { background: #BFBFBF; color: #f5f5f5;
}


/* ============================================================
   STATUS COLOR SYSTEM (CENTRALIZED)
   ============================================================ */

/*
   Canonical status colors
   These are reused across ALL modules:
   Decisions, Risks, Deliverables, Activities,
   Milestones, Dependencies
*/

:root {
    --status-blue:   #0E2841; /* Open / In Progress / Identified / Mitigating */
    --status-red:    #C00000; /* Blocked */
    --status-grey:   #808080; /* Not Started / Planned / Cancelled */
    --status-green:  #3C7D22; /* Closed / Completed / Resolved */
    --status-amber:  #FFBF00; /* Pending */
}




/* ============================================================
   STATUS BADGE BASE (extends .badge)
   ============================================================ */

.badge.status {
    color: #ffffff;
}

/* ============================================================
   STATUS COLOR IMPLEMENTATIONS
   ============================================================ */

/* Open / In Progress / Identified / Mitigating */
.badge.status-open,
.badge.status-in-progress,
.badge.status-identified,
.badge.status-mitigating {
    background-color: var(--status-blue);
}

/* Blocked */
.badge.status-blocked {
    background-color: var(--status-red);
}

/* Not Started / Planned / Cancelled */
.badge.status-not-started,
.badge.status-planned,
.badge.status-cancelled {
    background-color: var(--status-grey);
}

/* Closed / Completed / Resolved */
.badge.status-closed,
.badge.status-completed,
.badge.status-resolved {
    background-color: var(--status-green);
}

/* Pending */
.badge.status-pending {
    background-color: var(--status-amber);
    color: #000000; /* Better contrast on yellow */
}






/* ============================================================
   NOTES
   ============================================================ */

.page-note {
    margin-top: 14px;
    font-size: 13px;
    color: #555;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-block;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn.secondary {
    background: #e5e7eb;
    border-color: #cbd5e1;
    color: #111827;
}

.btn.secondary:hover {
    background: #d1d5db;
}



/* ============================================================
   CRUD GRID – FINAL, STRUCTURAL ALIGNMENT
   ============================================================ */

.crud-grid td {
    padding: 10px 12px;
    vertical-align: middle;
}

/* Single-control forms stay native */
.crud-grid td form {
    margin: 0;
}

/* ONLY compound control groups (status) */
.crud-grid td form.control-group {
    display: inline-flex;
    align-items: center;
}

.crud-grid td form.control-group > * + * {
    margin-left: 10px;
}

/* Normalize controls */
.crud-grid select {
    height: 34px;
}

/* Badge normalization */
.crud-grid .badge {
    height: 30px;
    line-height: 30px;
    min-width: 110px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}


/* Center-align table headings from column 2 onward */
.crud-grid thead th:not(:first-child) {
    text-align: center;
}

.crud-grid tbody td:not(:first-child) {
    text-align: center;
}

/* Dependencies table: keep text columns left-aligned */
#dependencies .crud-grid td:nth-child(2),
#dependencies .crud-grid td:nth-child(3) {
    text-align: left;
}

/* Activity Tracker table: keep text columns left-aligned */
#activities .crud-grid td:nth-child(2),
#activities .crud-grid td:nth-child(3) {
    text-align: left;
}

/* Risks table: keep text columns left-aligned */
#risks .crud-grid td:nth-child(2) {
    text-align: left;
}



/* ============================================================
   ADD PAGE NUMBERS TO THE EXECUTIVE STSUS REPORT
   ============================================================ */
@page {
    margin: 20mm;
}

@page {
    @bottom-center {
        content: "Page " counter(page) " of " counter(pages);
        font-size: 10px;
        color: #555;
    }
}

