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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    overflow-x: hidden;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

.pdf-modal-content {
    max-width: 900px;
    width: 95%;
}

.confirm-modal {
    max-width: 400px;
    text-align: center;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.close-modal {
    color: #64748b;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-modal:hover {
    color: #ef4444;
    background-color: #fef2f2;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.confirm-icon {
    font-size: 48px;
    color: #f59e0b;
    margin-bottom: 16px;
}

.confirm-modal p {
    margin-bottom: 8px;
    color: #475569;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.pdf-preview {
    padding: 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.btn-edit, .btn-delete {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    font-size: 14px;
}

.btn-edit:hover {
    background-color: #f1f5f9;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-delete:hover {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-pdf {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    font-size: 14px;
}

.btn-pdf:hover {
    background-color: #f0fdf4;
    border-color: #10b981;
    color: #10b981;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #e2e8f0;
}

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

.logo i {
    background: #3b82f6;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.logo h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.logo p {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

.sidebar-menu {
    padding: 24px 20px;
    flex: 1;
}

.sidebar-menu h4 {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.sidebar-menu ul {
    list-style: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.menu-item:hover {
    background: #f1f5f9;
}

.menu-item.active {
    background: #3b82f6;
    color: white;
}

.menu-item i {
    width: 20px;
    font-size: 16px;
}

.menu-item span {
    font-size: 14px;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px 40px;
    max-width: calc(100vw - 280px);
}

/* Page Management */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

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

/* Page Header */
.page-header {
    margin-bottom: 32px;
    position: relative;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.page-header p {
    font-size: 16px;
    color: #64748b;
}

.folio-display {
    position: absolute;
    top: 0;
    right: 0;
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    color: #3b82f6;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.green { background: #10b981; }
.stat-icon.red { background: #ef4444; }
.stat-icon.orange { background: #f59e0b; }
.stat-icon.purple { background: #8b5cf6; }

.stat-content h3 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.stat-content p {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 2px;
}

.stat-content small {
    font-size: 12px;
    color: #64748b;
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

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

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
}

.action-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.action-content p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

.btn-action {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-start;
}

.btn-action:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    padding: 20px;
}

.chart-container canvas {
    max-height: 100%;
    width: 100% !important;
    height: auto !important;
}

/* Scrollable Chart Container for monthly view */
.scrollable-chart {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    height: 350px;
    padding: 20px;
}

.scrollable-chart canvas {
    min-width: 800px !important;
    width: 800px !important;
    height: 300px !important;
}

/* Remove Quick Start styles since we're removing that section */

/* Buttons */
.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #3b82f6;
    color: white;
}

/* Form Styles */
.folio-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 32px;
}

.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.info-box i {
    color: #3b82f6;
    font-size: 18px;
    margin-top: 2px;
}

.info-box p {
    color: #1e40af;
    line-height: 1.5;
    margin: 0;
}

.form-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.form-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.form-section p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.calculate-section {
    text-align: center;
    margin-top: 24px;
}

/* Monto Info Section */
.monto-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

.monto-info .info-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.monto-info .info-box i {
    color: #0ea5e9;
    font-size: 16px;
    margin-top: 2px;
}

.monto-info .info-box p {
    color: #0c4a6e;
    line-height: 1.4;
    margin: 0;
    font-size: 13px;
}

/* Field Help Text */
.field-help {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    display: block;
}

/* Folio Actions */
.folio-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.folio-actions .btn-secondary {
    background: #f59e0b;
    color: white;
    border: none;
}

.folio-actions .btn-secondary:hover {
    background: #d97706;
}

/* Resumen Section */
.resumen-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.resumen-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.resumen-section p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.resumen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.resumen-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
}

.resumen-item strong {
    color: #374151;
}

.resumen-item span {
    color: #6b7280;
}

/* Search Styles */
.search-section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
}

.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 18px;
    color: #9ca3af;
    font-size: 16px;
}

.search-box input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #3b82f6;
}

.search-help {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

.search-term {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-term p {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.search-result {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #6b7280;
    min-width: 200px;
}

/* Results Section */
.results-section {
    margin-top: 32px;
}

.results-section h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 24px;
}

.student-cards {
    display: grid;
    gap: 16px;
}

.student-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.student-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.chart-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.chart-card p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
}

.chart-placeholder i {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.chart-placeholder p {
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}

.chart-placeholder small {
    font-size: 14px;
    color: #9ca3af;
}

/* Students List Section */
.students-list-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    margin-top: 32px;
}

.students-list-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.students-list-section p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.students-table-container {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 120px 150px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.header-item {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #e2e8f0;
}

.header-item:last-child {
    border-right: none;
}

.table-body {
    max-height: 400px;
    overflow-y: auto;
}

.table-row {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 120px 150px;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
}

.table-row:hover {
    background: #f8fafc;
}

.table-row:last-child {
    border-bottom: none;
}

.table-cell {
    padding: 16px;
    font-size: 14px;
    color: #374151;
    border-right: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-cell:last-child {
    border-right: none;
}

.student-name {
    font-weight: 500;
    color: #1e293b;
}

.student-matricula {
    font-size: 12px;
    color: #6b7280;
    display: block;
    margin-top: 2px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.status-sin-adeudo {
    background: #dcfce7;
    color: #166534;
}

.status-con-adeudo {
    background: #fee2e2;
    color: #dc2626;
}

.btn-pdf {
    background: #dc2626;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-pdf:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-pdf i {
    font-size: 12px;
}

/* Success Messages */
.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-message i {
    color: #16a34a;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
        max-width: 100vw;
    }
    
    .form-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .search-term {
        flex-direction: column;
        align-items: flex-start;
    }
    .reports-grid {
        grid-template-columns: 1fr;
    }
}

/* PDF Reports Section */
.pdf-reports-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
}

.pdf-reports-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.pdf-reports-section p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.report-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.report-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.report-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.report-content p {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
}

.report-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

.report-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-report {
    background: #dc2626;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    width: 100%;
    justify-content: center;
}

.btn-report:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-report:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

/* CSV Button Style */
.btn-csv {
    background: #10b981;
    margin-top: 8px;
}

.btn-csv:hover {
    background: #059669;
}

/* Payment Type Badges */
.payment-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

.payment-efectivo {
    background: #dbeafe;
    color: #1e40af;
}

.payment-multa {
    background: #fef3c7;
    color: #92400e;
}

/* Payment Type Preview (larger, for form) */
.payment-preview {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
}

.payment-preview.efectivo {
    background: #dbeafe;
    color: #1e40af;
}

.payment-preview.multa_cancelada {
    background: #fef3c7;
    color: #92400e;
}

/* Update table grid to include new column */
.table-header,
.table-row {
    grid-template-columns: 100px 1fr 1fr 120px 120px 150px;
}

/* Moved from script.js*/

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}