:root {
    --bg-gradient-1: #0f2027;
    --bg-gradient-2: #203a43;
    --bg-gradient-3: #2c5364;
    --primary-green: #00b09b;
    --accent-blue: #96c93d;
    --danger: #e74c3c;
    --glass-bg: rgba(255, 255, 255, .1);
    --glass-border: rgba(255, 255, 255, .2);
    --text-main: #ecf0f1;
    --text-muted: #bdc3c7;
    --sidebar-width: 280px
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: linear-gradient(-45deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3), #1a4a5a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    display: flex;
    height: 100vh;
    overflow: hidden
}

h1,
h2 {
    font-weight: 300;
    letter-spacing: 1px
}

h2 {
    color: var(--primary-green);
    margin-top: 0
}

a {
    text-decoration: none;
    color: inherit
}

main {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start
}

.view-section {
    display: none;
    width: 100%;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
    animation: fadeIn .5s ease-out
}

.view-section.active {
    display: block
}

#view-home.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden
}

aside {
    width: var(--sidebar-width);
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem;
    display: none;
    flex-direction: column;
    gap: 2rem;
    box-shadow: 5px 0 15px rgba(0, 0, 0, .3)
}

aside.active {
    display: flex
}

.brand {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(to right, var(--primary-green), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, .37);
    animation: slideIn .6s ease-out
}

.hero-card {
    max-width: 1000px;
    text-align: center;
    background: rgba(15, 32, 39, .7);
    backdrop-filter: blur(20px);
    z-index: 10
}

button {
    padding: 1rem;
    border: 1px solid var(--primary-green);
    background: rgba(0, 176, 155, .1);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: .3s
}

button:hover {
    background: var(--primary-green);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 176, 155, .4)
}

.cta-btn {
    background: linear-gradient(90deg, var(--primary-green), var(--accent-blue));
    padding: 1.2rem 3rem;
    font-weight: bold;
    border: none
}

.metric-container {
    margin-bottom: 1.5rem
}

.metric-label {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
    margin-bottom: .5rem
}

.progress-track {
    background: rgba(0, 0, 0, .5);
    height: 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, .1);
    overflow: hidden
}

.progress-fill {
    height: 100%;
    width: 0%;
    transition: width .6s cubic-bezier(.34, 1.56, .64, 1);
    position: relative
}

.progress-fill.tech {
    background: linear-gradient(90deg, #3498db, #9b59b6);
    box-shadow: 0 0 15px rgba(52, 152, 219, .6)
}

.progress-fill.safe {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    box-shadow: 0 0 10px rgba(46, 204, 113, .4)
}

.progress-fill.warning {
    background: linear-gradient(90deg, #f1c40f, #e67e22);
    box-shadow: 0 0 15px rgba(230, 126, 34, .6)
}

.progress-fill.critical {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    animation: pulse-critical 1s infinite alternate
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all
}

.modal-content {
    background: linear-gradient(135deg, #1e2a33, #0f2027);
    border: 2px solid var(--primary-green);
    padding: 2.5rem;
    border-radius: 20px;
    max-width: 500px;
    transform: scale(.8);
    transition: transform .3s cubic-bezier(.175, .885, .32, 1.275)
}

.modal-overlay.active .modal-content {
    transform: scale(1)
}

.impact-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, .3);
    padding: 10px;
    border-radius: 10px;
    margin: 1.5rem 0;
    font: bold 1.1rem monospace
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem
}

.quizz-choices {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0
}

.menu-item,
.chapter-card,
.visual-column,
.ref-link-item {
    transition: .3s;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 16px;
    cursor: pointer
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem
}

.menu-item:hover,
.chapter-card:hover,
.ref-link-item:hover {
    background: rgba(0, 176, 155, .2);
    transform: translateY(-5px);
    border-color: var(--primary-green)
}

.menu-item .icon {
    font-size: 3rem;
    margin-bottom: 1rem
}

.scenario-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center
}

