/* ==========================================================================
   Base Visibility rules for static HTML cards
   ========================================================================== */
.lrnx-portal-v2-info-panel {
    display: none !important;
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

.lrnx-portal-v2-info-panel.lrnx-active {
    display: grid !important;
    visibility: visible;
    height: auto;
    overflow: visible;
}

body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Hero Banner Section Styles
   ========================================================================== */
.lrnx-portal-v2-banner-container {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 550px;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    overflow: hidden;
    box-sizing: border-box;
}

.lrnx-portal-v2-banner-graphic {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.lrnx-portal-v2-banner-graphic svg {
    width: 100%;
    height: 100%;
}

.lrnx-portal-v2-banner-graphic svg polygon {
    will-change: transform;
}

.lrnx-portal-v2-banner-graphic svg polygon:nth-of-type(1) {
    animation: lrnxPortalDrift1 22s ease-in-out infinite alternate;
    transform-origin: center;
}
.lrnx-portal-v2-banner-graphic svg polygon:nth-of-type(2) {
    animation: lrnxPortalDrift2 18s ease-in-out infinite alternate;
    transform-origin: center;
}
.lrnx-portal-v2-banner-graphic svg polygon:nth-of-type(3) {
    animation: lrnxPortalDrift3 26s ease-in-out infinite alternate;
    transform-origin: center;
}
.lrnx-portal-v2-banner-graphic svg polygon:nth-of-type(4) {
    animation: lrnxPortalDrift4 20s ease-in-out infinite alternate;
    transform-origin: center;
}
.lrnx-portal-v2-banner-graphic svg polygon:nth-of-type(5) {
    animation: lrnxPortalDrift5 24s ease-in-out infinite alternate;
    transform-origin: center;
}

@keyframes lrnxPortalDrift1 { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.02) translate(10px, -5px); } }
@keyframes lrnxPortalDrift2 { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(0.98) translate(-12px, 8px); } }
@keyframes lrnxPortalDrift3 { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.03) translate(-8px, -10px); } }
@keyframes lrnxPortalDrift4 { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(0.97) translate(15px, 5px); } }
@keyframes lrnxPortalDrift5 { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.01) translate(-5px, 12px); } }

.lrnx-portal-v2-banner-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 650px;
    padding-left: 8%;
    padding-right: 20px;
    box-sizing: border-box;
}

