/* === RESET & BASE LAYOUT === */
html, body {
	height: 100%;
	margin: 0;
	padding: 0;
	font-family: "Segoe UI", sans-serif;
}

/* === DASHBOARD CONTAINER === */
.dashboard-container {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	height: 90vh;
	padding: 30px;
	padding-top: 5px;
	padding-bottom: 5px;
	box-sizing: border-box;
	overflow: hidden;
	z-index: 1000;
	min-width:800px;
}

/* === SECTIONS === */
.dashboard-section {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	margin-bottom: 15px;
}

.detail-row{
	margin-top:15px;
}

.dashboard-section h2,
.dashboard-section h4 {
	margin: 10px 0;
}
.dashboard-section h2{
	font-size: 18px;
}

/* === SUMMARY ROWS === */
.summary-row {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
	flex-wrap: nowrap;
}

/* === METRIC & PM CARDS === */
/* === METRIC & PM CARDS === */
.metric-card,
.pm-card {
  flex: 1 1 30%;
  border-radius: 8px;
  padding: 4px 8px;                 /* reduced vertical padding */
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
  min-width: 120px;
  height: 30px;                 /* compact height */
  line-height: 1.2;                   /* tighter vertical text spacing */
  overflow: hidden;                 /* clip any overflowed text */
}

.metric-card{
	background-color: #f9f9f9;
	
}

/* === Headings and Inline Values === */
.metric-card h3,
.pm-card h3 {
  margin: 0;
  font-size: 0.9em;                 /* slightly smaller font */
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  font-weight: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value,
.pm-count {
  font-size: 1em;
  font-weight: bold;
  margin-left: 6px;
  color: #333;
}
.metric-card:hover {
	background-color: #e1e8ef;
}

/* PM color-coded variations */
.pm-card.yellow { background-color: #fff3cd; color: #856404; }	
.pm-card.red    { background-color: #f8d7da; color: #721c24; }
.pm-card.green  { background-color: #d4edda; color: #155724; }
.pm-card.orange {
	background-color: #fb8c00;   /* strong medium orange */
	color: #fff;
	border: 1px solid #ef6c00;   /* deeper edge definition */
	text-shadow: 0 1px 2px rgba(0,0,0,0.25); /* improve readability */
}

/* Inline values */
.metric-card h3,
.pm-card h3 {
	margin: 0;
	font-size: 1em;
	display: flex;
	justify-content: space-between;
	width: 100%;
	align-items: baseline;
	font-weight: normal;
}
.metric-value,
.pm-count {
	font-size: 1.2em;
	font-weight: bold;
	margin-left: 8px;
	color: #333;
}

#woAging7,#pmDue30, #pmOverdue, #pmCompleted, #woAgingOver30{
	color: #fff;
}

/* === CHARTS === */
.chart-row {
	flex: 1 1 auto;
	display: flex;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	align-items: stretch; /* ✅ charts grow to full height */
	margin-top: 15px;
	max-height: 300px;
}

.chart-card {
	flex: 1 1 45%;
	min-width: 260px;
	max-width: 48%;
	margin-bottom: 15px;
	background: #f9f9f9;
	border-radius: 8px;
	padding: 10px 15px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
}

/* Chart sizing — auto-expands vertically */
.chart-card canvas {
	width: 100% !important;
	height: auto !important;
	flex: 1 1 auto;
	aspect-ratio: 1 / 1;
	max-height: 250px;        /* normal cap for laptops */
	min-height: 180px;        /* ensures visibility */
}


/* === AGING BARS === */
.aging-bars {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}
.aging-segment {
	flex: 1;
	border-radius: 5px;
	padding: 8px;
	color: #fff;
	text-align: center;
	font-weight: bold;
	min-width: 120px;
}
.green  { background-color: #4caf50; }
.yellow { background-color: #ffca28; color: #000; }
.red    { background-color: #e53935; }

/* === COLOR-CODED STATUS CARDS (PM + Aging) === */
.pm-card.yellow,
.metric-card.yellow {
	background-color: #ffca28;   /* stronger yellow */
	color: #000;
}

.pm-card.red,
.metric-card.red {
	background-color: #e53935;   /* bold red */
	color: #fff;
}

.pm-card.green,
.metric-card.green {
	background-color: #43a047;   /* strong green */
	color: #fff;
}

.metric-card.red h3,
.metric-card.green h3,
.pm-card.red.pm-count,
.pm-card.green.pm-count{
	text-shadow: 0 1px 2px rgba(255,255,255,0.2);
}

.metric-card.yellow h3,
.pm-card.yellow h3
{
	text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}





/* === DASHBOARD ACTIONS (Footer Controls) === */
#dashboard .dashboard-actions {
	display: flex;                
	align-items: center;          
	justify-content: space-between;   /* 📍 Button left, Date right */
	gap: 12px;                    
	flex-wrap: nowrap;            
	padding: 10px 15px;
	background: #fff;
	border-top: 1px solid #ddd;
}

/* Prevent child elements from stretching */
#dashboard .dashboard-actions > * {
	flex: 0 0 auto;
}

/* === PDF Button Styling === */
#dashboard .fnButton {
	
	padding: 8px 15px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.9rem;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}


/* === Date Footer Styling === */
#dashboard .dashboard-date {
	white-space: nowrap;
	font-size: 0.85rem;
	color: #444;
}

/* === Responsive Behavior === */
@media (max-width: 500px) {
	#dashboard .dashboard-actions {
		flex-direction: column;       /* stack vertically */
		align-items: flex-start;      /* left-align contents */
		gap: 6px;
	}
	
	#dashboard .dashboard-date {
		align-self: flex-end;         /* date stays to the right side */
	}
}




