/* ========================================
   Psicolat Fichas Clínicas - Frontend CSS
   Versión: 2.0.0
   ======================================== */

/* --- Layout Principal --- */
.psicolat-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- Header --- */
.psicolat-header {
    margin-bottom: 2rem;
}

.psicolat-header h2 {
    font-size: 1.75rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* --- Estadísticas --- */
.psicolat-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card h3 {
    font-size: 2.5rem;
    margin: 0;
    color: #495057;
    font-weight: 700;
}

.stat-card p {
    margin: 0.5rem 0 0;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- Acciones --- */
.psicolat-actions {
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* --- Botones --- */
.psicolat-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.psicolat-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.psicolat-btn.primary {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
}

.psicolat-btn.primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004768 100%);
}

.psicolat-btn.secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.psicolat-btn.secondary:hover {
    background: linear-gradient(135deg, #545b62 0%, #3d4349 100%);
}

.btn-small {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-small.primary {
    background: #007cba;
    color: white;
}

.btn-small.primary:hover {
    background: #005a87;
}

.btn-small.secondary {
    background: #6c757d;
    color: white;
}

.btn-small.secondary:hover {
    background: #545b62;
}

/* --- Tabs --- */
.psicolat-tabs {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin: 2rem 0 1rem;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: #495057;
    background: rgba(0, 124, 186, 0.05);
}

.tab-btn.active {
    color: #007cba;
    border-bottom-color: #007cba;
    font-weight: 600;
}

/* --- Tab Content --- */
.psicolat-tab-content {
    margin-top: 1.5rem;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* --- Modal --- */
.psicolat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 650px;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #6c757d;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 1.5rem;
}

/* --- Formularios --- */
.psicolat-form {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* --- Listas --- */
.psicolat-fichas-list,
.psicolat-sesiones-list {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
}

.list-header {
    margin-bottom: 1.5rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-box input {
    flex: 1;
    padding: 0.625rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
}

.search-box button {
    padding: 0.625rem 1.5rem;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #005a87;
}

.list-content {
    margin-top: 1rem;
}

/* --- Tablas --- */
.psicolat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.psicolat-table th,
.psicolat-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.psicolat-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.psicolat-table th {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.psicolat-table tbody tr {
    transition: background 0.2s;
}

.psicolat-table tbody tr:hover {
    background: rgba(0, 124, 186, 0.03);
}

.psicolat-table tbody tr:last-child td {
    border-bottom: none;
}

.psicolat-table td {
    color: #495057;
    font-size: 0.9rem;
}

/* --- Paginación --- */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    color: #495057;
}

.page-btn:hover {
    border-color: #007cba;
    color: #007cba;
    background: rgba(0, 124, 186, 0.05);
}

.page-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* --- Estados Vacíos --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .psicolat-stats {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .psicolat-actions {
        flex-direction: column;
    }
    
    .psicolat-btn {
        width: 100%;
    }
    
    .psicolat-table {
        font-size: 0.85rem;
    }
    
    .psicolat-table th,
    .psicolat-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
    }
    
    .psicolat-tabs {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .stat-card h3 {
        font-size: 2rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box button {
        width: 100%;
    }
}

/* --- Loading States --- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 124, 186, 0.3);
    border-radius: 50%;
    border-top-color: #007cba;
    animation: spin 1s ease-in-out infinite;
}

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

/* --- Alertas y Mensajes --- */
.psicolat-alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.psicolat-alert.success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.psicolat-alert.error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.psicolat-alert.warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.psicolat-alert.info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* --- Accesibilidad --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- Utilidades --- */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* --- Print Styles --- */
@media print {
    .psicolat-actions,
    .psicolat-tabs,
    .modal-close {
        display: none;
    }
    
    .tab-pane {
        display: block !important;
    }
}