/* --- Base "Aurora" Theme CSS Variables --- */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: rgba(148, 163, 184, 0.1);
    --gradient-start: rgba(59, 130, 246, 0.8);
    --gradient-end: rgba(147, 51, 234, 0.8);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-secondary);
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
}

*::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 6px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 15% 25%, rgba(34, 211, 238, 0.1), transparent 40%),
                radial-gradient(circle at 85% 75%, rgba(129, 140, 248, 0.1), transparent 40%);
    z-index: -1;
    animation: aurora-glow 20s infinite alternate;
}

@keyframes aurora-glow {
    from { transform: rotate(0deg) scale(1.2); }
    to { transform: rotate(360deg) scale(1.5); }
}

/* --- Enhanced KPI Card Styles --- */
.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.kpi-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.kpi-card:hover::before {
    opacity: 0.05;
}

.kpi-card-icon {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    padding: 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.kpi-card:hover .kpi-card-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.kpi-value {
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Material Design Card Styles */
.material-card {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.material-card:hover {
    transform: translateY(-4px);
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.material-chip {
    transition: all 0.2s ease;
}

.material-card:hover .material-chip {
    transform: scale(1.05);
}

/* Progress Bar Enhancements */
.progress-bar {
    background: var(--bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    height: 100%;
    border-radius: 9999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 2s linear infinite;
    opacity: 0.5;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* --- General Styles --- */
#filters-section {
    position: sticky; top: 0; z-index: 40;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}
.modal-content { 
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 116, 139, 0.3);
    transition: transform 0.3s ease;
}
.sortable-header { cursor: pointer; user-select: none; }
.sortable-header:hover { background-color: #334155; }
.sort-asc::after { content: ' ▲'; font-size: 0.7em; }
.sort-desc::after { content: ' ▼'; font-size: 0.7em; }
.chart-toggle-btn.active { background-color: #14b8a6; color: white; }
.chart-time-btn:hover { background-color: #1e293b; }
.chart-time-btn.active { background-color: #06b6d4; color: white; border-color: #06b6d4; }
.fade-in-up { animation: fadeInUp 0.5s ease-in-out forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
#checklist-table-body tr { transition: background-color 0.2s ease-in-out; }
#checklist-table-body tr:hover { background-color: #334155; }
.status-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-weight: 500; font-size: 0.75rem; }
.multi-select-dropdown { max-height: 200px; overflow-y: auto; }
#project-list { max-height: 300px; overflow-y: auto; }
#ai-modal-body h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1rem; margin-bottom: 0.5rem; }
#ai-modal-body p { margin-bottom: 0.75rem; }
#ai-modal-body ul { list-style-type: disc; margin-left: 1.5rem; margin-bottom: 1rem; }
#ai-modal-body li { margin-bottom: 0.25rem; }
#ai-modal-body pre { background-color: #1e293b; padding: 1rem; border-radius: 0.5rem; white-space: pre-wrap; word-wrap: break-word; }

/* In style.css */
.chart-granularity-btn.active { background-color: #14b8a6; color: white; }
/* --- Reusable Button Styles --- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1rem; border-radius: 0.5rem; font-weight: 600; transition: all 0.2s; border: 1px solid transparent; }
.btn:hover { transform: translateY(-2px); }
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.5); }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white; box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3); }
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4); }
.btn-secondary { background-color: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background-color: #4b5563; }
.btn-danger { background-color: #ef4444; color: var(--text-primary); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: grayscale(50%); }
.status-change-granularity-btn.active { background-color: #14b8a6; color: white; }


/* --- Chart Fullscreen Mode --- */
body.chart-fullscreen-mode #dashboard-content > * { display: none; }
body.chart-fullscreen-mode #main-header,
body.chart-fullscreen-mode #filters-section,
body.chart-fullscreen-mode #dashboard-content > #chart-section-container { display: block !important; }
body.chart-fullscreen-mode #chart-section-container { position: fixed; top: 0; left: 0; right: 0; bottom: 0; height: 100vh; width: 100vw; z-index: 50; padding-top: 220px; background: var(--bg-primary); }

/* --- Issue Matrix Styles --- */
.issue-matrix {
    display: grid;
    gap: 4px;
    min-width: 600px;
}
.matrix-header, .matrix-cell, .matrix-label {
    padding: 6px 8px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.75rem; /* 12px */
}
.matrix-header {
    background-color: #334155; /* slate-700 */
    font-weight: 600;
    position: sticky;
    top: 0;
}
.matrix-label {
    background-color: #334155; /* slate-700 */
    font-weight: 600;
    text-align: left;
}
.matrix-cell {
    background-color: #1e293b; /* slate-800 */
    font-weight: 500;
    transition: background-color 0.2s;
    position: relative;
}
.matrix-cell:hover {
    background-color: #475569; /* slate-600 */
}
.matrix-cell.non-zero {
    color: white;
    font-weight: 700;
    cursor: pointer;
}
.matrix-cell.selected {
    box-shadow: inset 0 0 0 3px #38bdf8; /* A bright blue inner border */
    transform: scale(0.95);
    transition: transform 0.1s ease-in-out;
}
.new-this-week-indicator {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(0, 0, 0, 0.2);
    padding: 0px 4px;
    border-radius: 4px;
}

/* --- Status Timeline Styles --- */
.timeline {
    display: flex;
    align-items: flex-start;
    padding: 1rem 0;
}
.timeline-milestone {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 80px;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}
.timeline-milestone:hover {
    transform: scale(1.1);
}
.timeline-milestone:hover .timeline-dot {
    box-shadow: 0 0 12px 3px currentColor;
}
.timeline-dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid currentColor;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: box-shadow 0.2s ease-in-out;
}
.timeline-label {
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    max-width: 80px;
    line-height: 1.2;
}
.timeline-connector {
    flex-grow: 1;
    height: 3px;
    background-color: var(--bg-tertiary);
    position: relative;
    margin: 0;
    top: 20px;
}
.timeline-duration {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
}
.timeline-connector.bottleneck .timeline-duration {
    background-color: #ef4444; /* Red-500 */
    color: white;
    box-shadow: 0 0 10px #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); }
}
/* --- New Login Page Styles --- */
.login-gradient-bg {
    background: linear-gradient(160deg, #3b82f6 0%, #1e3a8a 100%);
}

.login-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem; /* Add padding for the icon */
    border-radius: 0.5rem;
    background-color: #1e293b; /* slate-800 */
    border: 1px solid #475569; /* slate-600 */
    color: white;
    transition: all 0.2s ease-in-out;
}

.login-input::placeholder {
    color: #64748b; /* slate-500 */
}

.login-input:focus {
    outline: none;
    border-color: #6366f1; /* indigo-500 */
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

/* --- Custom styles that complement Tailwind classes --- */

/* Accessible screen-reader-only helper (in case Tailwind's sr-only isn't available) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Inputs with left icon -- matches your previous .login-input usage */
.login-input {
  width: 100%;
  height: 44px;
  padding-left: 2.25rem;         /* space for the icon */
  padding-right: 0.75rem;
  border-radius: 0.5rem;
  background-color: #1f2937;     /* slate-800 */
  color: #e5e7eb;                /* gray-200 */
  border: 1px solid #334155;     /* slate-700 */
  outline: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}

.login-input::placeholder { color: #94a3b8; } /* slate-400 */

.login-input:focus {
  border-color: rgba(56, 189, 248, 0.7);    /* sky-400/70 */
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.7),
    0 0 0 4px #1f2937;                      /* ring offset on slate-800 */
}

/* Primary button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: transform .06s ease, filter .15s ease, box-shadow .2s ease, opacity .2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a); /* Darker blue gradient */
  color: white;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.4); /* Adjusted shadow color */
}

.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* Subtle entrance animation (respects prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .animate-fade-in-up {
    animation: fadeInUp .4s ease-out both;
  }
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
/* Brand wordmark */
.brand-heading{
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  /* Bigger, responsive size (≈ 36px–48px) */
  font-size: clamp(2.25rem, 1.2rem + 2vw, 3rem);
  display: inline-flex;
  gap: .15rem;
}
.brand-cx{
  background: linear-gradient(90deg,#38BDF8,#6366F1);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 16px rgba(56,189,248,.22));
}
.brand-stat{
  color: #EAF0FF;                /* soft indigo-tinted white */
}
.card {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

.progress-bar {
    background: rgba(51, 65, 85, 0.5);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.metric-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.ring-progress {
    transform: rotate(-90deg);
    transition: stroke-dasharray 1s ease;
}

.ring-container {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
    margin: 16px 0;
}

/* --- Stat Card Styles (KPI Cards) --- */
.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    height: auto;
    min-height: 120px;
    max-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.stat-card:hover::before {
    opacity: 0.05;
}

.icon-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(147, 51, 234, 0.2) 100%);
    padding: 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.stat-card:hover .icon-box {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Ensure proper text sizing in stat cards */
.stat-card .text-2xl {
    font-size: 1.5rem;
    line-height: 1.2;
}

.stat-card .text-xs {
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Fix main content responsive spacing */
#main-content {
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

@media (min-width: 1024px) {
    #main-content.lg:ml-96 {
        margin-left: 24rem;
    }
}

/* Responsive grid adjustments */
@media (max-width: 640px) {
    .grid.grid-cols-1.sm\\:grid-cols-2.lg\\:grid-cols-4.xl\\:grid-cols-5 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (min-width: 640px) and (max-width: 1024px) {
    .grid.grid-cols-1.sm\\:grid-cols-2.lg\\:grid-cols-4.xl\\:grid-cols-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .grid.grid-cols-1.sm\\:grid-cols-2.lg\\:grid-cols-4.xl\\:grid-cols-5 {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1280px) {
    .grid.grid-cols-1.sm\\:grid-cols-2.lg\\:grid-cols-4.xl\\:grid-cols-5 {
        grid-template-columns: repeat(5, 1fr);
        gap: 1rem;
    }
}

