/* Variables CSS Globales Premium (Inspiración JIRA/Linear) */
:root {
    --bs-body-font-family: 'Inter', sans-serif;
    --bs-body-bg: #f4f5f7; /* Fondo gris muy suave clásico de JIRA */
    --bs-body-color: #172b4d;
    
    --primary-color: #0052cc;
    --primary-hover: #0065ff;
    
    --kanban-col-bg: #ebecf0;
    --kanban-card-bg: #ffffff;
    
    --shadow-sm: 0 1px 2px rgba(9, 30, 66, 0.25);
    --shadow-md: 0 4px 8px -2px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
    --shadow-hover: 0 8px 16px -4px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Colores de Estados */
    --state-todo-bg: #dfe1e6;
    --state-todo-text: #42526e;
    --state-in-progress-bg: #deebff;
    --state-in-progress-text: #0052cc;
    --state-done-bg: #e3fcef;
    --state-done-text: #006644;
    --state-cerrado-bg: #eae6ff;
    --state-cerrado-text: #403294;
    --state-cancelado-bg: #ffebe6;
    --state-cancelado-text: #bf2600;
}

body {
    font-family: var(--bs-body-font-family);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Navbar */
.custom-navbar {
    box-shadow: 0 1px 0 rgba(9, 30, 66, 0.05);
    height: 64px;
}

.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.search-glass {
    background-color: rgba(9, 30, 66, 0.04);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    width: 250px;
}
.search-glass:focus-within {
    background-color: #fff;
    box-shadow: 0 0 0 2px var(--primary-hover);
}
.search-glass input::placeholder {
    color: #6b778c;
    font-size: 0.9rem;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* Tablero Kanban */
.kanban-board {
    display: flex;
    gap: 16px;
    height: calc(100vh - 120px);
    overflow-x: auto;
    padding-bottom: 16px;
    align-items: flex-start;
}

.kanban-column {
    background-color: var(--kanban-col-bg);
    border-radius: var(--radius-md);
    width: 300px;
    min-width: 300px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #5e6c84;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-body {
    padding: 0 8px 8px 8px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 50px;
}

/* Tarjetas de Tarea */
.kanban-card {
    background-color: var(--kanban-card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.kanban-card:hover {
    background-color: #fafbfc;
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.sortable-ghost {
    opacity: 0.4;
    background-color: #f4f5f7;
    border: 1px dashed #a5adba;
    box-shadow: none;
}

.kanban-card.sortable-drag {
    cursor: grabbing;
    box-shadow: var(--shadow-hover);
    transform: rotate(2deg);
}

.issue-key {
    font-size: 0.75rem;
    color: #5e6c84;
    font-weight: 500;
}

.issue-title {
    font-size: 0.9rem;
    color: var(--bs-body-color);
    font-weight: 400;
    margin: 8px 0;
    line-height: 1.4;
}

.issue-type-icon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
}
.type-story { background-color: #65ba43; }
.type-task { background-color: #4bade8; }
.type-bug { background-color: #e5493a; }
.type-epic { background-color: #904ee2; }

/* ── Project Sidebar ──────────────────────────────────── */
.project-sidebar {
    width: 240px;
    min-width: 240px;
    background: #fff;
    border-right: 1px solid #ebecf0;
    overflow-y: auto;
    flex-shrink: 0;
}

.project-sidebar-header {
    background: #fff;
}

.project-icon-box {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -.5px;
}

.sidebar-section-label {
    font-size: .68rem;
    font-weight: 700;
    color: #5e6c84;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding-top: 12px;
    padding-bottom: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    color: #172b4d;
    text-decoration: none;
    transition: background .12s;
}

.sidebar-link:hover {
    background: #f4f5f7;
    color: #172b4d;
}

.sidebar-link.active {
    background: #deebff;
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* ── App shell layout with sidebar ──────────────────────── */
.app-shell {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.app-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* ── Backlog / Sprint sections ───────────────────────────── */
.sprint-section {
    border: 1px solid #ebecf0;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    background: #fff;
    overflow: hidden;
}

.sprint-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f1f4;
    cursor: pointer;
    user-select: none;
}

.sprint-section-header:hover {
    background: #fafbfc;
}

.backlog-task-row {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-bottom: 1px solid #f4f5f7;
    gap: 8px;
    min-height: 40px;
    transition: background .1s;
}

.backlog-task-row:last-child {
    border-bottom: none;
}

.backlog-task-row:hover {
    background: #f8f9fc;
}

.backlog-task-row.selected {
    background: #e9f0ff;
}

.type-square {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: white;
    flex-shrink: 0;
}

.epic-badge {
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-pill {
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    white-space: nowrap;
    cursor: pointer;
    text-transform: uppercase;
}

.status-pill.to-do      { background:#dfe1e6; color:#42526e; }
.status-pill.in-progress { background:#deebff; color:#0052cc; }
.status-pill.done        { background:#e3fcef; color:#006644; }
.status-pill.cancelled   { background:#ffebe6; color:#bf2600; }

.sp-badge {
    background: #f0f1f4;
    color: #5e6c84;
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    min-width: 22px;
    text-align: center;
}

/* ── Backlog drag-and-drop ───────────────────────────────── */
.drag-handle {
    cursor: grab;
    user-select: none;
}
.drag-handle:active {
    cursor: grabbing;
}
.backlog-task-row:hover .drag-handle {
    opacity: .7 !important;
}

.task-row-menu-btn {
    opacity: 0;
    transition: opacity .1s;
}
.backlog-task-row:hover .task-row-menu-btn {
    opacity: 1;
}

.sortable-ghost-row {
    opacity: .4;
    background: #deebff !important;
    border: 1px dashed #4c9aff;
}
.sortable-drag-row {
    box-shadow: 0 4px 12px rgba(9, 30, 66, .2);
    background: #fff !important;
    border-radius: var(--radius-sm);
    opacity: .95;
}

/* Highlight drop-target list while dragging */
.backlog-task-list.sortable-over {
    background: #f0f6ff;
    outline: 2px dashed #4c9aff;
    outline-offset: -2px;
}

/* ── Gantt Timeline ──────────────────────────────────────── */
.gantt-wrapper {
    overflow-x: auto;
}

.gantt-table {
    border-collapse: collapse;
    min-width: 800px;
    width: 100%;
}

.gantt-table th, .gantt-table td {
    border: 1px solid #ebecf0;
    padding: 0;
    white-space: nowrap;
}

.gantt-label-col {
    width: 260px;
    min-width: 260px;
    padding: 8px 12px !important;
    font-size: .84rem;
}

.gantt-month-header {
    text-align: center;
    font-size: .72rem;
    font-weight: 600;
    color: #5e6c84;
    padding: 6px 0 !important;
    background: #f4f5f7;
    min-width: 80px;
}

.gantt-cell {
    position: relative;
    min-width: 80px;
    height: 36px;
}

.gantt-bar {
    position: absolute;
    top: 6px;
    height: 22px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    padding: 0 6px;
    font-size: .7rem;
    font-weight: 600;
    color: white;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 1;
}

.gantt-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff5630;
    z-index: 2;
}

/* Scrollbars custom */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a5adba;
}
