/* ============================================================
   MÓDULO PROYECTOS — HexaFlow
   ============================================================ */

.projects-page { padding: 0.75rem 2rem 1.5rem; max-width: 1400px; margin: 0 auto; }

.projects-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap;
}
.projects-header-left  { display: flex; align-items: center; }
.projects-header-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.projects-title-group { display: flex; align-items: center; gap: 0.85rem; }
.projects-icon-wrap {
    width: 40px; height: 40px; border-radius: 0.75rem;
    background: #12141d; display: flex; align-items: center; justify-content: center;
}
.projects-title    { font-size: 1.3rem; font-weight: 800; color: #12141d; margin: 0; }
.projects-subtitle { font-size: 0.7rem; color: rgba(18,20,29,.5); margin: 0; font-weight: 500; }

.projects-view-tabs { display: flex; background: #f1f5f9; border-radius: 0.6rem; padding: 3px; gap: 2px; }
.proj-tab {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.85rem; border: none; border-radius: 0.5rem;
    font-size: 0.75rem; font-weight: 600; font-family: 'Montserrat', sans-serif;
    cursor: pointer; color: rgba(18,20,29,.55); background: transparent; transition: all 0.2s;
}
.proj-tab.active { background: #fff; color: #12141d; box-shadow: 0 1px 4px rgba(0,0,0,.1); }

.btn-proj-new {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1.1rem; border: none; border-radius: 0.6rem;
    background: #f3d34a; color: #12141d; font-size: 0.78rem; font-weight: 700;
    font-family: 'Montserrat', sans-serif; cursor: pointer; transition: all 0.2s;
}
.btn-proj-new:hover { background: #e5c53d; transform: translateY(-1px); }

.projects-filters-bar { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.proj-filter-select {
    padding: 0.42rem 0.85rem; border: 1.5px solid #e2e8f0; border-radius: 0.6rem;
    font-size: 0.75rem; font-weight: 600; font-family: 'Montserrat', sans-serif;
    color: #12141d; background: #fff; cursor: pointer; outline: none;
}
.proj-filter-select:focus { border-color: #f3d34a; }

/* ---- KANBAN ---- */
.proj-kanban { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; align-items: start; }
.proj-kanban-col { background: #f8fafc; border-radius: 1.5rem; overflow: hidden; border: 1px solid #e2e8f0; }
.proj-kanban-col-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.65rem; min-height: 120px; }
.proj-empty-col { text-align: center; color: rgba(18,20,29,.35); font-size: 0.72rem; padding: 1.5rem 0; font-weight: 500; }

.proj-card {
    background: #fff; border-radius: 0.85rem; padding: 1rem;
    border: 1px solid #e2e8f0; cursor: grab; transition: box-shadow 0.2s, transform 0.2s;
}
.proj-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-2px); }
.proj-card--dragging { opacity: 0.45; transform: scale(0.97); box-shadow: none; cursor: grabbing; }
.proj-drop-zone--over { background: #f0f7ff; outline: 2px dashed #3b82f6; outline-offset: -4px; }
.proj-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.proj-type-badge {
    font-size: 0.62rem; font-weight: 700; padding: 0.2rem 0.55rem;
    border-radius: 20px; background: #f1f5f9; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.proj-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.proj-card-name  { font-size: 0.85rem; font-weight: 700; color: #12141d; margin: 0 0 0.3rem; }
.proj-card-meta  { display: flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: rgba(18,20,29,.55); margin-bottom: 0.65rem; }
.proj-meta-sep   { color: #cbd5e1; }
.proj-card-progress { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.proj-progress-bar-wrap { flex: 1; height: 5px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.proj-progress-bar-wrap--lg { height: 8px; }
.proj-progress-bar-fill { height: 100%; background: #f3d34a; border-radius: 99px; transition: width 0.4s; }
.proj-progress-label { font-size: 0.65rem; font-weight: 600; color: rgba(18,20,29,.5); white-space: nowrap; }
.proj-delta { font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 20px; display: inline-block; margin-bottom: 0.3rem; }
.proj-delta--ahead { background: #dcfce7; color: #16a34a; }
.proj-delta--late  { background: #fee2e2; color: #dc2626; }
.proj-ahead { color: #16a34a; font-weight: 700; font-size: 0.72rem; }
.proj-late  { color: #dc2626; font-weight: 700; font-size: 0.72rem; }
.proj-card-responsible { font-size: 0.65rem; color: rgba(18,20,29,.45); display: flex; align-items: center; gap: 0.3rem; margin-top: 0.3rem; }

/* ---- GANTT ---- */
.proj-gantt-wrap { overflow-x: auto; }
.proj-gantt { display: flex; min-width: 800px; border: 1px solid #e2e8f0; border-radius: 1rem; overflow: hidden; }
.proj-gantt-sidebar { width: 220px; flex-shrink: 0; border-right: 1px solid #e2e8f0; background: #f8fafc; }
.proj-gantt-sidebar-header {
    height: 36px; display: flex; align-items: center; padding: 0 1rem;
    font-size: 0.7rem; font-weight: 700; color: rgba(18,20,29,.5);
    border-bottom: 1px solid #e2e8f0; background: #f1f5f9;
}
.proj-gantt-row-label {
    height: 48px; display: flex; flex-direction: column; justify-content: center;
    padding: 0 1rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.15s;
}
.proj-gantt-row-label:hover { background: #f1f5f9; }
.proj-gantt-name   { font-size: 0.75rem; font-weight: 700; color: #12141d; }
.proj-gantt-client { font-size: 0.65rem; color: rgba(18,20,29,.45); }
.proj-gantt-timeline-wrap { flex: 1; overflow: hidden; }
.proj-gantt-months { display: flex; height: 36px; border-bottom: 1px solid #e2e8f0; background: #f1f5f9; }
.proj-gantt-month {
    font-size: 0.65rem; font-weight: 700; color: rgba(18,20,29,.5);
    border-right: 1px solid #e2e8f0; display: flex; align-items: center;
    padding: 0 0.5rem; text-transform: uppercase; letter-spacing: 0.04em;
    white-space: nowrap; overflow: hidden;
}
.proj-gantt-rows { position: relative; }
.proj-gantt-row  { height: 48px; position: relative; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.proj-gantt-row:hover { background: rgba(243,211,74,.05); }
.proj-gantt-bar {
    position: absolute; top: 50%; transform: translateY(-50%);
    height: 22px; border-radius: 6px; display: flex; align-items: center;
    padding: 0 0.5rem; font-size: 0.62rem; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

/* ---- CRONOGRAMA ---- */
.proj-cronograma { overflow-x: auto; }
.proj-crono-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.proj-crono-table th {
    background: #f1f5f9; color: rgba(18,20,29,.6); font-weight: 700; font-size: 0.65rem;
    text-transform: uppercase; letter-spacing: 0.04em; padding: 0.75rem 1rem;
    text-align: left; border-bottom: 2px solid #e2e8f0;
}
.proj-crono-row { cursor: pointer; transition: background 0.15s; }
.proj-crono-row:hover { background: #f8fafc; }
.proj-crono-row td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.proj-crono-project { font-weight: 700; color: #12141d; }
.proj-crono-client  { color: rgba(18,20,29,.55); }
.proj-phase-chip         { font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 20px; white-space: nowrap; }
.proj-phase-status-badge { font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 20px; }
.proj-status-badge       { font-size: 0.68rem; font-weight: 700; padding: 0.2rem 0.65rem; border-radius: 20px; }

/* ---- DETAIL PANEL ---- */
.proj-detail-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000;
    display: flex; justify-content: flex-end; animation: fadeIn 0.15s ease;
}
.proj-detail-panel {
    width: min(680px,100vw); height: 100vh; background: #fff;
    overflow-y: auto; display: flex; flex-direction: column;
    box-shadow: -8px 0 40px rgba(0,0,0,.2); animation: slideInRight 0.2s ease;
}
.proj-detail-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid #f1f5f9;
    position: sticky; top: 0; background: #fff; z-index: 10;
}
.proj-detail-title-group { flex: 1; }
.proj-detail-name { font-size: 1.15rem; font-weight: 800; color: #12141d; margin: 0 0 0.5rem; }
.proj-detail-meta-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.proj-detail-actions  { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.proj-btn-edit {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.85rem; border: 1.5px solid #e2e8f0; border-radius: 0.55rem;
    font-size: 0.75rem; font-weight: 600; font-family: 'Montserrat', sans-serif;
    cursor: pointer; background: #fff; color: #12141d; transition: all 0.2s;
}
.proj-btn-edit:hover { background: #f8fafc; border-color: #12141d; }
.proj-btn-close {
    width: 32px; height: 32px; border: none; border-radius: 0.5rem;
    background: #f1f5f9; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #64748b; transition: all 0.2s;
}
.proj-btn-close:hover { background: #e2e8f0; color: #12141d; }
.proj-detail-global-progress { padding: 1rem 1.5rem; border-bottom: 1px solid #f1f5f9; }
.proj-detail-progress-info { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 600; color: rgba(18,20,29,.6); margin-bottom: 0.4rem; }
.proj-detail-pct { color: #12141d; font-weight: 800; }
.proj-detail-dates-row { display: flex; gap: 1.25rem; padding: 0.75rem 1.5rem; flex-wrap: wrap; border-bottom: 1px solid #f1f5f9; }
.proj-date-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; color: rgba(18,20,29,.6); }
.proj-date-item strong { color: #12141d; }
.proj-detail-desc { padding: 0.75rem 1.5rem; font-size: 0.78rem; color: rgba(18,20,29,.6); border-bottom: 1px solid #f1f5f9; margin: 0; }
/* ─── Phase Tabs ─────────────────────────────── */
.proj-phase-tab-bar {
    display: flex;
    gap: 0.3rem;
    background: #f1f3f5;
    border-radius: 1rem;
    padding: 0.3rem;
    overflow-x: auto;
    margin: 0.25rem 1.5rem 1rem;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    align-self: center;
    justify-content: center;
}
.proj-phase-tab-bar::-webkit-scrollbar { display: none; }

.proj-phase-tab {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.75rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s;
    flex-shrink: 0;
}
.proj-phase-tab.active {
    background: #ffffff;
    color: #1a1b1e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.proj-phase-tab:hover:not(.active) {
    background: rgba(0,0,0,0.05);
    color: #374151;
}
.proj-phase-tab-badge {
    font-size: 0.62rem;
    padding: 0.1rem 0.45rem;
    border-radius: 20px;
    font-weight: 700;
    line-height: 1.4;
}
.proj-phase-tab-count {
    font-size: 0.62rem;
    color: #9ca3af;
    font-weight: 600;
}

.proj-phase-panels { padding: 0 1.5rem 1.5rem; }
.proj-phase-panel { display: none; }
.proj-phase-panel.active { display: block; }

.proj-phases-list { padding: 1rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }

.proj-phase-section { border: 1px solid #e2e8f0; border-radius: 0.85rem; overflow: hidden; }
.proj-phase-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.proj-phase-header-left  { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.proj-phase-header-right { display: flex; align-items: center; gap: 0.5rem; }
.proj-phase-name { font-size: 0.8rem; font-weight: 800; }
.proj-phase-progress-txt { font-size: 0.7rem; font-weight: 600; color: rgba(18,20,29,.5); }
.proj-phase-status-select {
    padding: 0.3rem 0.6rem; border: 1.5px solid #e2e8f0; border-radius: 0.45rem;
    font-size: 0.7rem; font-weight: 600; font-family: 'Montserrat', sans-serif;
    color: #12141d; background: #fff; cursor: pointer; outline: none;
}
.proj-phase-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.85rem; }
.proj-phase-dates { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.proj-phase-date-pair { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 120px; }
.proj-phase-date-pair label { font-size: 0.65rem; font-weight: 700; color: rgba(18,20,29,.5); text-transform: uppercase; letter-spacing: 0.03em; }
.proj-date-input {
    padding: 0.38rem 0.6rem; border: 1.5px solid #e2e8f0; border-radius: 0.5rem;
    font-size: 0.73rem; font-family: 'Montserrat', sans-serif; color: #12141d; outline: none;
}
.proj-date-input:focus { border-color: #f3d34a; }

.proj-task-list  { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.proj-task-item  { padding: 0.4rem 0.5rem; border-radius: 0.45rem; transition: background 0.15s; }
.proj-task-item:hover { background: #f8fafc; }
.proj-task-check-label { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.proj-task-checkbox { width: 15px; height: 15px; accent-color: #f3d34a; cursor: pointer; flex-shrink: 0; }
.proj-task-name { font-size: 0.77rem; font-weight: 500; color: #12141d; }
.proj-task-item--done .proj-task-name { text-decoration: line-through; color: rgba(18,20,29,.4); }

.proj-section-label { font-size: 0.65rem; font-weight: 700; color: rgba(18,20,29,.5); text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 0.35rem; }
.proj-phase-comments { display: flex; flex-direction: column; gap: 0.4rem; }
.proj-comments-input {
    width: 100%; min-height: 70px; padding: 0.6rem 0.75rem;
    border: 1.5px solid #e2e8f0; border-radius: 0.6rem; resize: vertical;
    font-size: 0.75rem; font-family: 'Montserrat', sans-serif; color: #12141d;
    outline: none; box-sizing: border-box;
}
.proj-comments-input:focus { border-color: #f3d34a; }
.proj-btn-save-comments {
    align-self: flex-end; padding: 0.35rem 0.85rem; border: none; border-radius: 0.45rem;
    background: #f3d34a; color: #12141d; font-size: 0.72rem; font-weight: 700;
    font-family: 'Montserrat', sans-serif; cursor: pointer;
}

.proj-phase-attachments { display: flex; flex-direction: column; gap: 0.4rem; }
.proj-attach-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.proj-attach-item { display: flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.5rem; background: #f8fafc; border-radius: 0.45rem; font-size: 0.73rem; }
.proj-attach-item a { color: #3b82f6; text-decoration: none; font-weight: 600; }
.proj-attach-item a:hover { text-decoration: underline; }
.proj-attach-item span { color: #12141d; font-weight: 500; flex: 1; }
.proj-attach-delete { margin-left: auto; border: none; background: transparent; cursor: pointer; color: #94a3b8; padding: 2px; border-radius: 3px; display: flex; align-items: center; }
.proj-attach-delete:hover { color: #ef4444; }
.proj-attach-add-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.proj-attach-name-input, .proj-attach-url-input {
    flex: 1; min-width: 100px; padding: 0.38rem 0.6rem;
    border: 1.5px solid #e2e8f0; border-radius: 0.5rem;
    font-size: 0.72rem; font-family: 'Montserrat', sans-serif; color: #12141d; outline: none;
}
.proj-attach-name-input:focus, .proj-attach-url-input:focus { border-color: #f3d34a; }
.proj-btn-attach {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.38rem 0.75rem; border: none; border-radius: 0.5rem;
    background: #12141d; color: #fff; font-size: 0.72rem; font-weight: 700;
    font-family: 'Montserrat', sans-serif; cursor: pointer; white-space: nowrap;
}

/* ---- PROJECT MODAL ---- */
.proj-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9100;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem; animation: fadeIn 0.15s ease;
}
.proj-modal {
    background: #fff; border-radius: 1.25rem; width: 100%; max-width: 540px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: slideUp 0.2s ease;
}
.proj-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid #f1f5f9;
    position: sticky; top: 0; background: #fff; z-index: 2;
}
.proj-modal-header h3 { font-size: 1rem; font-weight: 800; color: #12141d; margin: 0; }
.proj-modal-form { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.proj-form-row { display: flex; flex-direction: column; gap: 0.3rem; }
.proj-form-row--2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.proj-form-row label { font-size: 0.68rem; font-weight: 700; color: rgba(18,20,29,.6); text-transform: uppercase; letter-spacing: 0.03em; }
.proj-form-row .req  { color: #ef4444; }
.proj-form-row input[type="text"],
.proj-form-row input[type="date"],
.proj-form-row input[type="url"],
.proj-form-row select,
.proj-form-row textarea {
    padding: 0.55rem 0.85rem; border: 1.5px solid #e2e8f0; border-radius: 0.6rem;
    font-size: 0.78rem; font-family: 'Montserrat', sans-serif; color: #12141d;
    outline: none; background: #fff; transition: border-color 0.2s;
}
.proj-form-row input:focus, .proj-form-row select:focus, .proj-form-row textarea:focus { border-color: #f3d34a; }
.proj-form-row textarea { min-height: 80px; resize: vertical; }
.proj-form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding-top: 0.5rem; }
.proj-btn-cancel {
    padding: 0.5rem 1.1rem; border: 1.5px solid #e2e8f0; border-radius: 0.6rem;
    font-size: 0.78rem; font-weight: 600; font-family: 'Montserrat', sans-serif;
    cursor: pointer; background: #fff; color: #64748b;
}
.proj-btn-save {
    padding: 0.5rem 1.25rem; border: none; border-radius: 0.6rem;
    font-size: 0.78rem; font-weight: 700; font-family: 'Montserrat', sans-serif;
    cursor: pointer; background: #12141d; color: #fff; transition: background 0.2s;
}
.proj-btn-save:hover    { background: #2d3047; }
.proj-btn-save:disabled { opacity: 0.6; cursor: not-allowed; }

.proj-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 4rem 2rem; color: rgba(18,20,29,.35); }
.proj-empty-state p { font-size: 0.85rem; font-weight: 500; }

@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideUp      { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }

@media (max-width: 768px) {
    .projects-page { padding: 1rem; }
    .proj-kanban   { grid-template-columns: 1fr; }
    .proj-form-row--2col { grid-template-columns: 1fr; }
    .proj-detail-panel   { width: 100vw; }
    .proj-gantt-sidebar  { width: 140px; }
}