/* === CARD FLIP ANIMATION (safe 3D rotation around horizontal center) === */
@keyframes flipInX {
  0% {
    transform: perspective(800px) rotateX(-90deg);
    opacity: 0;
  }
  50% {
    transform: perspective(800px) rotateX(15deg);
    opacity: 0.8;
  }
  100% {
    transform: perspective(800px) rotateX(0deg);
    opacity: 1;
  }
}

/* === METRIC CARDS === */
.metric-card {
  transform-style: preserve-3d;     
  animation: flipInX 1s ease-out both;
  transform-origin: center center;
  perspective: 800px;
}

.metric-card > * {
  transform: translateZ(0);
  backface-visibility: visible;
}

/* Sequential delays for metric cards */
.summary-row .metric-card:nth-child(1) { animation-delay: 0.1s; }
.summary-row .metric-card:nth-child(2) { animation-delay: 0.3s; }
.summary-row .metric-card:nth-child(3) { animation-delay: 0.5s; }

/* === PM CARDS === */
.pm-card {
  transform-style: preserve-3d;
  animation: flipInX 1s ease-out both;
  transform-origin: center center;
  perspective: 800px;
}

/* Keep inner content stable */
.pm-card > * {
  transform: translateZ(0);
  backface-visibility: visible;
}

/* Sequential delays for PM cards – start slightly after metrics */
.pm-summary .pm-card:nth-child(1) { animation-delay: 0.8s; }
.pm-summary .pm-card:nth-child(2) { animation-delay: 1.0s; }
.pm-summary .pm-card:nth-child(3) { animation-delay: 1.2s; }
.pm-summary .pm-card:nth-child(4) { animation-delay: 1.4s; }



.dashboard-container,
.summary-row,
.pm-summary {
  overflow-x: hidden;  /* ✅ prevent overflow from rotating children */
  perspective: 1000px; /* ensures depth works but stays inside bounds */
}


@media print {

  /* Hide everything by default */
  body * {
    visibility: hidden !important;
  }

  /* Show only the dashboard */
  #dashboard, #dashboard * {
    visibility: visible !important;
  }

  /* Hide the Export button */
  #dashboard .dashboard-actions .fnButton {
    display: none !important;
  }

  /* Dashboard print layout */
  #dashboard {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
    color: #000;
    box-shadow: none;
    overflow: visible;
  }

  /* Simplify visuals for paper */
  .chart-card canvas {
    max-height: 200px !important;
    page-break-inside: avoid;
  }

  .metric-card,
  .pm-card {
    box-shadow: none;
    border: 1px solid #ccc;
    color: #000 !important;
    max-height: 30px !important;
    transform: none !important;   /* ✅ flatten 3D transforms  */
    animation: none !important;   /* ✅ stop animations        */
    opacity: 1 !important;
    perspective: none !important;
    backface-visibility: visible !important;
  }

  .pm-card.red,
  .pm-card.green,
  .pm-card.yellow,
  .pm-card.orange {
    background-color: #fff !important;
  }

  .dashboard-section {
    margin-bottom: 20px;
  }

  .hide-for-print { display: none !important; }
}


/* pm Calendar */


#pmCalendarContent {
    /* display: flex; */
    /* flex-direction: column; */
    /* justify-content: flex-start;   /* ⬅ push content up */ */
    align-items: center;
    padding-top: 10px;             /* small top breathing room */
}


