/* =========================================
   PFOMC - PERFIL DE USUARIO
   ========================================= */

:root {
    --pfomc-burgundy: #710000;
    --pfomc-orange: #EE6730;
    --pfomc-blue: #43B5E7;

    --bg-main: #06101f;
    --bg-deep: #030915;
    --bg-panel: #0b1727;
    --bg-panel-soft: #101f32;

    --text-main: #f8fafc;
    --text-soft: #cbd5e1;
    --text-muted: #8fa1b5;

    --border: rgba(255,255,255,0.12);
    --border-strong: rgba(255,255,255,0.20);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;

    --shadow-card:
        0 18px 45px rgba(0, 0, 0, 0.32);
}


/* =========================================
   RESET
   ========================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at 15% 10%,
            rgba(113, 0, 0, 0.24),
            transparent 32%
        ),
        radial-gradient(
            circle at 88% 18%,
            rgba(67, 181, 231, 0.10),
            transparent 30%
        ),
        linear-gradient(
            180deg,
            var(--bg-main),
            var(--bg-deep)
        );

    color: var(--text-main);
}


/* =========================================
   PAGE
   ========================================= */

.profile-page {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
}


/* =========================================
   HEADER
   ========================================= */

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 32px;

    padding: 26px 48px;

    background:
        linear-gradient(
            135deg,
            rgba(113, 0, 0, 0.96),
            rgba(47, 5, 12, 0.96)
        );

    border-bottom:
        1px solid rgba(238, 103, 48, 0.32);

    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.28);
}

.brand-kicker {
    color: var(--pfomc-orange);

    font-size: 0.78rem;
    font-weight: 800;

    letter-spacing: 0.14em;
    text-transform: uppercase;

    margin-bottom: 6px;
}

.profile-header h1 {
    margin: 0;

    font-size: clamp(
        1.8rem,
        3vw,
        2.65rem
    );

    line-height: 1.05;
}

.profile-header p {
    margin: 8px 0 0;

    color: rgba(255,255,255,0.76);

    font-size: 0.96rem;
}

.profile-header-actions {
    display: flex;
    align-items: center;

    gap: 10px;
}

.header-button {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 16px;

    border-radius: 999px;

    text-decoration: none;

    font-size: 0.86rem;
    font-weight: 750;

    border: 1px solid transparent;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.header-button:hover {
    transform: translateY(-1px);
}

.header-button.secondary {
    color: white;

    background:
        rgba(255,255,255,0.08);

    border-color:
        rgba(255,255,255,0.18);
}

.header-button.secondary:hover {
    background:
        rgba(255,255,255,0.14);
}

.header-button.danger {
    color: white;

    background:
        rgba(239, 68, 68, 0.14);

    border-color:
        rgba(239, 68, 68, 0.34);
}

.header-button.danger:hover {
    background:
        rgba(239, 68, 68, 0.22);
}


/* =========================================
   MAIN
   ========================================= */

.profile-main {
    width: min(1180px, calc(100% - 48px));

    margin: 0 auto;

    padding: 34px 0 42px;

    display: grid;

    gap: 24px;
}


/* =========================================
   IDENTITY CARD
   ========================================= */

.identity-card {
    display: flex;
    align-items: center;

    gap: 22px;

    padding: 24px;

    border-radius: var(--radius-lg);

    border: 1px solid var(--border);

    background:
        linear-gradient(
            145deg,
            rgba(16, 31, 50, 0.96),
            rgba(8, 20, 35, 0.96)
        );

    box-shadow: var(--shadow-card);
}

.identity-avatar {
    width: 78px;
    height: 78px;

    flex: 0 0 78px;

    display: grid;
    place-items: center;

    border-radius: 22px;

    font-size: 2.25rem;

    background:
        linear-gradient(
            145deg,
            rgba(238, 103, 48, 0.22),
            rgba(67, 181, 231, 0.12)
        );

    border:
        1px solid rgba(238, 103, 48, 0.32);
}

.identity-data {
    min-width: 0;
}

.identity-label {
    display: block;

    color: var(--pfomc-blue);

    font-size: 0.72rem;
    font-weight: 800;

    letter-spacing: 0.14em;
    text-transform: uppercase;

    margin-bottom: 4px;
}

.identity-data h2 {
    margin: 0 0 8px;

    font-size: clamp(
        1.45rem,
        2.6vw,
        2rem
    );
}

.identity-meta,
.identity-contact {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;

    color: var(--text-soft);

    font-size: 0.92rem;
}

.identity-contact {
    margin-top: 4px;

    color: var(--text-muted);
}

.meta-separator {
    color: var(--pfomc-orange);
}


/* =========================================
   METRICS
   ========================================= */

.metrics-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;
}

.metric-card {
    min-height: 150px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    padding: 20px;

    border-radius: var(--radius-md);

    border:
        1px solid var(--border);

    background:
        linear-gradient(
            150deg,
            rgba(15, 31, 49, 0.98),
            rgba(8, 20, 34, 0.98)
        );

    box-shadow:
        0 14px 30px rgba(0,0,0,0.20);

    position: relative;

    overflow: hidden;
}

