:root {
    /* Dracula Theme Colors */
    --bg-darker: #191A21;
    --bg-dark: #21222c;
    --bg-panel: rgba(40, 42, 54, 0.6);
    --bg-panel-light: rgba(68, 71, 90, 0.4);
    --fg-main: #f8f8f2;
    --comment: #6272a4;
    --cyan: #8be9fd;
    --green: #50fa7b;
    --orange: #ffb86c;
    --pink: #ff79c6;
    --purple: #bd93f9;
    --red: #ff5555;
    --yellow: #f1fa8c;

    /* Neumorphism Shadows */
    --shadow-dark: 5px 5px 10px rgba(0, 0, 0, 0.5);
    --shadow-light: -5px -5px 10px rgba(255, 255, 255, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--fg-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Shapes for Glassmorphism Context */
.bg-shape {
    position: absolute;
    filter: blur(90px);
    z-index: -1;
    opacity: 0.5;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: var(--purple);
    top: -100px;
    left: -100px;
}

.circle-2 {
    width: 300px;
    height: 300px;
    background: var(--cyan);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.circle-3 {
    width: 250px;
    height: 250px;
    background: var(--pink);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

/* Error pages */
.error-page-container {
    min-height: 100vh;
    height: auto;
}

.error-content {
    flex: 1;
    display: grid;
    place-items: center;
    padding: clamp(24px, 6vw, 72px);
    text-align: center;
}

.error-card {
    width: min(100%, 760px);
    padding: clamp(32px, 7vw, 72px);
}

.error-code {
    color: var(--pink);
    font: 900 clamp(5rem, 18vw, 10rem)/.9 'Orbitron', sans-serif;
    letter-spacing: .04em;
    text-shadow: 0 0 28px rgba(255, 121, 198, .28);
}

.error-card h1 {
    color: var(--cyan);
    font-size: clamp(1.35rem, 4vw, 2rem);
    margin: 24px 0 12px;
}

.error-card p {
    color: var(--fg-main);
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto 28px;
}

.error-card .error-hint {
    color: var(--comment);
    font-size: .92rem;
    margin-top: -12px;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.error-actions .glass-btn {
    text-decoration: none;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(30px) scale(1.1);
    }
}

/* Base Layout Config */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.glass-panel-inner {
    background: var(--bg-panel-light);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2),
        inset -2px -2px 5px rgba(255, 255, 255, 0.02);
}

/* Typography FUI */
h1,
h2,
h3,
.brand {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

/* Header */
header {
    padding: 20px 30px;
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.title-area h1 {
    font-size: 2rem;
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(139, 233, 253, 0.3);
    margin-bottom: 5px;
}

.title-area h2 {
    font-size: 1.2rem;
    color: var(--fg-main);
    font-weight: 500;
}

.title-area h3 {
    font-size: 0.9rem;
    color: var(--comment);
    margin-top: 5px;
}

.contact-area {
    display: flex;
    gap: 15px;
    padding: 15px;
    flex-wrap: wrap;
}

.cyber-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--pink), var(--purple), transparent);
    box-shadow: 0 0 10px var(--pink);
}

/* Buttons */
.glass-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg-main);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow-dark), var(--shadow-light);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    color: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(139, 233, 253, 0.3);
}

