/*
 * Procesos de Compras — OGTIC Design System v3
 * Versión 1.0.0 — Desarrollado por OGTIC
 * Prefix: pdc-
 * ================================================================= */

/* ── Base ────────────────────────────────────────────────────────── */
.pdc-wrapper {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #374151;
    line-height: 1.5;
}
.pdc-wrapper *, .pdc-wrapper *::before, .pdc-wrapper *::after {
    box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────────────── */
.pdc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    margin-bottom: 14px;
}
.pdc-header-left { min-width: 0; }

.pdc-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #0d99ff;
    margin-bottom: 5px;
}
.pdc-eyebrow::before {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: #0d99ff;
    border-radius: 2px;
    flex-shrink: 0;
}

.pdc-header-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: #003876;
    line-height: 1.25;
    margin: 0;
}

.pdc-uc-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}
.pdc-uc-badge svg { color: #0d99ff; }

/* ── Stats bar ───────────────────────────────────────────────────── */
.pdc-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.pdc-stat {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
}
.pdc-stat-n {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #003876;
    line-height: 1;
    margin-bottom: 5px;
}
.pdc-stat-l {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #6b7280;
}
.pdc-stat-l svg { color: #0d99ff; flex-shrink: 0; }

/* ── Accordion contenedor ────────────────────────────────────────── */
.pdc-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Collapse (base para todos los niveles) ──────────────────────── */
.pdc-collapse {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Modalidad card ──────────────────────────────────────────────── */
.pdc-mod-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pdc-mod-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease;
    border-radius: 16px 16px 0 0;
}
.pdc-mod-toggle:hover { background: #f9fafb; }
.pdc-mod-toggle:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(13, 153, 255, 0.4);
}
.pdc-mod-toggle[aria-expanded="true"] {
    border-bottom: 1px solid #e5e7eb;
}

.pdc-mod-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pdc-mod-info { flex: 1; min-width: 0; }
.pdc-mod-name {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #003876;
    display: block;
    margin-bottom: 2px;
}
.pdc-mod-meta {
    font-size: 0.8125rem;
    color: #6b7280;
    display: block;
}

.pdc-mod-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pdc-count-pill {
    padding: 3px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pdc-chevron {
    display: flex;
    align-items: center;
    color: #9ca3af;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pdc-mod-toggle[aria-expanded="true"] .pdc-chevron { transform: rotate(180deg); }

/* ── Accent color variants ───────────────────────────────────────── */
.pdc-accent-blue  .pdc-mod-icon { background: #dbeafe; color: #1565C0; }
.pdc-accent-blue  .pdc-count-pill { background: #dbeafe; color: #1565C0; }
.pdc-accent-cyan  .pdc-mod-icon { background: #e0f7fa; color: #00695c; }
.pdc-accent-cyan  .pdc-count-pill { background: #e0f7fa; color: #00695c; }
.pdc-accent-amber .pdc-mod-icon { background: #fef3c7; color: #92400e; }
.pdc-accent-amber .pdc-count-pill { background: #fef3c7; color: #92400e; }
.pdc-accent-teal  .pdc-mod-icon { background: #d1fae5; color: #065f46; }
.pdc-accent-teal  .pdc-count-pill { background: #d1fae5; color: #065f46; }
.pdc-accent-navy  .pdc-mod-icon { background: #e0e7f0; color: #003876; }
.pdc-accent-navy  .pdc-count-pill { background: #e0e7f0; color: #003876; }
.pdc-accent-purple .pdc-mod-icon { background: #ede9fe; color: #5b21b6; }
.pdc-accent-purple .pdc-count-pill { background: #ede9fe; color: #5b21b6; }

/* Borde activo cuando está expandido — requiere :has() (Chrome 105+, Firefox 121+, Safari 15.4+) */
.pdc-accent-blue:has(.pdc-mod-toggle[aria-expanded="true"])   { border-color: #1565C0; box-shadow: 0 4px 12px rgba(21,101,192,0.08); }
.pdc-accent-cyan:has(.pdc-mod-toggle[aria-expanded="true"])   { border-color: #12abce; box-shadow: 0 4px 12px rgba(18,171,206,0.08); }
.pdc-accent-amber:has(.pdc-mod-toggle[aria-expanded="true"])  { border-color: #f59e0b; box-shadow: 0 4px 12px rgba(245,158,11,0.08); }
.pdc-accent-teal:has(.pdc-mod-toggle[aria-expanded="true"])   { border-color: #10b981; box-shadow: 0 4px 12px rgba(16,185,129,0.08); }
.pdc-accent-navy:has(.pdc-mod-toggle[aria-expanded="true"])   { border-color: #003876; box-shadow: 0 4px 12px rgba(0,56,118,0.08); }
.pdc-accent-purple:has(.pdc-mod-toggle[aria-expanded="true"]) { border-color: #7c3aed; box-shadow: 0 4px 12px rgba(124,58,237,0.08); }

/* ── Modalidad body ──────────────────────────────────────────────── */
.pdc-mod-body { padding: 14px; }

/* ── Year container ──────────────────────────────────────────────── */
.pdc-years-container { display: flex; flex-direction: column; gap: 6px; }

.pdc-year-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.pdc-year-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: #f9fafb;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 10px 10px 0 0;
}
.pdc-year-toggle:hover { background: #f3f4f6; }
.pdc-year-toggle[aria-expanded="true"] {
    background: #f0f9ff;
    border-bottom: 1px solid #e5e7eb;
}

.pdc-year-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1565C0;
}
.pdc-year-label svg { color: #0d99ff; }

.pdc-year-right { display: flex; align-items: center; gap: 8px; }

.pdc-year-badge {
    font-size: 0.75rem;
    color: #6b7280;
    padding: 2px 10px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
}

.pdc-year-chevron {
    display: flex;
    align-items: center;
    color: #9ca3af;
    transition: transform 0.25s ease;
}
.pdc-year-toggle[aria-expanded="true"] .pdc-year-chevron { transform: rotate(180deg); }

/* ── Year panel ──────────────────────────────────────────────────── */
.pdc-year-panel {
    padding: 8px 10px;
    background: #ffffff;
}
.pdc-months-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* ── Month item ──────────────────────────────────────────────────── */
.pdc-month-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.pdc-month-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 8px 8px 0 0;
}
.pdc-month-toggle:hover { background: #f9fafb; }
.pdc-month-toggle[aria-expanded="true"] {
    background: #f0f9ff;
    border-bottom: 1px solid #e5e7eb;
}

.pdc-month-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.pdc-month-count {
    font-size: 0.75rem;
    color: #6b7280;
    padding: 1px 8px;
    background: #f3f4f6;
    border-radius: 9999px;
    margin-left: 4px;
}

.pdc-month-chevron {
    display: flex;
    align-items: center;
    color: #9ca3af;
    margin-left: auto;
    transition: transform 0.2s ease;
}
.pdc-month-toggle[aria-expanded="true"] .pdc-month-chevron { transform: rotate(180deg); }

/* ── Tipo item (Casos de Excepción) ──────────────────────────────── */
.pdc-tipos-container { display: flex; flex-direction: column; gap: 4px; padding: 8px; }

.pdc-tipo-item { border: 1px solid #e5e7eb; border-radius: 8px; }

.pdc-tipo-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: #fef3c7;
    border: none;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #92400e;
    transition: background-color 0.15s ease;
    border-radius: 8px 8px 0 0;
}
.pdc-tipo-toggle:hover { background: #fde68a; }
.pdc-tipo-toggle[aria-expanded="true"] { border-bottom: 1px solid #fde68a; }
.pdc-tipo-chevron { display: flex; align-items: center; transition: transform 0.2s ease; }
.pdc-tipo-toggle[aria-expanded="true"] .pdc-tipo-chevron { transform: rotate(180deg); }

/* ── Procesos list ───────────────────────────────────────────────── */
.pdc-procesos-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
}

/* ── Proceso card ────────────────────────────────────────────────── */
.pdc-proceso {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.pdc-proceso:hover {
    background: #ffffff;
    border-color: #0d99ff;
    box-shadow: 0 2px 10px rgba(13, 153, 255, 0.09);
    transform: translateX(3px);
}

.pdc-proceso-info { flex: 1; min-width: 0; }

.pdc-proceso-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 5px;
}

.pdc-codigo {
    font-family: 'Inter', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    padding: 2px 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    letter-spacing: 0.01em;
}

.pdc-estado-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pdc-estado-verde  { background: #d1fae5; color: #065f46; }
.pdc-estado-azul   { background: #dbeafe; color: #1e3a8a; }
.pdc-estado-amber  { background: #fef3c7; color: #92400e; }
.pdc-estado-rojo   { background: #fee2e2; color: #991b1b; }
.pdc-estado-gris   { background: #f3f4f6; color: #4b5563; }

.pdc-proceso-desc {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.55;
    margin: 0 0 8px 0;
}

.pdc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.pdc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #6b7280;
}
.pdc-meta-item svg { color: #12abce; flex-shrink: 0; }

/* ── Botón detalles ──────────────────────────────────────────────── */
.pdc-btn-detalles {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #0d99ff;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.pdc-btn-detalles:hover, .pdc-btn-detalles:focus {
    background: #3d38f5;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(61, 56, 245, 0.28);
}
.pdc-btn-detalles:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(13, 153, 255, 0.25); }

/* ── Notice ──────────────────────────────────────────────────────── */
.pdc-notice {
    padding: 16px 20px;
    border-radius: 14px;
    border: 1.5px solid;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.9375rem;
}
.pdc-notice--error  { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.pdc-notice--info   { background: #dbeafe; border-color: #bfdbfe; color: #1e3a8a; }
.pdc-notice__icon   { flex-shrink: 0; width: 20px; height: 20px; }

/* ── Footer note ─────────────────────────────────────────────────── */
.pdc-footer-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
    line-height: 1.55;
}
.pdc-footer-note svg { color: #0d99ff; flex-shrink: 0; margin-top: 1px; }
.pdc-footer-note a  { color: #0061e0; text-decoration: none; font-weight: 500; }
.pdc-footer-note a:hover { text-decoration: underline; color: #0d99ff; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pdc-proceso {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .pdc-btn-detalles { width: 100%; justify-content: center; }
    .pdc-stats { grid-template-columns: repeat(2, 1fr); }
    .pdc-stats .pdc-stat:last-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .pdc-header { flex-direction: column; align-items: flex-start; }
    .pdc-mod-toggle { padding: 14px 16px; gap: 10px; }
    .pdc-mod-icon { width: 36px; height: 36px; border-radius: 10px; }
    .pdc-mod-name { font-size: 0.875rem; }
    .pdc-mod-body { padding: 10px; }
    .pdc-stats { grid-template-columns: 1fr; }
    .pdc-stats .pdc-stat:last-child { grid-column: unset; }
    .pdc-header-title { font-size: 1rem; }
}

/* ── Reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .pdc-mod-card, .pdc-mod-toggle, .pdc-chevron,
    .pdc-year-chevron, .pdc-month-chevron, .pdc-tipo-chevron,
    .pdc-collapse, .pdc-proceso, .pdc-btn-detalles { transition: none; }
}

/* ── Botón deshabilitado (proceso sin URL) ───────────────────────── */
.pdc-btn-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    background: #f3f4f6;
    color: #9ca3af;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: not-allowed;
    user-select: none;
    border: 1px solid #e5e7eb;
}
