/* ==========================================
   ESTILOS GENERALES
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f0f0;
    min-height: 100vh;
    position: relative;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/fondo.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px);
    z-index: -1;
}

.background-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Increase alpha to make the background image more transparent (more washed-out) */
    background: rgba(72, 70, 70, 0.35);
    pointer-events: none;
}

/* ==========================================
   CONTENEDOR PRINCIPAL
   ========================================== */
.container {
    max-width: 800px;
    margin: 20px auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ==========================================
   CABECERA
   ========================================== */
.header {
    background: linear-gradient(135deg, #832323 0%, #880808 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.header .logo {
    max-width: 150px;
    height: auto;
    margin-bottom: 15px;
    background: white;
    padding: 10px;
    border-radius: 10px;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 14px;
    opacity: 0.95;
}

/* ==========================================
   BARRA DE PROGRESO
   ========================================== */
.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: #f5f5f5;
}

.progress-step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 3px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #999;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.progress-step.active {
    background: #d32f2f;
    border-color: #d32f2f;
    color: white;
    transform: scale(1.1);
}

.progress-step.completed {
    background: #5dce63;
    border-color: #159a1c;
    color: white;
}

.progress-line {
    flex: 1;
    height: 3px;
    background: #ddd;
    margin: 0 -5px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.progress-line.completed {
    background: #11aa19;
}

/* ==========================================
   FORMULARIO
   ========================================== */
form {
    padding: 30px;
    background-color: #f5e5e5;
}

.form-page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.form-page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-page h2 {
    color: #d32f2f;
    margin-bottom: 25px;
    font-size: 22px;
    border-bottom: 3px solid #d32f2f;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.required {
    color: #d32f2f;
    font-size: 16px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group select,
.form-group input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.error-message {
    color: #d32f2f;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ==========================================
   RADIO BUTTONS
   ========================================== */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.radio-label:hover {
    border-color: #d32f2f;
    background: #ffebee;
}

.radio-label input[type="radio"]:checked + span {
    color: #d32f2f;
    font-weight: bold;
}

/* ==========================================
   BOTONES
   ========================================== */
.form-buttons {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-prev,
.btn-next,
.btn-submit,
.btn-reload {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-prev {
    background: #757575;
    color: white;
}

.btn-prev:hover {
    background: #616161;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-next,
.btn-submit {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    color: white;
    flex: 1;
}

.btn-next:hover,
.btn-submit:hover {
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(211, 47, 47, 0.4);
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   MENSAJE DE ÉXITO
   ========================================== */
.success-message {
    text-align: center;
    padding: 60px 30px;
    animation: fadeIn 0.5s ease;
}

.success-message h2 {
    color: #81c784;
    font-size: 36px;
    margin-bottom: 20px;
}

.success-message p {
    color: #333;
    font-size: 18px;
    margin-bottom: 30px;
}

.btn-reload {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 100%);
    color: white;
}

.btn-reload:hover {
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* ==========================================
   PANEL DE ADMINISTRACIÓN
   ========================================== */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.admin-header h1 {
    font-size: 28px;
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: white;
    color: #d32f2f;
}

/* ==========================================
   FILTROS Y BÚSQUEDA
   ========================================== */
.filters-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.filter-group input,
.filter-group select {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-search,
.btn-export-excel,
.btn-clear {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-search {
    background: #d32f2f;
    color: white;
}

.btn-search:hover {
    background: #c62828;
}

.btn-export-excel {
    background: #81c784;
    color: white;
}

.btn-export-excel:hover {
    background: #66bb6a;
}

.btn-clear {
    background: #757575;
    color: white;
}

.btn-clear:hover {
    background: #616161;
}

/* ==========================================
   TABLA DE REGISTROS
   ========================================== */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #d32f2f;
    color: white;
}

.data-table thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

.data-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: #ffebee;
}

.data-table tbody td {
    padding: 12px 15px;
    font-size: 14px;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-edit,
.btn-delete,
.btn-pdf {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #2196f3;
    color: white;
}

.btn-edit:hover {
    background: #1976d2;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #d32f2f;
}

.btn-pdf {
    background: #ff9800;
    color: white;
}

.btn-pdf:hover {
    background: #f57c00;
}

/* ==========================================
   MODAL
   ========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: #d32f2f;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    font-size: 22px;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 25px;
}

.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-save,
.btn-cancel {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save {
    background: #d32f2f;
    color: white;
}

.btn-save:hover {
    background: #c62828;
}

.btn-cancel {
    background: #757575;
    color: white;
}

.btn-cancel:hover {
    background: #616161;
}

/* ==========================================
   LOGIN
   ========================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: #d32f2f;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-box button:hover {
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(211, 47, 47, 0.4);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }

    .header h1 {
        font-size: 20px;
    }

    .progress-bar {
        padding: 20px 10px;
    }

    .progress-step {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    form {
        padding: 20px;
    }

    .form-page h2 {
        font-size: 18px;
    }

    .form-buttons {
        flex-direction: column;
    }

    .btn-prev,
    .btn-next,
    .btn-submit {
        width: 100%;
    }

    .radio-group {
        flex-direction: column;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 800px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }

    .header .logo {
        max-width: 120px;
    }

    .header h1 {
        font-size: 18px;
    }

    .progress-step {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .form-group input,
    .form-group select {
        font-size: 16px; /* Previene zoom en iOS */
    }
}

/* ==========================================
   LOADING SPINNER
   ========================================== */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #d32f2f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   ALERTAS
   ========================================== */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 600;
}

.alert-success {
    background: #c8e6c9;
    color: #2e7d32;
    border-left: 5px solid #4caf50;
}

.alert-error {
    background: #ffcdd2;
    color: #c62828;
    border-left: 5px solid #f44336;
}

.alert-warning {
    background: #fff9c4;
    color: #f57f17;
    border-left: 5px solid #ffeb3b;
}

.alert-info {
    background: #b3e5fc;
    color: #01579b;
    border-left: 5px solid #03a9f4;
}

/* Radio input spacing inside custom radio label */
.radio-label input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}