/* Projects List & Detail Styles */

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.projects-table-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; margin-bottom:1rem; }
.projects-table-heading h1 { margin:0 0 .25rem; }
.projects-table-heading p { color:var(--text-secondary); margin:0; }
.table-filter-bar { display:grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap:.65rem; margin-bottom:1rem; }
.projects-table-wrap { overflow:auto; border:1px solid var(--glass-border); border-radius:var(--radius-xl); background:var(--glass-bg); }
.projects-table { width:100%; min-width:1450px; border-collapse:collapse; }
.projects-table th,.projects-table td { padding:.8rem .65rem; border-bottom:1px solid var(--glass-border); text-align:left; white-space:nowrap; vertical-align:middle; }
.projects-table th { background:rgba(255,255,255,.04); font-size:.78rem; }
.projects-table td { font-size:.82rem; }
.project-table-title { display:flex; flex-direction:column; font-weight:600; color:var(--text-primary); }
.project-table-title small { color:var(--text-secondary); font-weight:400; }
.table-detail-btn { min-width:40px; padding:.35rem .65rem; }
.data-status { display:inline-flex; align-items:center; gap:.35rem; padding:.25rem .5rem; border-radius:999px; font-size:.72rem; white-space:nowrap; }
.data-status i { width:7px; height:7px; border-radius:50%; display:inline-block; }
.data-status-ok { color:#6ee7b7; background:rgba(16,185,129,.12); }
.data-status-ok i { background:#10b981; }
.data-status-missing { color:#fbbf24; background:rgba(245,158,11,.12); }
.data-status-missing i { background:#f59e0b; }
@media(max-width:900px){ .projects-table-heading{flex-direction:column}.table-filter-bar{grid-template-columns:1fr}.projects-table{min-width:1100px} }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Project Card */
.project-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
}

.project-card-title {
    font-size: 1.125rem;
    margin-bottom: var(--space-1);
    color: var(--text-primary);
}

.project-card-dept {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.project-card-body {
    flex: 1;
    margin-bottom: var(--space-4);
}

.project-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* List View (Table-like) */
.projects-list-view .project-card {
    flex-direction: row;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

.projects-list-view .project-card-header {
    margin: 0;
    width: 30%;
}

.projects-list-view .project-card-body {
    margin: 0;
    width: 40%;
    padding: 0 var(--space-4);
}

.projects-list-view .project-card-footer {
    border: none;
    padding: 0;
    width: 30%;
}

/* Project Detail View */
.detail-hero {
    position: relative;
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    background: linear-gradient(135deg, rgba(30,41,59,0.9), rgba(15,23,42,0.9)), url('data:image/svg+xml,%3Csvg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%23d4a853" fill-opacity="0.05" fill-rule="evenodd"%3E%3Ccircle cx="3" cy="3" r="3"/%3E%3Ccircle cx="13" cy="13" r="3"/%3E%3C/g%3E%3C/svg%3E');
    border: 1px solid var(--glass-border);
    margin-bottom: var(--space-8);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
}

.detail-title {
    font-size: 2.5rem;
    margin: 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.info-box {
    background: rgba(255,255,255,0.02);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: var(--space-1);
}

.info-val {
    font-weight: 600;
    font-size: 1rem;
}

/* Phases Timeline */
.timeline {
    position: relative;
    padding-left: var(--space-6);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--glass-border);
}

.phase-item {
    position: relative;
    margin-bottom: var(--space-6);
}

.phase-dot {
    position: absolute;
    left: calc(var(--space-6) * -1 - 5px);
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--text-muted);
}

.phase-item.completed .phase-dot {
    border-color: var(--status-success);
    background: var(--status-success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.phase-item.in-progress .phase-dot {
    border-color: var(--accent-gold);
    background: var(--accent-gold);
    box-shadow: 0 0 10px rgba(212, 168, 83, 0.4);
}

.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.phase-title {
    font-weight: 600;
    font-size: 1.125rem;
}

.phase-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Tech Chips */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.tech-chip {
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* Department Projects Overview */
.department-projects-page {
    --dept-border:rgba(92,126,220,.2);
    width:100%;
    max-width:1480px;
    min-width:0;
    margin-inline:auto;
    overflow:clip;
    color:#edf4ff;
}
.department-page-heading { display:flex; justify-content:space-between; align-items:end; margin-bottom:1.15rem; }
.department-page-heading h1 { margin:.28rem 0 .18rem; font-family:'DM Sans','Sarabun',sans-serif; font-size:clamp(1.65rem,2.5vw,2.45rem); letter-spacing:-.035em; }
.department-page-heading p,.department-breadcrumb { color:#8192b4; font-size:.78rem; }
.department-breadcrumb { display:flex; align-items:center; gap:.55rem; }
.department-breadcrumb a { color:#9eafff; }
.projects-icon { width:20px; height:20px; display:block; }

.department-kpi-layout { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:1rem; margin-bottom:1rem; }
.department-kpis { width:100%; min-width:0; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.75rem; }
.department-kpi,.project-health-card,.department-group,.projects-rail-card {
    background:linear-gradient(145deg,rgba(15,27,55,.96),rgba(8,18,39,.96));
    border:1px solid var(--dept-border); border-radius:16px; box-shadow:0 16px 38px rgba(0,6,24,.28);
}
.department-kpi { min-width:0; min-height:96px; display:flex; align-items:center; gap:.75rem; padding:.88rem; overflow:hidden; position:relative; }
.department-kpi::after { content:''; position:absolute; width:80px; height:80px; right:-35px; top:-35px; border-radius:50%; background:currentColor; opacity:.08; filter:blur(10px); }
.department-kpi-icon { width:42px; height:42px; display:grid; place-items:center; flex:0 0 42px; border-radius:12px; background:rgba(91,62,255,.17); }
.department-kpi small,.department-kpi strong,.department-kpi em { display:block; font-style:normal; }
.department-kpi small { color:#8fb6ff; font-size:.68rem; }
.department-kpi strong { margin:.15rem 0; color:#fff; font-size:1.6rem; line-height:1; }
.department-kpi em { color:#8b9ab9; font-size:.65rem; }
.department-kpi-violet { color:#8b5cf6; }.department-kpi-blue { color:#3b82f6; }.department-kpi-green { color:#22d3a7; }.department-kpi-cyan { color:#22d3ee; }
.department-kpi-green em { color:#2de5b6; }

.project-health-card { padding:1rem 1.15rem; display:grid; grid-template-columns:110px 1fr; gap:1rem; align-items:center; }
.project-health-card h3 { margin:0 0 .5rem; font-size:.8rem; }
.health-donut { --health:180deg; width:82px; height:82px; display:grid; place-items:center; border-radius:50%; background:conic-gradient(#22d3ee 0 var(--health),#7047eb var(--health) 255deg,#f5a524 255deg 285deg,#172442 285deg); box-shadow:0 0 22px rgba(61,113,255,.2); }
.health-donut::before { content:''; width:58px; height:58px; border-radius:50%; background:#0d1932; grid-area:1/1; }
.health-donut span { grid-area:1/1; z-index:1; text-align:center; }
.health-donut strong,.health-donut small { display:block; }.health-donut strong { font-size:1rem; }.health-donut small { color:#7f91b5; font-size:.5rem; }
.project-health-card ul { display:grid; gap:.42rem; margin:0; padding:0; list-style:none; }
.project-health-card li { display:grid; grid-template-columns:7px 1fr auto; align-items:center; gap:.4rem; font-size:.62rem; color:#9dadca; }
.project-health-card li i { width:7px; height:7px; border-radius:50%; }.project-health-card li strong { color:#fff; }
.health-green{background:#14d8a7}.health-blue{background:#2583ff}.health-purple{background:#7652ef}.health-orange{background:#ff8a1f}

.department-toolbar {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:.7rem;
    margin-bottom:1rem;
    padding:.75rem;
    border:1px solid rgba(84,118,207,.18);
    border-radius:14px;
    background:linear-gradient(145deg,rgba(11,24,51,.72),rgba(7,17,38,.58));
}
.department-chips {
    min-width:0;
    display:flex;
    flex-wrap:wrap;
    gap:.45rem;
    overflow:visible;
    padding:0;
}
.department-chip,.view-mode-button,.department-sort {
    border:1px solid rgba(84,118,207,.3); background:rgba(11,25,54,.82); color:#9fb0d2; border-radius:11px;
}
.department-chip { padding:.48rem .72rem; white-space:nowrap; cursor:pointer; font-size:.68rem; transition:border-color .2s ease,color .2s ease,background .2s ease; }
.department-chip span { margin-left:.28rem; color:#dce5ff; }
.department-chip:hover,.department-chip.active { color:#fff; border-color:#6f57ff; background:linear-gradient(135deg,#3958e8,#7d2cff); box-shadow:0 0 18px rgba(103,69,255,.34); }
.department-view-tools { min-width:0; display:flex; align-items:center; justify-content:flex-end; gap:.48rem; padding-top:.65rem; border-top:1px solid rgba(84,118,207,.14); }
.department-search { width:min(100%,320px); height:38px; display:flex; align-items:center; gap:.55rem; padding:0 .72rem; border:1px solid rgba(84,118,207,.28); border-radius:11px; background:rgba(8,20,46,.84); }
.department-search .projects-icon { width:16px; color:#7183a6; }
.department-search input { min-width:0; width:100%; border:0; outline:0; color:#eaf1ff; background:transparent; font-size:.7rem; }
.department-sort { height:38px; padding:0 2rem 0 .75rem; font-size:.68rem; }
.view-mode-button { width:38px; height:38px; display:grid; place-items:center; }
.view-mode-button .projects-icon { width:17px; }.view-mode-button.active { color:#42d4ff; background:#112b59; }

.department-content-layout { display:grid; grid-template-columns:minmax(0,1fr) 270px; gap:1rem; align-items:start; }
.department-groups,.projects-insight-rail { display:grid; gap:1rem; min-width:0; }
.department-group { overflow:hidden; }
.department-group-header { min-height:50px; display:flex; align-items:center; gap:.7rem; padding:.7rem 1rem; border-bottom:1px solid var(--dept-border); }
.department-group-icon { width:32px; height:32px; display:grid; place-items:center; border-radius:9px; color:#7db3ff; background:#174cc3; box-shadow:0 0 18px rgba(38,115,255,.32); }
.department-group-icon .projects-icon { width:17px; }
.department-group-header h2 { margin:0; font-family:'DM Sans','Sarabun',sans-serif; font-size:1rem; color:#d8e6ff; }
.department-group-header b { padding:.25rem .55rem; border-radius:999px; color:#cbd8f3; background:#17274c; font-size:.62rem; }
.department-group-header small { color:#8192b4; font-size:.62rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.department-group-orange .department-group-header { background:linear-gradient(90deg,rgba(120,65,5,.26),transparent 60%); }
.department-group-orange .department-group-icon { color:#ffd175; background:#b96e0b; }.department-group-orange .department-group-header h2 { color:#ffc654; }
.department-card-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(240px,340px));
    justify-content:start;
    align-items:stretch;
    gap:.8rem;
    padding:.8rem;
}

.department-project-card {
    width:100%;
    min-width:0;
    min-height:320px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    border:1px solid rgba(75,105,179,.25);
    border-radius:13px;
    background:#0b1731;
    cursor:pointer;
    transition:border-color .25s ease,box-shadow .25s ease,transform .25s ease;
}
.department-project-card:hover,.department-project-card:focus-visible { transform:translateY(-2px); border-color:#447cff; box-shadow:0 13px 30px rgba(0,12,42,.45),0 0 18px rgba(52,98,255,.12); outline:0; }
.department-project-media {
    width:100%;
    height:clamp(154px,10.5vw,188px);
    flex:0 0 auto;
    position:relative;
    display:grid;
    place-items:center;
    background:radial-gradient(circle at 50% 45%,rgba(77,64,207,.25),transparent 38%),linear-gradient(145deg,#111e3c,#0a142a);
    border-bottom:1px solid rgba(75,105,179,.22);
}
.department-project-image { position:absolute; inset:0; z-index:1; width:100%; height:100%; display:block; object-fit:cover; object-position:center; opacity:0; transition:opacity .25s ease; }
.department-project-media.image-loaded .department-project-image { opacity:1; }
.project-image-fallback { display:grid; place-items:center; gap:.35rem; color:#7968e9; }
.project-image-fallback .projects-icon { width:38px; height:38px; }
.project-image-fallback small { color:#7183a6; font-size:.56rem; letter-spacing:.06em; text-transform:uppercase; }
.department-project-media.image-failed .project-image-fallback { color:#6e62bd; }
.department-project-status { z-index:2; }
.department-project-status { position:absolute; top:.55rem; right:.55rem; padding:.26rem .55rem; border-radius:999px; color:#e8f5ff; background:#174cc3; font-size:.55rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.status-complete{background:#0ebc8d;color:#05261d}.status-active{background:#267bff}.status-planning{background:#1648c0}
.department-project-copy { min-height:0; flex:1; display:flex; flex-direction:column; padding:.82rem .86rem .78rem; }
.department-project-copy h3 { min-height:2.2em; margin:0 0 .35rem; color:#f2f6ff; font-size:.84rem; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.department-project-copy p { height:2.8em; margin:0 0 .7rem; color:#8192b4; font-size:.66rem; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.project-progress-row { display:grid; grid-template-columns:1fr auto; gap:.45rem; align-items:center; }
.project-progress-row>span { height:5px; overflow:hidden; border-radius:999px; background:#142447; }.project-progress-row i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#20d8ad,#24cce6); }
.project-progress-row strong { font-size:.58rem; }
.department-project-copy footer { display:grid; grid-template-columns:1fr auto auto; gap:.6rem; margin-top:auto; padding-top:.58rem; border-top:1px solid rgba(75,105,179,.17); color:#7486a9; font-size:.57rem; }
.department-project-copy footer span { display:flex; align-items:center; gap:.28rem; min-width:0; white-space:nowrap; }.department-project-copy footer .projects-icon { width:12px; height:12px; }

.projects-insight-rail { position:sticky; top:104px; }
.projects-rail-card { padding:.85rem; }
.projects-rail-card>header { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.65rem; }
.projects-rail-card h3 { display:flex; align-items:center; gap:.35rem; margin:0; font-size:.72rem; }.projects-rail-card h3 .projects-icon { width:15px; color:#ffab32; }
.projects-rail-card header a { color:#54cfff; font-size:.58rem; }
.top-projects-list,.projects-activity-list { display:grid; }
.top-project-item { display:grid; grid-template-columns:28px minmax(0,1fr) 48px; align-items:center; gap:.48rem; padding:.52rem 0; color:#eef4ff; border-bottom:1px solid rgba(77,105,171,.14); }
.top-project-item:last-child,.projects-activity-list a:last-child { border-bottom:0; }
.top-project-item>b { width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:#152449; font-size:.65rem; }
.top-project-item strong,.top-project-item small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.top-project-item strong { font-size:.62rem; }.top-project-item small { color:#7183a6; font-size:.53rem; }
.top-project-item>span em { display:block; margin-bottom:.22rem; color:#a9b8d5; font-size:.52rem; text-align:right; font-style:normal; }.top-project-item>span i { display:block; height:4px; overflow:hidden; border-radius:999px; background:#172648; }.top-project-item>span u { display:block; height:100%; border-radius:inherit; background:#12c8bd; text-decoration:none; }
.projects-activity-list a { display:grid; grid-template-columns:30px minmax(0,1fr) auto; gap:.5rem; align-items:center; padding:.5rem 0; color:#eef4ff; border-bottom:1px solid rgba(77,105,171,.14); }
.projects-activity-list>a>span { width:30px; height:30px; display:grid; place-items:center; border-radius:8px; }.projects-activity-list .projects-icon { width:15px; }
.activity-tone-0{color:#63e7c2;background:#0b745f}.activity-tone-1{color:#80baff;background:#174792}.activity-tone-2{color:#ffc66a;background:#80530c}
.projects-activity-list strong,.projects-activity-list small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.projects-activity-list strong { font-size:.6rem; }.projects-activity-list small,.projects-activity-list time { color:#7183a6; font-size:.5rem; }
.projects-ready-card { display:flex; align-items:center; gap:.75rem; padding:1rem; overflow:hidden; border:1px solid #346fff; border-radius:14px; color:#fff; background:radial-gradient(circle at 100% 0,rgba(58,210,255,.36),transparent 45%),linear-gradient(135deg,#1a24a7,#064bd3); box-shadow:0 0 28px rgba(43,93,255,.25); }
.projects-ready-card>span { width:42px; height:42px; display:grid; place-items:center; border-radius:12px; background:rgba(255,255,255,.12); }.projects-ready-card .projects-icon { width:25px; }
.projects-ready-card strong,.projects-ready-card small { display:block; }.projects-ready-card strong { font-size:.67rem; }.projects-ready-card small { margin-top:.18rem; color:#c2d6ff; font-size:.55rem; }
.department-empty { padding:3rem 1rem; text-align:center; color:#8292b3; border:1px dashed rgba(90,121,197,.3); border-radius:14px; }

@media(max-width:1400px){
    .department-kpi-layout{grid-template-columns:1fr}.department-kpis{grid-template-columns:repeat(4,minmax(0,1fr))}
    .project-health-card{display:none}.department-content-layout{grid-template-columns:minmax(0,1fr) 220px}
    .department-card-grid{grid-template-columns:repeat(2,minmax(260px,340px))}
}
@media(max-width:980px){
    .department-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
    .department-view-tools{flex-wrap:wrap}.department-search{width:100%;margin-right:auto}
    .department-content-layout{grid-template-columns:1fr}.department-card-grid{grid-template-columns:repeat(2,minmax(240px,340px))}.projects-insight-rail{position:static;grid-template-columns:repeat(2,1fr)}.projects-ready-card{grid-column:1/-1}
}
@media(max-width:640px){
    .department-kpis,.department-card-grid,.projects-insight-rail{grid-template-columns:1fr}
    .department-view-tools{display:grid;grid-template-columns:1fr auto auto}.department-search{width:100%;grid-column:1/-1}
    .department-sort{min-width:0;width:100%}.department-group-header small{display:none}
}
