:root {
    --primary-blue: #004a99;
    --secundary-blue: #004a997d;
    --accent-orange: #f28500;
    --light-gray: #f0f2f5;
    --dark-gray: #2d2d2d;
    --white: #ffffff;
    --font-family: 'Roboto', sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background-color: var(--light-gray);
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 2em auto;
    background: var(--white);
    padding: 2.5em;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    flex-grow: 1;
}

.main-header {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 0.8rem 0; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    width: 100%;
}

.header-content {
    width: 90%;
    max-width: 1200px;
    padding: 0 2.5em;
    margin: auto;
    display: flex;
    justify-content: space-between; 
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 45px;
    background-color: #fff;
    padding: .2rem;
    border-radius: 1rem;
}

.header-content h1 {
    font-size: 1.5em;
    margin: 0;
    font-weight: 500;
}

nav .nav-link {
    color: var(--white);
    text-decoration: none;
    font-size: 1em;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 5px;
    transition: all 0.3s ease;
}

nav .nav-link:hover {
    background-color: var(--white);
    color: var(--primary-blue);
}

.instructions {
    color: #666;
    margin-top: 0;
    font-size: 1.1em;
}

.CodeMirror {
    border: 1px solid #ddd;
    border-radius: 5px;
    height: 350px;
    font-size: 16px;
    margin-bottom: 1em;
}

button#runButton {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1em;
    transition: background-color 0.3s, transform 0.2s;
}

button#runButton:hover {
    background-color: var(--secundary-blue);
    transform: translateY(-2px);
}

h3 {
    margin-top: 2em;
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 0.5em;
    font-weight: 500;
}

pre#output {
    background-color: var(--dark-gray);
    color: #f8f8f2;
    padding: 1em;
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    min-height: 80px;
    font-size: 15px;
}

.main-footer {
    background-color: #2c3e50;
    color: rgba(255, 255, 255, 0.8);
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-content {
    width: 90%;
    max-width: 1200px;
    margin: auto;
    text-align: center;
}

.footer-content p {
    margin: 0.5em 0;
    font-size: 0.9em;
}

.footer-content a {
    color: var(--accent-orange);
    text-decoration: none;
    font-weight: bold;
}

.footer-content a:hover {
    text-decoration: underline;
}

.page-header {
    border-bottom: 3px solid #f0f2f5;
    margin-bottom: 2em;
    padding-bottom: 1em;
}

.page-header h2 {
    font-size: 2.2em;
    margin-bottom: 0.2em;
    color: var(--primary-blue);
}

.page-header p {
    font-size: 1.2em;
    color: #555;
    margin-top: 0;
}

.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2em;
}

.card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5em;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1em;
    gap: 1em;
}

.card-header h3 {
    margin: 0;
    font-size: 1.3em;
    border: none;
    padding: 0;
    color: #333;
}

.tag {
    font-size: 0.75em;
    padding: 5px 12px;
    border-radius: 50px;
    color: var(--white);
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
}

.tag-easy { background-color: #27ae60; }
.tag-medium { background-color: #f39c12; }
.tag-hard { background-color: #c0392b; }

.card p {
    flex-grow: 1;
    color: #495057;
}

.btn-card {
    display: inline-block;
    align-self: flex-start;
    margin-top: 1em;
    padding: 10px 22px;
    background-color: var(--primary-blue);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-card:hover {
    background-color: #003366;
}

.materials-section {
    margin-bottom: 3em;
}

.materials-section h4 {
    font-size: 1.6em;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--accent-orange);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

.material-item {
    border-left: 4px solid #dee2e6;
    padding: 0.5em 1.5em;
    margin-bottom: 1.5em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.material-item p {
    margin: 0;
}

.module {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1em;
    overflow: hidden;
}

.module-header {
    padding: 1.2em 1.5em;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    transition: background-color 0.3s ease;
}

.module-header.active,
.module-header:hover {
    background-color: #e9ecef;
}

.module-header h3 {
    margin: 0;
    font-size: 1.3em;
    color: var(--primary-blue);
    font-weight: 500;
}

.module-toggle-icon {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-blue);
    transition: transform 0.3s ease;
}

.module-header.active .module-toggle-icon {
    transform: rotate(180deg);
}

.module-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding: 0 1.5em;
    border-top: 1px solid #e9ecef;
}

.module-content .activities-grid {
    padding-top: 1.5em;
    padding-bottom: 1.5em;
}

.card-header h4 {
    margin: 0;
    font-size: 1.2em;
    border: none;
    padding: 0;
    color: #333;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--white);
    padding: 2em;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 2.5em;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close-button:hover {
    color: #333;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--primary-blue);
}

.modal-content label {
    display: block;
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 500;
}

.modal-content .CodeMirror {
    height: 250px;
}

#modal-check-answer {
    margin-top: 1em;
    width: auto;
    padding: 10px 25px;
}

.modal-output-container {
    margin-top: 1.5em;
}

.modal-output-container h4 {
    margin-bottom: 0.5em;
}

#modal-output {
    background-color: var(--dark-gray);
    color: #f8f8f2;
    padding: 1em;
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    min-height: 50px;
}

.btn-resolver {
    display: inline-block;
    align-self: flex-start;
    margin-top: 1em;
    padding: 10px 22px;
    background-color: var(--primary-blue);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-resolver:hover {
    background-color: #003366;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.status-icon {
    font-size: 1.2rem;
}

.status-icon.unlocked {
    color: #27ae60; 
}

.status-icon.locked {
    color: #c0392b;
}

.card.card-locked {
    background-color: #f8f9fa;
    opacity: 0.7;
    cursor: not-allowed;
}

.card.card-locked:hover {
    transform: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.card.card-locked .btn-card {
    background-color: #6c757d;
    pointer-events: none;
}

.input-area {
    margin-top: 1.5em;
}
.input-area label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 500;
    color: #555;
}
#programInput {
    width: 98%;
    max-width: 98%;
    min-width: 98%;
    height: 100px;
    font-family: monospace;
    font-size: 15px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal-input-area {
    margin-top: 1em;
}

#modal-program-input {
    width: 98%;
    max-width: 98%;
    min-width: 98%;
    height: 80px;
    font-family: monospace;
    font-size: 15px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}