.lrnx-portal-v2-banner-title {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.15;
    margin-top: 0;
    margin-bottom: 20px;
    letter-spacing: -1.5px;
    opacity: 0;
    transform: translateY(25px);
    animation: lrnxPortalReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

.lrnx-portal-v2-banner-title .lrnx-portal-v2-brand-accent {
    color: #FF8F00;
}

.lrnx-portal-v2-banner-title .lrnx-portal-v2-brand-main {
    color: #124072;
}

.lrnx-portal-v2-banner-desc {
    font-size: 18px;
    color: #4a5560;
    line-height: 1.65;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(25px);
    animation: lrnxPortalReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.lrnx-portal-v2-banner-btn-container {
    display: flex;
    gap: 16px;
    opacity: 0;
    transform: translateY(25px);
    animation: lrnxPortalReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

@keyframes lrnxPortalReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lrnx-portal-v2-btn-primary {
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background-color: #124072;
    border: 2px solid #124072;
    border-radius: 8px;
    text-decoration: none;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px rgba(18, 64, 114, 0.18);
    overflow: hidden;
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lrnx-portal-v2-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #FF8F00;
    z-index: -1;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lrnx-portal-v2-btn-primary:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.lrnx-portal-v2-btn-primary:hover {
    border-color: #FF8F00;
    transform: translateY(-3px);
    box-shadow: 0 6px 22px rgba(255, 143, 0, 0.35);
}

/* ==========================================================================
   Structural Wrapper
   ========================================================================== */
.lrnx-portal-v2-wrapper {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 200px 20px;
    box-sizing: border-box;
}

/* Main Grid Layout - Forces equal column heights and prevents grid blowout */
.lrnx-portal-v2-main-layout {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 30px;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    align-items: stretch;
}

/* ==========================================================================
   Side Drawer Styles
   ========================================================================== */
.lrnx-portal-v2-side-drawer {
    background: #124072;
    border-radius: 16px;
    padding: 30px 20px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 8px rgb(0 0 0 / .15);
    box-sizing: border-box;
    height: 100%;
    min-height: 580px;
}

.lrnx-portal-v2-drawer-header {
    margin-bottom: 24px;
    padding: 0 8px;
}

.lrnx-portal-v2-drawer-header h2 {
    font-size: 11px;
    letter-spacing: 2px;
    color: #6AB0FD;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    display: none;
}

.lrnx-portal-v2-drawer-header p {
    font-size: 27px;
    font-weight: 800;
    margin: 0;
    text-align: center;
    position: relative;
    top: 4px;
}

.lrnx-portal-v2-role-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
    position: relative;
    top: 25px;
}

.lrnx-portal-v2-role-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
}

.lrnx-portal-v2-role-btn i {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6AB0FD;
    font-size: 13px;
    transition: color 0.3s;
}

.lrnx-portal-v2-role-btn span {
    font-size: 13.5px;
    font-weight: 600;
}

.lrnx-portal-v2-role-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.lrnx-portal-v2-role-btn.lrnx-portal-v2-active {
    background: #ffffff;
    color: #124072;
    border-left: 4px solid #FF8F00;
}

.lrnx-portal-v2-role-btn.lrnx-portal-v2-active i {
    color: #124072;
}

/* ==========================================================================
   Roles Presentation Area (With refined subtle shadow and transitions)
   ========================================================================== */
.lrnx-portal-v2-profile-container {
    background: #ffffff;
    border-radius: 16px;
    padding: 35px;
    /* Soft premium shadow with subtle branding hint */
    box-shadow: 0 3px 8px rgb(0 0 0 / .15);
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#lrnx-portal-v2-dynamic-content {
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lrnx-portal-v2-fade-out {
    opacity: 0;
}

/* Internal Layout - Explicit minimum widths applied to columns */
.lrnx-portal-v2-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: stretch;
    height: 100%;
    flex-grow: 1;
}

.lrnx-portal-v2-profile-info-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lrnx-portal-v2-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.lrnx-portal-v2-profile-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: #124072;
    margin: 0;
}

.lrnx-portal-v2-role-badge {
    background: #f0f7ff;
    color: #2563eb;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.lrnx-portal-v2-role-description {
    font-size: 15px;
    color: #576574;
    line-height: 1.65;
    margin: 0 0 24px 0;
}

/* Standard HTML tables embedded inside descriptions */
.lrnx-portal-v2-profile-container table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

/* Credential Card Styles */
.lrnx-portal-v2-cred-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    border-top: 4px solid #FF8F00;
    margin-top: auto;
    box-sizing: border-box;
}

.lrnx-portal-v2-cred-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.lrnx-portal-v2-input-group label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.lrnx-portal-v2-input-wrap {
    position: relative;
    width: 100%;
}

.lrnx-portal-v2-input-wrap input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    text-overflow: ellipsis;
    color: #1e293b;
    font-family: monospace;
    font-weight: 600;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lrnx-portal-v2-input-wrap input:focus {
    border-color: #124072;
    box-shadow: 0 0 0 2px rgba(18, 64, 114, 0.15);
}

.lrnx-portal-v2-copy-trigger {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.lrnx-portal-v2-copy-trigger:hover {
    color: #FF8F00;
}

/* Link-Style Dashboard Button */
.lrnx-portal-v2-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #124072;
    color: #ffffff !important;
    text-decoration: none;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    width: 100%;
}

.lrnx-portal-v2-login-btn:hover {
    background: #0d3159;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18, 64, 114, 0.25);
}

/* ==========================================================================
   Image Showcase Slideshow
   ========================================================================== */
.lrnx-portal-v2-profile-image-side {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 100%;
}

.lrnx-portal-v2-image-box-container {
    width: 100%;
    height: 100%;
}

.lrnx-portal-v2-image-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    height: 100%;
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.lrnx-portal-v2-slide-track {
    display: flex;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lrnx-portal-v2-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
}

.lrnx-portal-v2-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Keeps natural aspect ratio, prevents zooming and stretching */
    display: block;
    transition: transform 0.4s ease;
}

.lrnx-portal-v2-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 64, 114, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 5;
}

.lrnx-portal-v2-slide:hover .lrnx-portal-v2-slide-overlay {
    opacity: 1;
}

.lrnx-portal-v2-slide:hover img {
    transform: scale(1.03);
}

.lrnx-portal-v2-overlay-btn {
    background-color: #ffffff;
    color: #124072;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lrnx-portal-v2-slider-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.lrnx-portal-v2-nav-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    color: #124072;
    transition: background 0.2s, transform 0.2s;
}

.lrnx-portal-v2-nav-btn:hover {
    background: #ffffff;
    transform: scale(1.05);
}

/* ==========================================================================
   Image Expand Modal View
   ========================================================================== */
.lrnx-portal-v2-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.85);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

