/* ============================================
   Nubidoc / Treebole Clinicas - Guias Visuales
   CSS compartido para todas las guias
   ============================================ */

/* --- Theme Variables --- */
:root,
[data-theme="nubidoc"] {
    --nubi-primary: #6C63FF;
    --nubi-primary-dark: #5B54E6;
    --nubi-primary-light: #8B85FF;
    --nubi-dark: #2D3748;
    --nubi-gray: #6C757D;
    --nubi-light: #F7F8FC;
    --nubi-white: #FFFFFF;
    --nubi-accent: #28A745;
    --nubi-warning: #FF8C00;
    --nubi-error: #DC3545;
    --nubi-info: #3B82F6;
    --nubi-border: #DEE2E6;
    --nubi-bg-secondary: #F7F8FC;
    --nubi-shadow-primary: rgba(108, 99, 255, 0.3);
    --nubi-shadow-primary-hover: rgba(108, 99, 255, 0.4);
}

[data-theme="treebole"],
[data-theme="treebole-clinicas"] {
    --nubi-primary: #99C4CC;
    --nubi-primary-dark: #7AABB5;
    --nubi-primary-light: #B3D4DA;
    --nubi-shadow-primary: rgba(153, 196, 204, 0.3);
    --nubi-shadow-primary-hover: rgba(153, 196, 204, 0.4);
}

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--nubi-dark);
}

/* --- Header --- */
.header {
    background: linear-gradient(135deg, var(--nubi-primary) 0%, var(--nubi-primary-dark) 100%);
    color: white;
    padding: 25px 40px;
    box-shadow: 0 4px 20px var(--nubi-shadow-primary);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 40px;
    filter: brightness(0) invert(1);
}

.header-title {
    text-align: center;
}

.header-title h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header-title p {
    font-size: 13px;
    opacity: 0.9;
}

.header-spacer {
    width: 150px;
}

.header-nav {
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.header-nav:hover {
    opacity: 1;
}

/* --- Progress Bar --- */
.progress-container {
    background: white;
    padding: 30px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--nubi-border);
}

.progress-bar {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    height: 3px;
    background: #e5e7eb;
    z-index: 0;
}