.small-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Main Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
    /* Important for preventing grid blowout in flex container */
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h3 {
    color: var(--pink);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer {
    padding: 12px 15px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.correction-link {
    justify-content: center;
    width: 100%;
    color: var(--bg-darker);
    background: linear-gradient(135deg, var(--cyan), var(--green));
    border-color: transparent;
    box-shadow: 0 0 18px rgba(139, 233, 253, 0.18);
}

.correction-link:hover {
    background: var(--orange);
    color: var(--bg-darker);
    border-color: transparent;
    box-shadow: 0 0 22px rgba(255, 184, 108, 0.35);
}

.menu-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.menu-container::-webkit-scrollbar {
    width: 6px;
}

.menu-container::-webkit-scrollbar-thumb {
    background-color: var(--comment);
    border-radius: 10px;
}

.loading-data {
    text-align: center;
    color: var(--comment);
    padding: 30px;
    font-style: italic;
}

/* Accordion Menu */
.menu-group {
    margin-bottom: 15px;
}

.menu-title {
    cursor: pointer;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Orbitron', sans-serif;
    color: var(--purple);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--purple);
    transition: all 0.3s;
}

.menu-title:hover {
    background: rgba(0, 0, 0, 0.4);
    color: var(--cyan);
    border-left-color: var(--cyan);
}

.menu-content {
    display: none;
    /* Collapsed by default */
    padding: 10px 0 10px 15px;
    border-left: 1px dashed var(--comment);
    margin-left: 10px;
}

.menu-content.active {
    display: block;
}

.semestre-group {
    margin-bottom: 10px;
}

.curso-label {
    color: var(--orange);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.disciplina-list {
    list-style: none;
    padding-left: 15px;
}

.disciplina-node {
    list-style: none;
    margin-bottom: 5px;
}

.disciplina-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--fg-main);
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 8px;
}

.disciplina-title {
    justify-content: space-between;
}

.disciplina-title span,
.disciplina-action-item span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.disciplina-item:hover,
.disciplina-item.active {
    background: rgba(80, 250, 123, 0.1);
    color: var(--green);
    transform: translateX(5px);
    border-left: 2px solid var(--green);
}

.disciplina-actions,
.avaliacao-list {
    display: none;
    list-style: none;
    margin: 0 0 8px 18px;
    padding: 2px 0 2px 10px;
    border-left: 1px dashed rgba(98, 114, 164, 0.7);
}

.disciplina-actions.active,
.avaliacao-list.active {
    display: block;
}

.disciplina-action-item,
.avaliacao-item,
.avaliacao-status {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    color: var(--fg-main);
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.2s;
}

.disciplina-action-item,
.avaliacao-item {
    cursor: pointer;
}

.disciplina-action-item.has-children {
    justify-content: space-between;
}

.disciplina-action-item:hover,
.disciplina-action-item.active,
.avaliacao-item:hover,
.avaliacao-item.active {
    background: rgba(139, 233, 253, 0.1);
    color: var(--cyan);
    transform: translateX(4px);
    border-left: 2px solid var(--cyan);
}

.avaliacao-status {
    color: var(--comment);
    font-style: italic;
}

.avaliacao-status.error {
    color: var(--red);
}

/* Main Content Area */
.content-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.welcome-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.welcome-icon {
    font-size: 5rem;
    color: var(--comment);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

.welcome-message h2 {
    color: var(--cyan);
    margin-bottom: 15px;
    font-size: 2rem;
}

.welcome-message p {
    color: var(--comment);
    max-width: 500px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.iframe-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.iframe-container.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.iframe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.iframe-header h3 {
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

#drive-iframe {
    width: 100%;
    flex: 1;
    background: white;
    /* Iframe background needs to be white to not clash with Drive's UI */
    border-radius: 0 0 16px 16px;
    filter: invert(90%) hue-rotate(180deg) brightness(1.1) contrast(1.1);
    /* Inverte as cores e gira a matiz para manter as cores originais o máximo possível */
}

.unavailable-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    width: 100%;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.5s ease;
    background: rgba(40, 42, 54, 0.4);
    border-radius: 16px;
}

.unavailable-message.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    display: none;
}

.unavailable-icon {
    font-size: 4rem;
    color: var(--orange);
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(255, 184, 108, 0.5));
}

.unavailable-message h2 {
    color: var(--orange);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.unavailable-message p {
    color: var(--fg-main);
    max-width: 400px;
    font-size: 1.05rem;
    line-height: 1.5;
}

.quiz-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    z-index: 6;
}

