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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Header */
header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 300;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
}

.user-info a {
    color: white;
    text-decoration: none;
    background: #e74c3c;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.user-info a:hover {
    background: #c0392b;
}

/* Navegación */
nav {
    background: #34495e;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav ul {
    list-style: none;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    display: block;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

nav ul li a:hover,
nav ul li a.active {
    background: #2c3e50;
    border-bottom-color: #3498db;
}

/* Main content */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

main h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-weight: 400;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
    font-weight: 300;
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* Botones */
button, .btn {
    background: #3498db;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

button:hover, .btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-aprovar {
    background: #27ae60;
}

.btn-aprovar:hover {
    background: #219653;
}

.btn-rechazar {
    background: #e74c3c;
}

.btn-rechazar:hover {
    background: #c0392b;
}

.btn-pdf {
    background: #9b59b6;
}

.btn-pdf:hover {
    background: #8e44ad;
}

.btn-cancelar {
    background: #6c757d;
}

.btn-cancelar:hover {
    background: #5a6268;
}

.btn-confirmar {
    background: #28a745;
}

.btn-confirmar:hover {
    background: #218838;
}

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

table th {
    background: #34495e;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 500;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

/* Evitar que columnas importantes del reporte se dividan en varias líneas
   y truncar con puntos suspensivos si es necesario. En pantallas pequeñas
   se permite el wrap y/o scroll horizontal (ya gestionado por .reporte-card table). */
.reporte-card table th,
.reporte-card table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

table tr:hover {
    background: #f8f9fa;
}

/* Estados de solicitud */
.estado-pendiente {
    color: #f39c12;
    font-weight: bold;
}

.estado-autorizado {
    color: #27ae60;
    font-weight: bold;
}

.estado-rechazado {
    color: #e74c3c;
    font-weight: bold;
}

.estado-cancelado {
    color: #6c757d;
    font-weight: bold;
}

/* Mensajes */
.mensaje {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid #28a745;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid #dc3545;
}

/* Calendario */
#calendar {
    max-width: 100%;
    margin: 20px auto;
    height: 80vh;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.fc-toolbar {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px !important;
}

.fc-toolbar-title {
    font-size: 1.8em !important;
    color: #2c3e50;
    font-weight: 600;
}

.fc-button {
    background: #3498db !important;
    border: none !important;
    padding: 8px 15px !important;
    font-weight: 500 !important;
}

.fc-button:hover {
    background: #2980b9 !important;
}

.fc-day-today {
    background-color: #e8f4fd !important;
}

.fc-event {
    border: none !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.9em !important;
}

/* Tarjetas de estadísticas */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card .number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #3498db;
}

/* Grid de reportes */
.reportes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.reporte-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.reporte-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

/* Formulario de solicitud */
.solicitud-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Lista de solicitudes */
.solicitudes-list {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Hacer tablas dentro de las tarjetas responsivas (scroll horizontal en pantallas pequeñas) */
.reporte-card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ajustes para pantallas pequeñas */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        gap: 0;
    }

    nav ul li a {
        padding: 0.75rem 1rem;
    }

    main {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 800px) {
    .reportes-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .login-container {
        margin: 40px 10px;
        padding: 1.5rem;
    }
}

.acciones {
    display: flex;
    gap: 0.5rem;
}

.acciones button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 50%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.text-muted {
    color: #6c757d;
    font-style: italic;
}

/* Mis solicitudes */
.my-requests {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.my-requests .btn {
    margin-top: 1rem;
}

/* Solicitudes recientes */
.recent-requests {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Mensajes de error en formularios */
.error-mensaje {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

/* Texto muted */
.text-muted {
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .acciones {
        flex-direction: column;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    table th,
    table td {
        padding: 0.5rem;
    }
    
    .modal-content {
        width: 90%;
        margin: 10% auto;
    }
    
    #calendar {
        height: 60vh;
        padding: 10px;
    }
    
    .fc-toolbar-title {
        font-size: 1.2em !important;
    }
    
    .fc-button {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem;
    }
    
    .login-container {
        margin: 50px auto;
        padding: 1rem;
    }
    
    .solicitud-form,
    .solicitudes-list,
    .my-requests,
    .recent-requests {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .reporte-card {
        padding: 1rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mensaje, .error {
    animation: fadeIn 0.3s ease-in;
}

.stat-card {
    animation: fadeIn 0.5s ease-in;
}

/* Estados hover mejorados */
table tr {
    transition: background-color 0.2s ease;
}

.btn, button {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Scroll personalizado */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states para accesibilidad */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Estados de carga */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

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

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

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Estados de botones deshabilitados */
button:disabled,
.btn:disabled {
    background: #6c757d !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Badges para notificaciones */
.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    background: #e74c3c;
    color: white;
}

/* Tooltips básicos */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Estilos específicos para el calendario personalizado */
.calendario-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    margin-top: 20px;
}

.calendario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

.calendario-title {
    font-size: 2em;
    color: #2c3e50;
    font-weight: 600;
}

.calendario-nav {
    display: flex;
    gap: 10px;
}

.calendario-nav a {
    background: #3498db;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background 0.3s;
}

.calendario-nav a:hover {
    background: #2980b9;
}

.calendario {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.1em;
}

.calendario th {
    background: #34495e;
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #2c3e50;
}

.calendario td {
    border: 1px solid #e9ecef;
    padding: 10px;
    height: 120px;
    vertical-align: top;
    width: 14.28%;
}

.dia-numero {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 5px;
    display: block;
}

.dia-actual {
    background-color: #e8f4fd !important;
    border: 2px solid #3498db !important;
}

.dia-actual .dia-numero {
    color: #3498db;
    font-weight: 700;
}

.evento {
    background: #3498db;
    color: white;
    padding: 3px 6px;
    margin: 2px 0;
    border-radius: 3px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.3s;
}

.evento:hover {
    background: #2980b9;
}

.evento-local {
    background: #27ae60;
}

.evento-local:hover {
    background: #219653;
}

.evento-pendiente {
    background: #f39c12;
}

.evento-pendiente:hover {
    background: #e67e22;
}

.sin-eventos {
    color: #6c757d;
    font-style: italic;
    font-size: 0.9em;
}

.dia-inactivo {
    background-color: #f8f9fa;
    color: #6c757d;
}

.eventos-dia {
    max-height: 80px;
    overflow-y: auto;
}

/* Scroll personalizado para eventos */
.eventos-dia::-webkit-scrollbar {
    width: 4px;
}

.eventos-dia::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 2px;
}

/* Responsive para calendario */
@media (max-width: 768px) {
    .calendario-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .calendario-title {
        font-size: 1.5em;
        text-align: center;
    }
    
    .calendario td {
        height: 80px;
        padding: 5px;
        font-size: 0.9em;
    }
    
    .dia-numero {
        font-size: 1em;
    }
    
    .evento {
        font-size: 0.7em;
        padding: 2px 4px;
    }
}

@media (max-width: 480px) {
    .calendario-container {
        padding: 10px;
    }
    
    .calendario td {
        height: 60px;
    }
    
    .evento {
        display: none; /* Ocultar eventos en móviles muy pequeños */
    }
    
    .sin-eventos {
        font-size: 0.7em;
    }
}