/* ========================================
   ESCO Skills Explorer - CSS
   ======================================== */

:root {
    --esco-blue-dark: #003399;
    --esco-blue: #0056b3;
    --esco-blue-light: #4d94ff;
    --esco-yellow: #ffcc00;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: linear-gradient(135deg, var(--esco-blue-dark) 0%, #001a4d 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.eu-flag {
    width: 48px;
    height: 32px;
    background: var(--esco-blue-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

    .eu-flag::before {
        content: '?';
        color: var(--esco-yellow);
        font-size: 20px;
    }

.title-section h1 {
    font-size: 1.375rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--esco-yellow);
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

/* ========================================
   CONTENT LAYOUT
   ======================================== */
.content-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 30px;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
}

/* ========================================
   DETAIL PANEL
   ======================================== */
.detail-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 90px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.detail-placeholder {
    padding: 50px 30px;
    text-align: center;
    color: var(--gray-400);
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .placeholder-icon svg {
        width: 28px;
        height: 28px;
    }

.detail-placeholder h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.detail-placeholder p {
    font-size: 0.875rem;
}

.detail-content {
    animation: fadeIn 0.2s ease;
}

    .detail-content.loading {
        opacity: 0.5;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.detail-header {
    background: linear-gradient(135deg, var(--esco-blue-dark), var(--esco-blue));
    color: white;
    padding: 24px;
}

.detail-type {
    display: inline-block;
    background: rgba(255,204,0,0.2);
    color: var(--esco-yellow);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.detail-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.detail-body {
    padding: 20px 24px;
}

.detail-section {
    margin-bottom: 20px;
}

    .detail-section:last-child {
        margin-bottom: 0;
    }

.section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.detail-body p {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.alt-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.alt-label {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.scope-note {
    font-style: italic;
    color: var(--gray-600);
    padding-left: 12px;
    border-left: 3px solid var(--esco-yellow);
}

.skill-type-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
}

    .skill-type-badge.skill {
        background: #dbeafe;
        color: #1e40af;
    }

    .skill-type-badge.knowledge {
        background: #dcfce7;
        color: #166534;
    }

.reusability-level {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reusability-bar {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.reusability-fill {
    height: 100%;
    border-radius: 3px;
}

    .reusability-fill.transversal {
        background: var(--esco-yellow);
        width: 100%;
    }

    .reusability-fill.cross-sectoral {
        background: var(--esco-blue-light);
        width: 75%;
    }

    .reusability-fill.sector-specific {
        background: #34d399;
        width: 50%;
    }

    .reusability-fill.occupation-specific {
        background: #f472b6;
        width: 25%;
    }

.reusability-text {
    font-size: 0.75rem;
    color: var(--gray-600);
    min-width: 100px;
}

.detail-uri-section {
    background: var(--gray-50);
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 16px;
}

.uri-link {
    font-size: 0.75rem;
    color: var(--esco-blue);
    word-break: break-all;
    text-decoration: none;
}

    .uri-link:hover {
        text-decoration: underline;
    }

/* ========================================
   ACCORDION PANEL
   ======================================== */
.accordion-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.accordion-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

    .accordion-header h2 {
        font-size: 1rem;
        font-weight: 600;
        color: var(--gray-800);
    }

.breadcrumb {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 6px;
}

/* Small inline loader */
.main-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--gray-500);
    font-size: 0.875rem;
}

    .main-loader .spinner {
        width: 20px;
        height: 20px;
        border: 2px solid var(--gray-200);
        border-top-color: var(--esco-blue);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.accordion-container {
    padding: 16px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

/* ========================================
   ACCORDION ITEMS
   ======================================== */
.accordion-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .accordion-item:hover {
        border-color: var(--esco-blue-light);
    }

    .accordion-item.active {
        border-color: var(--esco-blue);
    }

        .accordion-item.active > .accordion-trigger {
            background: rgba(0,51,153,0.05);
        }

    .accordion-item.leaf.selected {
        border-color: var(--esco-yellow);
        background: rgba(255,204,0,0.08);
    }

.accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

    .accordion-trigger:hover {
        background: var(--gray-50);
    }

.accordion-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}

    .accordion-icon.group {
        background: linear-gradient(135deg, var(--esco-blue), var(--esco-blue-dark));
    }

    .accordion-icon.skill {
        background: linear-gradient(135deg, var(--esco-yellow), #fbbf24);
    }

    .accordion-icon svg {
        width: 16px;
        height: 16px;
        color: white;
    }

.accordion-item.active > .accordion-trigger .accordion-icon.group {
    transform: rotate(90deg);
}

.accordion-label {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.accordion-count {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.accordion-item.active > .accordion-trigger .accordion-count {
    background: var(--esco-blue);
    color: white;
}

.accordion-content {
    display: none;
    padding: 0 12px 12px;
    background: var(--gray-50);
}

.accordion-item.active > .accordion-content {
    display: block;
}

.accordion-children {
    padding-left: 16px;
    border-left: 2px solid var(--gray-200);
    margin-left: 16px;
}

/* Loading inline within accordion */
.loading-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--gray-400);
    font-size: 0.8rem;
}

    .loading-inline .spinner {
        width: 16px;
        height: 16px;
        border: 2px solid var(--gray-200);
        border-top-color: var(--esco-blue);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

.no-children {
    padding: 16px;
    color: var(--gray-400);
    font-size: 0.8rem;
    text-align: center;
}

.error-message {
    padding: 40px;
    text-align: center;
    color: var(--gray-600);
}

    .error-message button {
        margin-top: 16px;
        padding: 8px 20px;
        background: var(--esco-blue);
        color: white;
        border: none;
        border-radius: var(--radius);
        cursor: pointer;
    }

        .error-message button:hover {
            background: var(--esco-blue-dark);
        }

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--gray-400);
    }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 992px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        position: static;
        order: 2;
        max-height: none;
    }

    .accordion-panel {
        order: 1;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .logo-section {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .header-content {
        padding: 12px 16px;
    }

    .content-wrapper {
        padding: 16px;
    }

    .title-section h1 {
        font-size: 1.125rem;
    }
}

/* ========================================
   OBSOLETE SECTION STYLES
   ======================================== */
.obsolete-section,
.obsolete-subsection {
    margin-top: 12px;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.obsolete-toggle,
.obsolete-subtoggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-500);
    transition: all 0.2s;
}

    .obsolete-toggle:hover,
    .obsolete-subtoggle:hover {
        background: var(--gray-100);
        color: var(--gray-700);
    }

.obsolete-icon {
    width: 18px;
    height: 18px;
    color: #f59e0b;
    flex-shrink: 0;
}

.obsolete-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.2s;
}

.obsolete-section.expanded .obsolete-chevron,
.obsolete-subsection.expanded .obsolete-chevron {
    transform: rotate(90deg);
}

.obsolete-content,
.obsolete-subcontent {
    display: none;
    padding: 0 12px 12px;
}

.obsolete-section.expanded .obsolete-content,
.obsolete-subsection.expanded .obsolete-subcontent {
    display: block;
}

.obsolete-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.8125rem;
    color: #92400e;
}

.obsolete-children .accordion-item,
.obsolete-subcontent .accordion-item,
.obsolete-item {
    opacity: 0.7;
}

    .obsolete-children .accordion-trigger,
    .obsolete-subcontent .accordion-trigger,
    .obsolete-item .accordion-trigger {
        background: #fefce8;
        border-color: #fde68a;
    }

        .obsolete-children .accordion-trigger:hover,
        .obsolete-subcontent .accordion-trigger:hover,
        .obsolete-item .accordion-trigger:hover {
            background: #fef9c3;
            border-color: #fcd34d;
        }

.detail-type.obsolete {
    background: #fef3c7 !important;
    color: #92400e !important;
}

/* Smaller subsection toggle */
.obsolete-subtoggle {
    padding: 8px 12px;
    font-size: 0.8125rem;
}

.obsolete-subsection {
    margin-top: 8px;
    margin-left: 20px;
}