.lrnx-portal-v2-modal-overlay.lrnx-portal-v2-show {
    display: flex;
    opacity: 1;
}

.lrnx-portal-v2-modal-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lrnx-portal-v2-modal-overlay.lrnx-portal-v2-show .lrnx-portal-v2-modal-img {
    transform: scale(1);
}

.lrnx-portal-v2-modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #ffffff;
    font-size: 32px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.lrnx-portal-v2-modal-close:hover {
    color: #FF8F00;
}

/* ==========================================================================
   Moodle / System Overrides compatibility
   ========================================================================== */
#page-theme-flexpath-roles header#page-header {
    display: none;
}

#page-theme-flexpath-roles #page.drawers .main-inner {
    max-width: 100%;
    width: 100%;
    margin: 0;
    background-color: #fff;
    padding: 0;
}

/* ==========================================================================
   Responsive Design Rules (Optimized & Polished)
   ========================================================================== */
@media (max-width: 1200px) {
    .lrnx-portal-v2-banner-title {
        font-size: 48px;
    }
    .lrnx-portal-v2-wrapper {
        padding: 120px 20px;
    }
}

@media (max-width: 1024px) {
    .lrnx-portal-v2-wrapper {
        padding: 80px 20px;
    }

    .lrnx-portal-v2-profile-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .lrnx-portal-v2-profile-image-side {
        order: -1; /* Place visual first on mid-size screens */
    }

    .lrnx-portal-v2-image-card {
        height: 400px;
        max-height: 50vh;
        min-height: auto;
    }
}

@media (max-width: 900px) {
    .lrnx-portal-v2-main-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    /* Transform side drawer into a swipeable, horizontal role bar */
    .lrnx-portal-v2-side-drawer {
        padding: 20px;
        min-height: auto;
        height: auto;
    }

    .lrnx-portal-v2-drawer-header p {
        position: static;
        top: 0;
    }

    .lrnx-portal-v2-role-list {
        flex-direction: row;
        overflow-x: auto;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        gap: 12px;
        position: static;
        top: 0;
        margin-top: 15px;
    }

    /* Webkit scrollbar optimizations for dynamic touch bars */
    .lrnx-portal-v2-role-list::-webkit-scrollbar {
        height: 4px;
    }
    
    .lrnx-portal-v2-role-list::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
    }
    
    .lrnx-portal-v2-role-list::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

    .lrnx-portal-v2-role-btn {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px 16px;
    }

    .lrnx-portal-v2-banner-title {
        font-size: 42px;
    }
}

@media (max-width: 768px) {
    /* Simplify the hero banner design by removing layered visuals */
    .lrnx-portal-v2-banner-graphic {
        display: none !important;
    }

    .lrnx-portal-v2-banner-container {
        height: auto;
        min-height: auto;
        padding: 60px 20px;
        background-color: #f8fafc;
    }

    .lrnx-portal-v2-banner-content {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .lrnx-portal-v2-banner-btn-container {
        flex-direction: column;
        gap: 12px;
    }

    .lrnx-portal-v2-btn-primary {
        width: 100%;
    }

    .lrnx-portal-v2-wrapper {
        padding: 40px 16px;
    }

    .lrnx-portal-v2-profile-container {
        padding: 24px;
    }

    /* Responsive table control inside active content to prevent overflow */
    .lrnx-portal-v2-profile-container table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .lrnx-portal-v2-image-card {
        height: 320px;
    }

    /* Keep popup images fully dynamic on tablet screens */
    .lrnx-portal-v2-modal-img {
        max-width: 95%;
        max-height: 85%;
    }

    .lrnx-portal-v2-modal-close {
        top: 15px;
        right: 15px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    /* Tight padding setup to fit table/layout exactly within bounds */
    .lrnx-portal-v2-wrapper {
        padding: 24px 10px !important;
    }

    .lrnx-portal-v2-profile-container {
        padding: 16px !important;
    }

    .lrnx-portal-v2-cred-card {
        padding: 16px !important;
    }

    .lrnx-portal-v2-banner-title {
        font-size: 32px;
    }

    .lrnx-portal-v2-banner-desc {
        font-size: 15px;
    }

    .lrnx-portal-v2-profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .lrnx-portal-v2-cred-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    
    .lrnx-portal-v2-image-card {
        height: 220px;
    }

    /* Scale popup to occupy near-maximum real estate on phone sizes */
    .lrnx-portal-v2-modal-img {
        max-width: 98%;
        max-height: 80%;
    }
}

@media (min-width: 768px) {
    body#page-theme-flexpath-roles #page.drawers {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}