.visual-column {
    position: relative;
    height: 400px;
    background-color: rgba(0, 0, 0, .2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0
}

.visual-column img,
.subsection-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: fadeInImg .5s ease forwards
}

.ceo-request {
    font-style: italic;
    border-left: 4px solid var(--accent-blue);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #fff;
    font-size: 1.1rem
}

#lesson-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 5rem
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem
}

.chapter-card {
    border-left: 5px solid transparent;
    position: relative;
    overflow: hidden
}

.chapter-card:hover {
    border-left-color: var(--primary-green)
}

.chapter-number {
    font-size: 4rem;
    position: absolute;
    top: -10px;
    right: 10px;
    color: rgba(255, 255, 255, .05);
    font-weight: bold
}

.lesson-header {
    text-align: center;
    margin-bottom: 4rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1)
}

.lesson-header h1 {
    font-size: 3rem;
    color: var(--primary-green)
}

.subsection {
    margin-bottom: 5rem
}

.subsection-visual {
    width: 100%;
    height: 250px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, .1)
}

.subsection-text h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    border-left: 5px solid var(--primary-green);
    padding-left: 1rem
}

.md-content {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #e0e0e0;
    max-width: 900px;
    margin: 0 auto
}

.md-content p,
.md-content ul {
    margin-bottom: 1.5rem
}

.md-content li::marker {
    color: var(--primary-green)
}

.md-content strong {
    color: white;
    font-weight: 700
}

.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 1rem;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    /* Glassmorphism base */
}

.md-content thead {
    background-color: rgba(0, 176, 155, 0.2);
    /* Primary green tint */
}

.md-content th,
.md-content td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.md-content th {
    color: var(--primary-green);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.md-content tbody tr {
    transition: background-color 0.3s ease;
}

.md-content tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.md-content tbody tr:last-of-type {
    border-bottom: 2px solid var(--primary-green);
}

.alert {
    padding: 1rem;
    margin: 0 0 1.5rem 0;
    border-left: 5px solid;
    border-radius: 8px;
    background: rgba(255, 255, 255, .05)
}

.alert-title {
    font-weight: bold;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .5rem
}

.alert-note {
    border-color: #3498db;
    background: rgba(52, 152, 219, .1);
    color: #3498db
}

.alert-tip {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, .1);
    color: #2ecc71
}

.alert-important {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, .1);
    color: #9b59b6
}

.alert-warning {
    border-color: #f1c40f;
    background: rgba(241, 196, 15, .1);
    color: #f1c40f
}

.alert-caution {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, .1);
    color: #e74c3c
}

.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto
}

.ref-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1)
}

.ref-icon {
    font-size: 2rem
}

.ref-link-item {
    display: block;
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid transparent;
    margin-bottom: 1rem
}

#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 450px;
    height: 600px;
    background: #1e2a33;
    border: 1px solid var(--primary-green);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
    z-index: 1000;
    transform: translateY(110%);
    transition: transform .4s cubic-bezier(.175, .885, .32, 1.275);
}

#chatbot-widget.active {
    transform: translateY(0)
}

.chat-header {
    background: var(--primary-green);
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    cursor: pointer
}

#chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-green);
    border: none;
    box-shadow: 0 0 20px var(--primary-green);
    cursor: pointer;
    font-size: 24px;
    z-index: 1001;
    transition: transform .2s;
    display: flex;
    justify-content: center;
    align-items: center
}

#chat-toggle:hover {
    transform: scale(1.1)
}

.chat-body {
    flex: 1;
    padding: 10px;
    overflow-y: auto
}

.chat-input-area {
    display: flex;
    border-top: 1px solid #333
}

.chat-input-area input {
    flex: 1;
    background: #111;
    border: none;
    padding: 10px;
    color: white;
    outline: none
}

.msg {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 8px;
    max-width: 80%
}

.msg.user {
    background: var(--accent-blue);
    align-self: flex-end;
    color: #111;
    margin-left: auto
}

.msg.bot {
    background: #34495e;
    color: #ddd
}

