/* Base styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.75rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

body {
    background-color: #f8f9fa;
}

/* Header styles */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(50%, -50%);
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Program filter styles */
.program-filter {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--box-shadow);
    border: 1px solid #e9ecef;
}

.program-selector {
    display: flex;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.program-option {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.program-option.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.program-option:not(.active):hover {
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

.program-option.pmpca.active {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.program-option.imarec.active {
    background: linear-gradient(135deg, #fd7e14, #ffc107);
}

.program-option.todos.active {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
}

.program-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.program-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.program-badge.pmpca {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.program-badge.imarec {
    background: rgba(253, 126, 20, 0.1);
    color: #fd7e14;
}

.program-badge.todos {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

/* Semester navigation */
.semester-nav {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
    border: 1px solid #e9ecef;
}

.semester-tabs {
    display: flex;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.semester-tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.semester-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.semester-tab:not(.active):hover {
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

.semester-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.semester-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.semester-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-top: 0.25rem;
}

/* Table container */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    border: 1px solid #e9ecef;
    display: none;
}

.table-container.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-subtitle {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Enhanced table styles */
.schedule-table {
    margin: 0;
    font-size: 0.9rem;
}

.schedule-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
    padding: 1rem 0.75rem;
    text-align: center;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

.schedule-table tbody tr {
    transition: background-color 0.2s ease;
}

.schedule-table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

.schedule-table tbody tr:hover .time-badge {
    background-color: var(--primary-color);
    color: white !important; /* Important to override other background classes */
}


/* Column specific styles */
.col-clave {
    width: 8%;
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.col-creditos {
    width: 6%;
    text-align: center;
}

.col-materia {
    width: 25%;
    font-weight: 500;
}

.col-day {
    width: 8%;
    text-align: center;
    font-size: 0.8rem;
}

.col-tipo {
    width: 8%;
    text-align: center;
}

.col-profesor {
    width: 15%;
}

.col-inscritos {
    width: 8%;
    text-align: center;
}

/* Schedule time badges */
.time-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.125rem;
    transition: all 0.2s ease-in-out;
}

/* Type badges */
.type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.type-badge.teorica {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.type-badge.practica {
    background: rgba(255, 193, 7, 0.1);
    color: #b45309;
}

.type-badge.laboratorio {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.type-badge.seminario {
    background: rgba(13, 202, 240, 0.1);
    color: #0891b2;
}

/* Professor info */
.professor-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.professor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.professor-name {
    font-weight: 500;
    color: var(--dark-color);
}

/* Enrollment badge */
.enrollment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.enrollment-low {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.enrollment-medium {
    background: rgba(255, 193, 7, 0.1);
    color: #b45309;
}

.enrollment-high {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

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

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

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

.btn-success:hover {
    background: #146c43;
    transform: translateY(-1px);
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 0;
}

/* Responsive design */
@media (max-width: 1200px) {
    .schedule-table {
        font-size: 0.8rem;
    }

    .schedule-table thead th,
    .schedule-table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 992px) {
    .page-header {
        padding: 1.5rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .semester-stats {
        gap: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .program-selector {
        flex-direction: column;
    }

    .program-option {
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 768px) {
    .semester-tabs {
        flex-direction: column;
    }

    .semester-tab {
        margin-bottom: 0.25rem;
    }

    .semester-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .semester-stats {
        width: 100%;
        justify-content: space-around;
    }

    .schedule-table {
        font-size: 0.75rem;
    }

    .professor-info {
        flex-direction: column;
        text-align: center;
    }
}

/* Print styles */
@media print {
    body * {
        visibility: hidden !important;
    }

    .print-area.print-active,
    .print-area.print-active * {
        visibility: visible !important;
    }

    .table-responsive {
        overflow: visible !important;
        width: 100% !important;
    }

    .schedule-table {
        width: 100% !important;
        table-layout: auto !important;
    }

    .print-area.print-active {
        position: absolute;
        left: 0;
        top: 0;
        width: 100vw;
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .table-header,
    .table-responsive,
    .schedule-table {
        background: white !important;
        color: #212529 !important;
    }

    .schedule-table th,
    .schedule-table td {
        border: 1px solid #bdbdbd !important;
        color: #222 !important;
        font-size: 1rem !important;
        padding: 0.75rem !important;
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .time-badge,
    .enrollment-badge {
        color: #0d6efd !important;
        background: #e3eafc !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        border-radius: 0.25rem !important;
        padding: 0.25rem 0.5rem !important;
        font-weight: 600 !important;
    }

    .action-buttons,
    .semester-nav,
    .semester-tabs,
    .page-header,
    .empty-state,
    .program-filter {
        display: none !important;
    }

    .table-header {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
}

/* Toggle Status Button Styles */
.toggle-status-btn {
    min-width: 90px;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

.toggle-status-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.toggle-status-btn .bi {
    font-size: 1.2em;
}

/* Inactive row styling */
tr.materia-row[data-active="0"],
tr.table-secondary {
    background-color: rgba(108, 117, 125, 0.1) !important;
}

tr.materia-row[data-active="0"] td {
    color: #6c757d !important;
}

.col-estado {
    min-width: 120px;
    text-align: center;
}