#pmCalendarContent {
	display:grid;
	grid-template-rows: 1fr 1fr 16fr;
	align-items: start;
	margin:auto;
	width: 100%;
	margin-top: 10px;
}


.pm-year-toggle {
    width: 75vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
	margin:auto;

    /* REMOVE unnecessary height inflation */
    height: auto;

    /* REDUCE internal spacing */
    padding: 4px 10px;

    /* REDUCE bottom spacing */
    margin-bottom: 10px;

    background: #f3f3f3;
    border-radius: 6px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}


.pm-grid {
    width: 75vw;
    height: 95%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
	margin:auto;
}

/* Each month panel */
.pm-panel {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
	font-weight: bold;
	background: linear-gradient(to bottom right, #fafafa, #f1f1f1);
}



/* .pm-year-toggle { */
    /* width: 75vw;                    /* match the calendar width */ */
    /* display: flex; */
    /* justify-content: space-between; /* left: buttons / right: year */ */
    /* align-items: center; */
    /* margin-bottom: 20px; */
	/* background-color: #fff; */
	/* height: 36px; */
/* } */

.pm-toggle-left{
	padding-right: 30px;
	
}

.pm-toggle-left label {
    margin-right: 20px;
    cursor: pointer;
	padding-right:20px;
}

.pm-year-label {
    font-size: 1.1em;
    font-weight: bold;
    color: #01529d;
	padding-left: 10%;
}


.pm-panel.current-month {
    background-color: #fff8c6;   /* light yellow */
    font-weight: bold;
}

.pm-panel.past-month {
    background-color: #c6c6c6;   /* light grey */
    font-weight: normal;
	color: #444;
}

.pm-panel {
    background: #f7f7f7;
	background: #fff;
    border: 2px solid #aaa;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    cursor: pointer;

    transition: 
        transform 0.2s ease,
        border 0.2s ease,
        box-shadow 0.2s ease;
}

/* Hover: stronger inset border + more contrast */
.pm-panel:hover {
    border: 2px solid #444;
	border-color:blue;
	background: #ffd;
    box-shadow:
        inset 3px 3px 5px rgba(0,0,0,0.25),
        inset -3px -3px 5px rgba(255,255,255,0.95);
		
		transform: scale(1.03); /* Slight grow */
}

/* Click: invert effect to look physically pressed deeper */
.pm-panel:active {
    box-shadow:
        inset 1px 1px 2px rgba(0,0,0,0.35),
        inset -1px -1px 2px rgba(255,255,255,0.8);
    border: 2px solid #555;
}

/* Background overlay */
.pm-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);    /* darken background slightly */
    backdrop-filter: blur(6px);      /* ✅ blur everything behind the overlay */
    -webkit-backdrop-filter: blur(6px); /* safari support */

    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}


/* Initially hidden */
.hidden { display: none !important; }

/* Popup box */
.pm-popup {
    width: 60vw;
    max-height: 70vh;
    min-height: 40vh;           /* ✅ ensures visible height even with no content */
    background: #fff;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
}


/* Header */
.pm-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #036;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px 10px 0 0;
    font-size: 1.2em;
}

/* Close button */
.pm-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
}

/* Scrollable content area */
.pm-popup-content {
    padding: 15px 20px;          /* existing padding */
    padding-bottom: 20px !important;  /* NEW: room below the table */
    overflow-y: auto;
    font-size: 1em;
    max-height: calc(70vh - 60px);
    box-sizing: border-box;
}

.pm-table-wrapper {
    padding-bottom: 20px;   /* real space below the table */
}


.pm-popup-content {
    padding: 15px 20px;
    padding-bottom: 20px;
    overflow-y: auto;
    max-height: calc(70vh - 60px);
    box-sizing: border-box;
}

.pm-row-overdue {
    color: darkred;
    font-weight: bold;
}

.pm-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* centers vertically */
    text-align: center;
}

.pm-summary {
    margin-top: 6px;
    font-size: 0.9em;
    line-height: 1.3em;
}

.pm-summary .overdue {
    color: darkred !important;
    background: transparent !important;
    font-weight: bold;
}

.pm-month-name {
    font-size: 1.2em;
    font-weight: normal;   /* default */
    margin-bottom: 6px;
}

.pm-panel.current-month .pm-month-name {
    font-weight: bold;
}


.pm-calendar-title{
	font-size: 24px;
	font-weight: bold;
	color: darkblue;
	text-align: center;
	
}

td[onclick]:hover {
    background: rgba(0,0,0,0.04);
    transition: 0.2s ease;
}



.pm-summary .pm-jobs {
    color: #005f99;       /* soft blue */
    font-weight: bold;
}