/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --topbar-height: 40px;
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 0px;
    --bg-color: #f5f7fa;
    --panel-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Barra superior - personalizable */
    --topbar-bg: #374151;
    --topbar-text: #f9fafb;
    --topbar-text-secondary: #d1d5db;
    --topbar-border: #4b5563;
    --topbar-btn-bg: #4b5563;
    --topbar-btn-bg-hover: #6b7280;
    --topbar-btn-border: #6b7280;

    /* Sidebar derecho - personalizable */
    --sidebar-bg: #1e3a5f;
    --sidebar-text: #ffffff;
    --sidebar-text-secondary: #cbd5e1;
    --sidebar-border: #2d4a73;
    --sidebar-nav-hover: #2d4a73;
    --sidebar-nav-active: #3b82f6;
    --sidebar-nav-active-text: #ffffff;
    --sidebar-scrollbar-thumb: #4a6fa5;
    --sidebar-scrollbar-track: #163050;

    /* Personalizables en runtime (tema) */
    --sidebar-bg-style: var(--sidebar-bg);
    --topbar-bg-style: var(--topbar-bg);
    --frame-border-color: var(--sidebar-border);
    --frame-radius: 0.375rem;
    --frame-size-w: 110px;
    --frame-size-h: 140px;
    --content-bg: var(--bg-color);
  }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Barra superior */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg-style);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--topbar-text);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--topbar-btn-border);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--topbar-text);
    transition: background-color 0.2s ease;
    line-height: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--topbar-btn-bg);
}

.btn-pdf {
    background-color: var(--topbar-btn-bg);
    color: var(--topbar-text);
    border: 1px solid var(--topbar-btn-border);
    border-radius: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    height: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-pdf:hover {
    background-color: var(--topbar-btn-bg-hover);
}

.btn-login {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 24px;
    line-height: 1;
}

.btn-login:hover {
    background-color: var(--accent-hover);
}

/* Contenedor principal */
.app-container {
    display: flex;
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg-style);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    padding: 0.875rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.photo-frame {
    width: var(--frame-size-w);
    height: var(--frame-size-h);
    border: 2px solid var(--frame-border-color);
    border-radius: var(--frame-radius);
    overflow: hidden;
    margin-bottom: 0.625rem;
    box-shadow: var(--shadow);
    background-color: #163050;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sidebar-text);
    margin-bottom: 0.2rem;
    word-break: break-word;
    line-height: 1.3;
}

.profile-degree {
    font-size: 0.75rem;
    color: var(--sidebar-text-secondary);
    margin-bottom: 0.625rem;
    word-break: break-word;
    line-height: 1.3;
}

.profile-info {
    width: 100%;
    text-align: left;
    font-size: 0.7rem;
    color: var(--sidebar-text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    line-height: 1.35;
}

.profile-info p {
    word-break: break-word;
}

.profile-info strong {
    color: var(--sidebar-text);
}

/* Navegación lateral */
.nav-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-scrollbar-thumb) var(--sidebar-scrollbar-track);
}

.nav-scroll::-webkit-scrollbar {
    width: 8px;
}

.nav-scroll::-webkit-scrollbar-track {
    background: var(--sidebar-scrollbar-track);
}

.nav-scroll::-webkit-scrollbar-thumb {
    background-color: var(--sidebar-scrollbar-thumb);
    border-radius: 4px;
    border: 2px solid var(--sidebar-scrollbar-track);
}

.nav-btn {
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--sidebar-text);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    word-break: break-word;
    line-height: 1.25;
    height: 26px;
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background-color: var(--sidebar-nav-hover);
    border-color: var(--sidebar-nav-hover);
}

.nav-btn.active {
    background-color: var(--sidebar-nav-active);
    color: var(--sidebar-nav-active-text);
    border-color: var(--sidebar-nav-active);
    font-weight: 600;
}

/* Contenido principal */
.main-content {
    flex: 1;
    padding: 0.875rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    word-break: break-word;
    line-height: 1.2;
}

/* Cards */
.card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.625rem;
    word-break: break-word;
    line-height: 1.25;
}

.text-block {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.625rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.625rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.info-item strong {
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.info-item span {
    font-size: 0.775rem;
    color: var(--text-secondary);
    word-break: break-word;
    line-height: 1.35;
}

/* Job cards */
.job-card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
}

.job-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.job-logo {
    width: 56px;
    height: 56px;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f9fafb;
}

.job-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.job-info {
    flex: 1;
    min-width: 200px;
}

.job-company {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    word-break: break-word;
    line-height: 1.25;
}

.job-dates,
.job-position {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    word-break: break-word;
    line-height: 1.35;
}

.job-activities h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.activity-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.625rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

.activity-item h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
    line-height: 1.25;
}

.activity-item p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-word;
    line-height: 1.4;
}

/* Skill areas */
.skill-area {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
}

.skill-area-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-break: break-word;
    line-height: 1.25;
}

.skill-area-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
}

/* Botones toggle portfolios */
.btn-toggle-portfolios {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 0.75rem;
    height: 24px;
    line-height: 1;
}

.btn-toggle-portfolios:hover {
    background-color: var(--accent-hover);
}

/* Portfolios container */
.portfolios-container {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 0.75rem;
}

/* Portfolio item */
.portfolio-item {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.625rem 0.75rem;
}

.portfolio-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    word-break: break-word;
    line-height: 1.25;
}

.portfolio-desc {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.625rem;
    word-break: break-word;
    line-height: 1.4;
}

/* Galería */
.gallery {
    margin-top: 0.75rem;
}

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.gallery-thumb {
    width: 110px;
    height: 74px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    background-color: #f9fafb;
    flex-shrink: 0;
}

.gallery-thumb:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.75rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
    transition: background-color 0.2s ease;
}

.lightbox-close:hover {
    background: white;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
    transition: background-color 0.2s ease;
    user-select: none;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: white;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

#lightboxImg {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.375rem;
    display: block;
}

.lightbox-caption {
    color: white;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    max-width: 800px;
    word-break: break-word;
    padding: 0 1rem;
}

/* Responsive */
@media (max-width: 968px) {
    .main-content {
        padding: 0.75rem 0.875rem;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
        --topbar-height: 38px;
    }
    
    .topbar-title {
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 0.625rem 0.75rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .card h2 {
        font-size: 0.95rem;
    }
    
    .skill-area-title {
        font-size: 0.95rem;
    }
    
    .job-header {
        flex-direction: column;
    }
    
    .job-logo {
        align-self: center;
        width: 48px;
        height: 48px;
    }
    
    .job-info {
        width: 100%;
        text-align: center;
    }
    
    .gallery-thumbs {
        justify-content: center;
    }
    
    .gallery-thumb {
        width: 96px;
        height: 64px;
    }
    
    .lightbox-prev {
        left: 0.25rem;
    }
    
    .lightbox-next {
        right: 0.25rem;
    }
    
    .lightbox-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 0.5rem;
    }
    
    .btn-pdf {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
        height: 22px;
    }
    
    .btn-login {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
        height: 22px;
    }

.btn-icon {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
        height: 22px;
    }
    
    .gallery-thumb {
        width: 84px;
        height: 56px;
    }
}

/* ===== Herramientas: catálogo de etiquetas ===== */
.tools-intro {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--bg-color);
    border-left: 3px solid var(--accent-color);
    border-radius: 0.375rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.75rem;
}

.tool-tag {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tool-tag:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.tool-tag-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.tool-tag-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tool-tag-icon-ph {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
}

.tool-tag-info {
    min-width: 0;
}

.tool-tag-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    word-break: break-word;
    line-height: 1.25;
}

.tool-tag-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}