:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #ca8a04;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --border: #cbd5e1;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-area h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

.subtitle {
    font-size: 0.85rem;
    color: #64748b;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-btn.active, .nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.app-main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Switch de Guía Pedagógica */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Hero / Home */
.hero-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    text-align: center;
    margin-bottom: 2rem;
}

.hero-card h2 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.mode-selector {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.mode-selector select {
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: auto;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.module-card:hover:not(.disabled) {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.module-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.module-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.module-card h3 {
    margin-bottom: 0.5rem;
}

.module-card p {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.badge {
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-soon {
    background: #fef3c7;
    color: #d97706;
}

/* Workspace General */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.workspace {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

.exercise-panel, .controls-panel, .deduction-info-panel, .proof-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.statement-box {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
}

.phase-box {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.symbol-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.sym-btn, .btn, .btn-secondary, .btn-sm, .btn-help {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.sym-btn {
    background: #e2e8f0;
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
}

.sym-btn:hover {
    background: #cbd5e1;
}

.btn {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: var(--primary);
    color: white;
}

.btn-help {
    background: #fef08a;
    color: #854d0e;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.feedback-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    display: none;
}

.feedback-box.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    display: block;
}

.feedback-box.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    display: block;
}

.feedback-box.info {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    display: block;
}

/* Deducción Natural Tabla */
.deduction-workspace {
    grid-template-columns: 1fr;
}

#proof-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

#proof-table th, #proof-table td {
    border: 1px solid var(--border);
    padding: 0.5rem;
    text-align: left;
    font-size: 0.95rem;
}

#proof-table th {
    background: #f1f5f9;
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}
.status-correct { background: #dcfce7; color: #166534; }
.status-incorrect { background: #fee2e2; color: #991b1b; }
.status-incomplete { background: #fef3c7; color: #d97706; }
.status-undefined { background: #f1f5f9; color: #64748b; }

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

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.table-scroll {
    overflow-x: auto;
    margin-top: 1rem;
}

.tt-table {
    border-collapse: collapse;
    width: 100%;
}

.tt-table th, .tt-table td {
    border: 1px solid var(--border);
    padding: 0.5rem;
    text-align: center;
}

.tt-table th {
    background: #f1f5f9;
}