.metric-card::before {
    content: "";

    position: absolute;

    left: 0;
    top: 0;
    bottom: 0;

    width: 4px;

    background:
        linear-gradient(
            180deg,
            var(--pfomc-orange),
            var(--pfomc-blue)
        );
}

.metric-label {
    color: var(--text-muted);

    font-size: 0.73rem;
    font-weight: 800;

    letter-spacing: 0.12em;
}

.metric-card strong {
    display: block;

    margin-top: 10px;

    font-size: clamp(
        2rem,
        4vw,
        3rem
    );

    line-height: 1;

    color: white;
}

.metric-card small {
    margin-top: 8px;

    color: var(--text-muted);

    font-size: 0.82rem;
}


/* =========================================
   SECTION COMMON
   ========================================= */

.competency-summary,
.history-panel {
    border-radius: var(--radius-lg);

    border:
        1px solid var(--border);

    background:
        rgba(10, 24, 40, 0.94);

    box-shadow:
        0 15px 34px rgba(0,0,0,0.22);
}

.competency-summary {
    padding: 24px;
}

.history-panel {
    overflow: hidden;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.section-kicker {
    display: block;

    color: var(--pfomc-orange);

    font-size: 0.7rem;
    font-weight: 800;

    letter-spacing: 0.14em;
    text-transform: uppercase;

    margin-bottom: 4px;
}

.section-heading h2 {
    margin: 0;

    font-size: 1.35rem;
}

.section-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;

    padding: 0 15px;

    border-radius: 999px;

    color: white;

    background:
        rgba(238, 103, 48, 0.14);

    border:
        1px solid rgba(238, 103, 48, 0.34);

    text-decoration: none;

    font-size: 0.85rem;
    font-weight: 750;

    transition:
        background 0.18s ease,
        transform 0.18s ease;
}

.section-action:hover {
    background:
        rgba(238, 103, 48, 0.22);

    transform:
        translateY(-1px);
}


/* =========================================
   COMPETENCY STATS
   ========================================= */

.competency-stats {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 14px;

    margin-top: 22px;
}

.competency-stat {
    padding: 18px;

    border-radius: var(--radius-md);

    background:
        var(--bg-panel-soft);

    border:
        1px solid var(--border);
}

.competency-stat span {
    display: block;

    color: var(--text-muted);

    font-size: 0.76rem;
    font-weight: 700;

    margin-bottom: 8px;
}

.competency-stat strong {
    font-size: 1.8rem;

    color: var(--pfomc-blue);
}


/* =========================================
   HISTORY
   ========================================= */

.history-panel .section-heading {
    padding: 22px 24px;
}

.history-table-wrapper {
    width: 100%;

    overflow-x: auto;
}

.history-table {
    width: 100%;

    border-collapse: collapse;
}

.history-table thead {
    background:
        rgba(113, 0, 0, 0.34);
}

.history-table th {
    padding: 13px 18px;

    color: var(--text-soft);

    font-size: 0.72rem;
    font-weight: 800;

    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;

    border-bottom:
        1px solid var(--border);
}

.history-table td {
    padding: 15px 18px;

    color: var(--text-soft);

    font-size: 0.9rem;

    border-bottom:
        1px solid rgba(255,255,255,0.07);
}

.history-table tbody tr {
    transition:
        background 0.15s ease;
}

.history-table tbody tr:hover {
    background:
        rgba(67, 181, 231, 0.05);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

#emptyHistoryRow td {
    padding: 34px 18px;

    color: var(--text-muted);

    text-align: center;
}


/* =========================================
   SCORE STATES FOR JS
   ========================================= */

.score-high {
    color: var(--success) !important;
}

.score-medium {
    color: var(--warning) !important;
}

.score-low {
    color: var(--danger) !important;
}


/* =========================================
   FOOTER
   ========================================= */

.profile-footer {
    margin-top: auto;

    padding: 20px 24px;

    text-align: center;

    color: var(--text-muted);

    font-size: 0.78rem;

    border-top:
        1px solid rgba(255,255,255,0.06);
}


/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 900px) {

    .profile-header {
        padding:
            22px 24px;
    }

    .profile-main {
        width:
            min(100% - 32px, 1180px);
    }

    .metrics-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 650px) {

    .profile-header {
        align-items: flex-start;
        flex-direction: column;

        gap: 18px;
    }

    .profile-header-actions {
        width: 100%;
    }

    .header-button {
        flex: 1;
    }

    .identity-card {
        align-items: flex-start;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .competency-stats {
        grid-template-columns: 1fr;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-action {
        width: 100%;
    }

}

@media (max-width: 460px) {

    .profile-main {
        width:
            calc(100% - 22px);

        padding-top: 20px;
    }

    .identity-card {
        flex-direction: column;
    }

    .profile-header-actions {
        flex-direction: column;
    }

    .header-button {
        width: 100%;
    }

}