.quiz-container.hidden {
    display: none;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.quiz-header h3 {
    color: var(--cyan);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.quiz-header p {
    color: var(--comment);
    margin-top: 6px;
    font-size: 0.9rem;
}

.quiz-scoreboard {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.quiz-scoreboard span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--fg-main);
    font-size: 0.84rem;
}

.quiz-scoreboard span:nth-child(1) i {
    color: var(--green);
}

.quiz-scoreboard span:nth-child(2) i {
    color: var(--red);
}

.quiz-scoreboard span:nth-child(3) i {
    color: var(--yellow);
}

.quiz-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.quiz-body::-webkit-scrollbar {
    width: 6px;
}

.quiz-body::-webkit-scrollbar-thumb {
    background-color: var(--comment);
    border-radius: 10px;
}

.question-card {
    padding: 18px;
    margin-bottom: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.question-card.correct {
    border-color: rgba(80, 250, 123, 0.55);
}

.question-card.wrong {
    border-color: rgba(255, 85, 85, 0.55);
}

.question-observation {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-left: 3px solid var(--cyan);
    border-radius: 4px;
    background: rgba(139, 233, 253, 0.07);
    color: var(--fg-main);
    font-size: 0.88rem;
    line-height: 1.5;
}

.question-observation strong {
    color: var(--cyan);
}

.question-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--comment);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.question-card h4 {
    color: var(--fg-main);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 14px;
}

.alternatives {
    display: grid;
    gap: 10px;
}

.alternative-btn {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    color: var(--fg-main);
    text-align: left;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.alternative-btn strong {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--bg-dark);
    background: var(--purple);
    font-size: 0.8rem;
}

.alternative-btn span {
    line-height: 1.35;
}

.alternative-btn:hover:not(:disabled) {
    border-color: var(--cyan);
    background: rgba(139, 233, 253, 0.08);
}

.alternative-btn:disabled {
    cursor: default;
}

.alternative-btn.correct {
    border-color: var(--green);
    background: rgba(80, 250, 123, 0.1);
}

.alternative-btn.correct strong {
    background: var(--green);
}

.alternative-btn.wrong {
    border-color: var(--red);
    background: rgba(255, 85, 85, 0.1);
}

.alternative-btn.wrong strong {
    background: var(--red);
}

.question-feedback {
    display: none;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.question-card.correct .question-feedback,
.question-card.wrong .question-feedback {
    display: block;
}

.question-feedback strong {
    color: var(--cyan);
}

.question-card.wrong .question-feedback strong {
    color: var(--red);
}

.question-feedback p {
    color: var(--fg-main);
    margin-top: 6px;
    line-height: 1.5;
}

.quiz-result-card {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 14px;
    align-items: center;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.quiz-result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: var(--bg-dark);
    font-size: 1.2rem;
}

.quiz-result-card span {
    display: block;
    color: var(--comment);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.quiz-result-card h4 {
    color: var(--fg-main);
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.quiz-result-card p {
    color: var(--fg-main);
    line-height: 1.45;
    margin-bottom: 10px;
}

.quiz-result-card strong {
    color: var(--fg-main);
}

.quiz-result-card.failed {
    border-color: rgba(255, 85, 85, 0.55);
    background: rgba(255, 85, 85, 0.1);
}

.quiz-result-card.failed .quiz-result-icon {
    background: var(--red);
}

.quiz-result-card.average {
    border-color: rgba(241, 250, 140, 0.6);
    background: rgba(241, 250, 140, 0.1);
}

.quiz-result-card.average .quiz-result-icon {
    background: var(--yellow);
}

.quiz-result-card.excellent {
    border-color: rgba(80, 250, 123, 0.55);
    background: rgba(80, 250, 123, 0.1);
}

.quiz-result-card.excellent .quiz-result-icon {
    background: var(--green);
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 2px 0 18px;
}

.quiz-nav-btn {
    justify-content: center;
    min-width: 120px;
}

.quiz-nav-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    color: var(--comment);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.quiz-nav-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--comment);
}

.quiz-empty {
    color: var(--comment);
    text-align: center;
    padding: 40px;
}

/* Responsividade */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        max-height: 400px;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
    }

    .content-area {
        min-height: 600px;
    }

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

    .quiz-scoreboard {
        justify-content: flex-start;
    }
}