@keyframes gradientBG {

    0%,
    100% {
        background-position: 0% 50%
    }

    50% {
        background-position: 100% 50%
    }
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px)
    }

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

    .chat-header {
        background: var(--primary-green);
        padding: 10px 15px;
        font-weight: bold;
        display: flex;
        justify-content: space-between;
        cursor: pointer
    }

    #chat-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: var(--primary-green);
        border: none;
        box-shadow: 0 0 20px var(--primary-green);
        cursor: pointer;
        font-size: 24px;
        z-index: 1001;
        transition: transform .2s;
        display: flex;
        justify-content: center;
        align-items: center
    }

    #chat-toggle:hover {
        transform: scale(1.1)
    }

    .chat-body {
        flex: 1;
        padding: 10px;
        overflow-y: auto
    }

    .chat-input-area {
        display: flex;
        border-top: 1px solid #333
    }

    .chat-input-area input {
        flex: 1;
        background: #111;
        border: none;
        padding: 10px;
        color: white;
        outline: none
    }

    .msg {
        margin-bottom: 8px;
        padding: 8px;
        border-radius: 8px;
        max-width: 80%
    }

    .msg.user {
        background: var(--accent-blue);
        align-self: flex-end;
        color: #111;
        margin-left: auto
    }

    .msg.bot {
        background: #34495e;
        color: #ddd
    }

    @keyframes gradientBG {

        0%,
        100% {
            background-position: 0% 50%
        }

        50% {
            background-position: 100% 50%
        }
    }

    @keyframes fadeIn {
        from {
            opacity: 0
        }

        to {
            opacity: 1
        }
    }

    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateY(30px)
        }

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

    @keyframes fadeInImg {
        to {
            opacity: 1
        }
    }

    @keyframes pulse-critical {
        0% {
            box-shadow: 0 0 15px rgba(231, 76, 60, .5)
        }

        100% {
            box-shadow: 0 0 30px rgba(231, 76, 60, 1)
        }
    }

    .nature-bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 1;
        overflow: hidden;
        background: radial-gradient(circle at bottom center, #1b3a4b 0%, transparent 70%)
    }

    .firefly {
        position: absolute;
        bottom: -5%;
        width: 6px;
        height: 6px;
        background-color: var(--primary-green);
        border-radius: 50%;
        opacity: 0;
        filter: blur(2px);
        box-shadow: 0 0 10px var(--primary-green), 0 0 20px var(--accent-blue);
        animation: riseAndShine 15s infinite ease-in-out
    }

    @keyframes riseAndShine {
        0% {
            opacity: 0;
            transform: scale(.5)
        }

        20% {
            opacity: .6
        }

        50% {
            opacity: .8;
            transform: translateY(-40vh) translateX(20px) scale(1)
        }

        80% {
            opacity: .3
        }

        100% {
            opacity: 0;
            transform: translateY(-90vh) translateX(-20px) scale(.5)
        }
    }

    .firefly:nth-child(1) {
        left: 10%;
        animation-duration: 25s
    }

    .firefly:nth-child(2) {
        left: 20%;
        animation-duration: 35s;
        animation-delay: 5s;
        background: var(--accent-blue)
    }

    .firefly:nth-child(3) {
        left: 35%;
        animation-duration: 28s;
        animation-delay: 2s
    }

    .firefly:nth-child(4) {
        left: 50%;
        animation-duration: 40s;
        animation-delay: 10s
    }

    .firefly:nth-child(5) {
        left: 65%;
        animation-duration: 32s;
        animation-delay: 1s;
        background: #f1c40f
    }

    .firefly:nth-child(6) {
        left: 80%;
        animation-duration: 22s;
        animation-delay: 7s
    }

    .firefly:nth-child(7) {
        left: 90%;
        animation-duration: 38s;
        animation-delay: 12s
    }

    .firefly:nth-child(8) {
        left: 15%;
        animation-duration: 45s;
        animation-delay: 18s
    }

    .firefly:nth-child(9) {
        left: 55%;
        animation-duration: 29s;
        animation-delay: 15s;
        background: var(--accent-blue)
    }

    .wave {
        position: absolute;
        bottom: -20px;
        left: 0;
        width: 200%;
        height: 120px;
        background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1440 320" xmlns="http://www.w3.org/2000/svg"><path fill="%2300b09b" fill-opacity="0.05" d="M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,224C672,245,768,267,864,261.3C960,256,1056,224,1152,197.3C1248,171,1344,149,1392,138.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
        background-size: 50% 100%;
        animation: waveMove 60s linear infinite;
        z-index: 0;
        opacity: .6
    }

    @keyframes waveMove {
        0% {
            transform: translateX(0)
        }

        100% {
            transform: translateX(-50%)
        }
    }

    @media(max-width:900px) {
        body {
            flex-direction: column;
            overflow-y: auto;
            height: auto
        }

        main {
            padding: 1rem !important;
            width: 100%;
            height: auto;
            overflow: visible;
            flex-direction: column;
        }

        #sidebar {
            display: none;
            /* Hide sidebar on mobile */
        }

        h1 {
            font-size: 1.8rem
        }

        h2 {
            font-size: 1.5rem
        }

        p {
            font-size: 1rem
        }

        aside.active {
            position: relative;
            width: 100%;
            height: auto;
            display: flex;
            flex-direction: column;
            background: rgba(15, 32, 39, .95);
            padding: 1rem;
            gap: .8rem;
            border-right: none;
            border-bottom: 1px solid rgba(255, 255, 255, .2);
            z-index: 1000
        }

        aside .brand {
            width: 100%;
            text-align: left;
            font-size: 1rem
        }

        aside .metric-container {
            width: 100%;
            margin: 0;
            display: flex;
            flex-direction: column
        }

        aside .metric-label {
            font-size: .8rem;
            margin-bottom: 2px
        }

        aside .progress-track {
            height: 8px
        }

        aside button {
            width: 100%;
            padding: .5rem;
            margin-top: .5rem;
            font-size: .9rem;
            background: rgba(255, 255, 255, .1)
        }

        .menu-grid,
        .scenario-grid,
        .chapter-grid,
        .ref-grid {
            grid-template-columns: 1fr
        }

        #view-home.active {
            justify-content: flex-start;
            padding-top: 4rem
        }

        .scenario-grid {
            display: flex;
            flex-direction: column;
            gap: 1rem
        }

        .visual-column {
            height: 200px;
            width: 100%
        }

        .subsection {
            flex-direction: column;
            gap: 1.5rem;
            margin-bottom: 3rem
        }

        .subsection-visual {
            width: 100%;
            height: 200px;
            order: -1;
            position: static
        }

        #lesson-container {
            width: 100%;
            padding: 0 .5rem 5rem .5rem
        }

        .lesson-header h1 {
            font-size: 2rem
        }

        .modal-content {
            width: 95%;
            padding: 1.5rem;
            margin: auto
        }

        #chatbot-widget {
            width: 100%;
            right: 0;
            bottom: 0;
            border-radius: 15px 15px 0 0
        }

        #chat-toggle {
            bottom: 10px;
            right: 10px;
            width: 50px;
            height: 50px
        }
    }

    .main-footer {
        width: 100%;
        max-width: 1000px;
        margin: 4rem auto 1rem auto;
        padding: 1.5rem;
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, .05);
        color: rgba(255, 255, 255, .3);
        font-size: .65rem;
        line-height: 1.5
    }

    .main-footer .legal {
        font-size: .55rem;
        opacity: .8
    }

    @media print {
        body * {
            visibility: hidden
        }

        #chatbot-widget,
        #chat-toggle,
        #sidebar,
        .main-footer,
        #home-btn,
        .cta-btn,
        .back-btn,
        #login-overlay {
            display: none !important
        }

        #diploma-modal,
        #diploma-modal * {
            visibility: visible
        }

        #diploma-modal {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: white;
            padding: 0;
            display: block !important;
            margin: 0
        }

        #diploma-content {
            border: 5px double #00b09b !important;
            box-shadow: none !important
        }
    }