@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0c0c0e;
    --card-bg: rgba(22, 22, 26, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --yellow-primary: #ffcd00;
    --yellow-hover: #e6b800;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(255, 205, 0, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.03) 0px, transparent 50%);
}

/* Glassmorphism container */
.glass-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Transitions */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

.view.active {
    display: block;
    opacity: 1;
}

/* LOGIN VIEW */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-wrapper.active {
    display: flex;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.logo-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin-bottom: 8px;
}

.logo-header h1 span {
    color: var(--yellow-primary);
}

.logo-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    background: rgba(30, 30, 35, 0.6);
    border: 1px solid var(--card-border);
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--yellow-primary);
    box-shadow: 0 0 0 2px rgba(255, 205, 0, 0.2);
}

.btn-primary {
    width: 100%;
    background: var(--yellow-primary);
    color: #000;
    border: none;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--yellow-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 10px;
    text-align: center;
    display: none;
}

/* DASHBOARD VIEW */
.navbar {
    border-bottom: 1px solid var(--card-border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(12, 12, 14, 0.8);
    backdrop-filter: blur(8px);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-brand span {
    color: var(--yellow-primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-tag {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.user-tag strong {
    color: var(--text-main);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.dashboard-header {
    margin-bottom: 30px;
}

.carrera-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.progress-bar-wrapper {
    flex-grow: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.6s ease-out;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

.subject-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    transition: all 0.3s ease;
}

.subject-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.subject-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-no-config { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-ordinario { background: rgba(255, 205, 0, 0.15); color: var(--yellow-primary); }
.badge-extraordinario { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-aprobado { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-reprobado { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.card-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subject-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-start {
    background: var(--yellow-primary);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-start:hover {
    background: var(--yellow-hover);
}

.btn-start:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* EXAM VIEW */
.exam-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

@media (max-width: 900px) {
    .exam-layout {
        grid-template-columns: 1fr;
    }
    
    .exam-sidebar {
        order: -1;
    }
}

.exam-card {
    padding: 35px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.question-number {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 30px;
    white-space: pre-wrap;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
}

.option-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.option-item.selected {
    background: rgba(255, 205, 0, 0.08);
    border-color: var(--yellow-primary);
}

.option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
}

.option-item.selected .option-letter {
    background: var(--yellow-primary);
    color: #000;
    border-color: var(--yellow-primary);
}

.option-text {
    font-size: 0.95rem;
}

.exam-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--card-border);
    padding-top: 25px;
}

.exam-sidebar-card {
    padding: 24px;
    position: sticky;
    top: 90px;
}

.timer-wrapper {
    text-align: center;
    margin-bottom: 25px;
}

.timer-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.timer-clock {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.timer-clock.warning {
    color: var(--danger);
    animation: pulse 1s infinite alternate;
}

.navigation-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 20px;
}

.nav-dot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-dot:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-dot.answered {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: var(--success);
}

.nav-dot.active {
    border-color: var(--yellow-primary);
    color: var(--yellow-primary);
    box-shadow: 0 0 8px rgba(255, 205, 0, 0.2);
}

/* RESULTS VIEW */
.result-card {
    max-width: 600px;
    margin: 50px auto 0 auto;
    padding: 50px;
    text-align: center;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 25px;
}

.result-icon.approved { color: var(--success); }
.result-icon.failed { color: var(--danger); }

.result-score {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.result-score span {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.result-status-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
}

.result-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 40px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ANIMATIONS */
@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* DRAG AND DROP STYLES */
.dd-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 25px;
    padding: 10px 0;
    scrollbar-width: thin;
}

.dd-container {
    position: relative;
    width: 600px;
    margin: 0 auto;
    user-select: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    border: 1px solid var(--card-border);
}

.dd-bg-image {
    display: block;
    width: 600px;
    height: auto;
}

.dd-drop-zone {
    position: absolute;
    width: 120px;
    height: 32px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dd-drop-zone:hover {
    border-color: var(--yellow-primary);
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.02);
}

.dd-drop-zone.selected-zone {
    border-color: var(--yellow-primary);
    box-shadow: 0 0 10px var(--yellow-primary);
    background: rgba(255, 193, 7, 0.15);
}

.dd-drop-zone.filled {
    border-style: solid;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
    backdrop-filter: blur(4px);
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.dd-drags-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--card-border);
    justify-content: center;
    min-height: 60px;
    align-items: center;
}

.dd-drag-item {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    cursor: grab;
    font-size: 0.8rem;
    font-weight: 500;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.dd-drag-item:hover {
    border-color: var(--yellow-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    background: rgba(255, 255, 255, 0.08);
}

.dd-drag-item.selected {
    border-color: var(--yellow-primary);
    background: rgba(255, 193, 7, 0.15);
    box-shadow: 0 0 8px var(--yellow-primary);
}

.dd-drag-item.dragging {
    opacity: 0.4;
}

/* ========================================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS (CELLPHONES)
   ======================================================================== */

@media (max-width: 768px) {
    /* General Layout */
    .container {
        padding: 16px 12px;
    }

    .navbar {
        padding: 12px 16px;
    }

    .nav-brand {
        font-size: 1.15rem;
    }

    .nav-brand span {
        display: none; /* Hide version/type on mobile */
    }

    .nav-user {
        gap: 8px;
    }

    .user-tag {
        display: none; /* Hide user name text on mobile */
    }

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

    .dashboard-header {
        padding: 16px !important;
        margin-bottom: 20px !important;
    }

    .carrera-title {
        font-size: 1.25rem;
    }

    .subject-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }

    .subject-card {
        padding: 16px;
        min-height: 160px;
    }

    /* Exam Layout */
    .exam-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px 12px;
    }

    .exam-card {
        padding: 20px 16px;
        min-height: 350px;
    }

    .question-text {
        font-size: 1.05rem;
        margin-bottom: 20px;
    }

    .option-item {
        padding: 12px;
        gap: 10px;
    }

    .option-text {
        font-size: 0.9rem;
    }

    .option-letter {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .exam-nav-buttons {
        padding-top: 16px;
    }

    /* Sidebar to Bottom & Compact Timer in Navbar */
    .exam-sidebar {
        order: 2; /* Put it below the questions instead of on top */
    }

    .exam-sidebar-card {
        position: static;
        padding: 16px;
    }

    .exam-sidebar-card .timer-wrapper {
        display: none; /* Hide large timer on mobile sidebar */
    }

    .nav-timer-compact {
        display: flex !important;
        align-items: center;
        gap: 6px;
        background: rgba(239, 68, 68, 0.15);
        color: var(--danger);
        padding: 6px 12px;
        border-radius: 20px;
        font-weight: 700;
        font-size: 0.9rem;
        border: 1px solid rgba(239, 68, 68, 0.25);
    }
    
    .nav-timer-compact.normal-timer {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-main);
        border-color: var(--card-border);
    }

    .navigation-grid {
        grid-template-columns: repeat(6, 1fr); /* 6 columns on mobile for better wrapping */
        gap: 6px;
    }

    .nav-dot {
        font-size: 0.75rem;
        border-radius: 4px;
    }

    /* Result view */
    .result-card {
        margin: 20px auto 0 auto;
        padding: 24px 16px;
    }

    .result-icon {
        font-size: 4rem;
        margin-bottom: 16px;
    }

    .result-score {
        font-size: 2.8rem;
    }

    .result-details-grid {
        padding: 12px;
        gap: 12px;
        margin-bottom: 24px;
    }

    .detail-value {
        font-size: 1rem;
    }

    /* Drag & Drop scaling styling */
    .dd-wrapper {
        width: 100%;
        overflow: hidden;
        position: relative;
    }
    .dd-container {
        width: 600px;
        position: relative;
    }
}

@media (max-width: 480px) {
    .logo-header h1 {
        font-size: 1.5rem;
    }

    .login-card {
        padding: 24px 16px;
    }

    .btn-primary {
        padding: 12px;
    }

    .carrera-title {
        font-size: 1.15rem;
    }

    .progress-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .progress-bar-wrapper {
        width: 100%;
    }

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

/* MODAL DE ADVERTENCIA ANTICOPÍA */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 12, 14, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-card {
    width: 90%;
    max-width: 550px;
    padding: 35px;
    text-align: center;
    border: 1px solid rgba(255, 205, 0, 0.2);
    box-shadow: 0 0 30px rgba(255, 205, 0, 0.1);
}

.modal-icon {
    font-size: 4rem;
    color: var(--yellow-primary);
    margin-bottom: 20px;
    animation: pulse 1.5s infinite alternate;
}

.modal-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.05em;
    margin-bottom: 15px;
}

.modal-body {
    text-align: left;
    margin-bottom: 30px;
}

.warning-highlight {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
    padding: 12px;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #fca5a5;
    margin-bottom: 20px;
}

.modal-body ul {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.modal-body li {
    margin-bottom: 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-muted);
}

.modal-body li i {
    color: var(--yellow-primary);
    font-size: 1rem;
    margin-top: 3px;
}

.modal-body li strong {
    color: var(--text-main);
}

.warning-footer {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
    border-top: 1px solid var(--card-border);
    padding-top: 15px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-actions button {
    flex: 1;
    max-width: 200px;
}

@media (max-width: 768px) {
    .modal-card {
        padding: 24px 16px;
    }
    .modal-icon {
        font-size: 3rem;
    }
    .modal-card h2 {
        font-size: 1.3rem;
    }
    .modal-body li {
        font-size: 0.85rem;
    }
}

/* ETIQUETA DE ADVERTENCIA DE TRAMPA EN TARJETAS */
.cheat-warning-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}

.cheat-warning-tag i {
    color: var(--danger);
}