.progress-line {
    position: absolute;
    top: 20px;
    left: 50px;
    height: 3px;
    background: var(--nubi-primary);
    z-index: 0;
    transition: width 0.5s ease;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.step-number {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: white;
    border: 3px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: var(--nubi-primary);
    border-color: var(--nubi-primary);
    color: white;
    box-shadow: 0 4px 15px var(--nubi-shadow-primary-hover);
}

.step.completed .step-number {
    background: var(--nubi-accent);
    border-color: var(--nubi-accent);
    color: white;
}

.step-label {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
    max-width: 80px;
}

.step.active .step-label {
    color: var(--nubi-primary);
}

.step.completed .step-label {
    color: var(--nubi-accent);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-container {
    max-width: 1000px;
    width: 100%;
}

.slide {
    display: none;
    animation: fadeIn 0.5s ease;
}

.slide.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Cards --- */
.card {
    background: var(--nubi-white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid var(--nubi-border);
}

.card-header {
    background: linear-gradient(135deg, var(--nubi-primary) 0%, var(--nubi-primary-dark) 100%);
    color: white;
    padding: 25px 35px;
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h2 .step-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.card-header h2 > span:last-child {
    min-width: 0;
}

.card-body {
    padding: 35px;
}

/* --- Breadcrumb --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 14px;
    flex-wrap: wrap;
}

.breadcrumb span {
    color: var(--nubi-gray);
}

.breadcrumb span.active {
    color: var(--nubi-primary);
    font-weight: 600;
}

.breadcrumb .separator {
    color: #cbd5e1;
}

/* --- Instructions --- */
.instruction-list {
    list-style: none;
    margin-bottom: 30px;
}

.instruction-list li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 18px;
    padding: 18px 20px;
    background: var(--nubi-light);
    border-radius: 12px;
    border-left: 4px solid var(--nubi-primary);
    transition: transform 0.2s ease;
}

.instruction-list li:hover {
    transform: translateX(5px);
}

.instruction-number {
    width: 32px;
    height: 32px;
    background: var(--nubi-primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 14px;
}

.instruction-content {
    flex: 1;
}

.instruction-content strong {
    display: block;
    color: var(--nubi-dark);
    margin-bottom: 5px;
    font-size: 15px;
}

.instruction-content span {
    color: var(--nubi-gray);
    font-size: 14px;
    line-height: 1.5;
}

/* --- Screenshot Container --- */
.screenshot-container {
    border-radius: 12px;
    overflow: hidden;
    margin: 25px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid var(--nubi-border);
}

.screenshot-container img {
    width: 100%;
    display: block;
}

.screenshot-caption {
    padding: 12px 20px;
    background: #f8fafc;
    color: var(--nubi-gray);
    font-size: 13px;
    border-top: 1px solid var(--nubi-border);
    margin: 0;
}

/* --- Highlight Boxes --- */
.highlight-box {
    border-radius: 12px;
    padding: 18px 22px;
    margin-top: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border-left: 4px solid;
}

.highlight-box.info {
    background: #eff6ff;
    border-color: var(--nubi-info);
}

.highlight-box.success {
    background: #ecfdf5;
    border-color: var(--nubi-accent);
}

.highlight-box.warning {
    background: #fffbeb;
    border-color: var(--nubi-warning);
}

.highlight-box.error {
    background: #fef2f2;
    border-color: var(--nubi-error);
}

.highlight-box .hl-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.highlight-box .hl-content {
    flex: 1;
}

.highlight-box .hl-content strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.highlight-box.info .hl-content strong { color: #1e40af; }
.highlight-box.success .hl-content strong { color: #065f46; }
.highlight-box.warning .hl-content strong { color: #92400e; }
.highlight-box.error .hl-content strong { color: #991b1b; }

.highlight-box .hl-content p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

.highlight-box.info .hl-content p { color: #1e3a8a; }
.highlight-box.success .hl-content p { color: #064e3b; }
.highlight-box.warning .hl-content p { color: #78350f; }
.highlight-box.error .hl-content p { color: #7f1d1d; }

/* --- Navigation Buttons --- */
.navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--nubi-primary) 0%, var(--nubi-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--nubi-shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--nubi-shadow-primary-hover);
}

.btn-secondary {
    background: white;
    color: var(--nubi-dark);
    border: 2px solid #d1d5db;
}

.btn-secondary:hover {
    border-color: var(--nubi-primary);
    color: var(--nubi-primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Cover Slide --- */
.cover-slide {
    text-align: center;
    padding: 50px 40px;
}

.cover-slide .highlight-box {
    max-width: 860px;
    margin: 28px auto 0;
    text-align: left;
}

.cover-slide .btn {
    margin: 24px auto 0;
}

.cover-slide .logo-main {
    margin-bottom: 30px;
}

.cover-slide .logo-main img {
    height: 80px;
    max-width: 100%;
}

.cover-slide h1 {
    font-size: 32px;
    color: var(--nubi-dark);
    margin-bottom: 15px;
    font-weight: 700;
}

.cover-slide > p {
    font-size: 16px;
    color: var(--nubi-gray);
    margin-bottom: 40px;
    line-height: 1.6;
}

.cover-slide .features {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.cover-slide .feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: white;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--nubi-border);
    font-size: 14px;
    color: var(--nubi-dark);
}

.cover-slide .feature .check {
    width: 22px;
    height: 22px;
    background: var(--nubi-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* --- Summary Grid --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 25px;
}

.summary-card {
    background: var(--nubi-light);
    border-radius: 12px;
    padding: 22px;
    border-left: 4px solid var(--nubi-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.summary-card h3 {
    font-size: 15px;
    color: var(--nubi-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.summary-card ul {
    list-style: none;
}

.summary-card ul li {
    padding: 6px 0;
    color: var(--nubi-dark);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.summary-card ul li::before {
    content: '>';
    color: var(--nubi-primary);
    font-weight: 700;
    flex-shrink: 0;
}

/* --- Footer --- */
.footer {
    background: white;
    padding: 20px 40px;
    text-align: center;
    color: var(--nubi-gray);
    font-size: 12px;
    border-top: 1px solid var(--nubi-border);
}

/* --- Index Page (catalogue) --- */
.index-container {
    max-width: 1000px;
    width: 100%;
    padding: 40px 20px;
    margin: 0 auto;
}

.index-container h2 {
    font-size: 24px;
    color: var(--nubi-dark);
    margin-bottom: 8px;
    font-weight: 700;
}

.index-container > p {
    color: var(--nubi-gray);
    font-size: 15px;
    margin-bottom: 30px;
}

.guide-search {
    margin-bottom: 24px;
}

.guide-search input {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--nubi-border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--nubi-dark);
    background: var(--nubi-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.guide-search input:focus {
    outline: none;
    border-color: var(--nubi-primary);
    box-shadow: 0 0 0 3px var(--nubi-shadow-primary);
}

.guide-search input::placeholder {
    color: #adb5bd;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.guide-card {
    background: var(--nubi-white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid var(--nubi-border);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.guide-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.guide-card-header {
    background: linear-gradient(135deg, var(--nubi-primary) 0%, var(--nubi-primary-dark) 100%);
    color: white;
    padding: 20px 24px;
}

.guide-card-header h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.guide-card-body {
    padding: 20px 24px;
}

.guide-card-body p {
    font-size: 14px;
    color: var(--nubi-gray);
    line-height: 1.6;
    margin-bottom: 16px;
}

.guide-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--nubi-gray);
}

.guide-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- Neural Background --- */
.neural-field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.25;
}

.neural-field svg {
    width: 100%;
    height: 100%;
}

.header,
.progress-container,
.main-content,
.footer {
    position: relative;
    z-index: 1;
}

.neural-line {
    stroke: rgba(56, 89, 208, 0.78);
    stroke-width: 1.6;
    opacity: 0.16;
    filter: url(#lineGlow);
    animation: linePulse 9s ease-in-out infinite;
}

.neural-line.line-delay-1 { animation-delay: 2s; }
.neural-line.line-delay-2 { animation-delay: 5s; }
.neural-line.line-delay-3 { animation-delay: 9s; }

.neural-trace {
    fill: none;
    stroke: rgba(34, 211, 238, 0.95);
    stroke-width: 2.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 260 1400;
    opacity: 0.45;
    filter: url(#traceGlow);
    animation: traceFlow 6.5s linear infinite;
}

.neural-trace.trace-alt {
    stroke: rgba(99, 102, 241, 0.9);
    stroke-width: 2.1;
    stroke-dasharray: 200 1400;
    opacity: 0.34;
    animation-duration: 9s;
    animation-delay: -4s;
}

.neural-node {
    opacity: 0.2;
    transform-origin: center;
    transform-box: fill-box;
    animation: nodePulse 6.5s ease-in-out infinite;
    filter: url(#nodeSoftGlow);
}

.neural-node.node-delay-1 { animation-delay: 1s; }
.neural-node.node-delay-2 { animation-delay: 2.8s; }
.neural-node.node-delay-3 { animation-delay: 4.6s; }
.neural-node.node-delay-4 { animation-delay: 6s; }
.neural-node.accent { opacity: 0.14; }

@keyframes nodePulse {
    0%, 100% { transform: scale(0.86); opacity: 0.12; }
    45% { transform: scale(1.05); opacity: 0.32; }
    70% { transform: scale(0.92); opacity: 0.22; }
}

@keyframes linePulse {
    0%, 100% { opacity: 0.06; }
    50% { opacity: 0.22; }
}

@keyframes traceFlow {
    0% { stroke-dashoffset: 0; opacity: 0.08; }
    30% { opacity: 0.55; }
    100% { stroke-dashoffset: -1800; opacity: 0.06; }
}

/* --- Print Styles --- */
@media print {
    body {
        background: white;
    }

    .neural-field {
        display: none;
    }

    .header, .progress-container, .navigation, .footer {
        display: none;
    }

    .main-content {
        padding: 0;
    }

    .slide {
        display: block !important;
        page-break-after: always;
        animation: none;
    }

    .slide:last-child {
        page-break-after: auto;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .screenshot-container {
        box-shadow: none;
        page-break-inside: avoid;
    }

    .screenshot-container img {
        max-height: 500px;
        object-fit: contain;
    }

    .instruction-list li {
        page-break-inside: avoid;
    }

    .highlight-box {
        page-break-inside: avoid;
    }

    .summary-card {
        page-break-inside: avoid;
    }

    .cover-slide {
        page-break-after: always;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-spacer {
        display: none;
    }

    .progress-bar {
        flex-direction: column;
        gap: 15px;
    }

    .progress-bar::before,
    .progress-line {
        display: none;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .cover-slide .features {
        flex-direction: column;
        align-items: center;
    }

    .navigation {
        flex-direction: column;
    }

    .main-content {
        padding: 20px;
    }

    .card-body {
        padding: 20px;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }
}
