/* ===== ESTILOS ESPECÍFICOS PARA FORMULARIOS RESPONSIVOS ===== */

/* Contenedor principal de formularios */
.form-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    padding: 2rem;
    margin: 2rem 0;
}

/* Campos de formulario */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.95rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
    color: #2c3e50;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    transform: translateY(-2px);
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}

.form-control.is-valid, .form-select.is-valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 0.2rem rgba(39, 174, 96, 0.25);
}

/* Textarea */
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Campos de archivo */
.form-control[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #e9ecef;
    background: #f8f9fa;
    cursor: pointer;
}

.form-control[type="file"]:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

/* Checkbox y Radio personalizados */
.form-check {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #3498db;
    border-color: #3498db;
}

.form-check-label {
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
    user-select: none;
}

/* Botones de formulario */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid #3498db;
    color: #3498db;
}

.btn-outline-primary:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

/* Tamaños de botones */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
}

/* Botones de ancho completo */
.btn-block {
    width: 100%;
    display: block;
}

/* Grupos de botones */
.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Mensajes de validación */
.invalid-feedback {
    display: block;
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.valid-feedback {
    display: block;
    color: #27ae60;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Iconos en formularios */
.form-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 2;
}

.form-control-with-icon {
    padding-left: 3rem;
}

/* Campos de fecha y hora */
.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"] {
    padding: 0.75rem 1rem;
}

/* Campos de número */
.form-control[type="number"] {
    -moz-appearance: textfield;
}

.form-control[type="number"]::-webkit-outer-spin-button,
.form-control[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Campos de búsqueda */
.form-control[type="search"] {
    padding-left: 3rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 1rem;
}

/* Campos de contraseña */
.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    z-index: 2;
}

.password-toggle:hover {
    color: #3498db;
}

/* Campos de teléfono */
.form-control[type="tel"] {
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* Campos de email */
.form-control[type="email"] {
    text-transform: lowercase;
}

/* Campos de URL */
.form-control[type="url"] {
    font-family: monospace;
}

/* ===== RESPONSIVE DESIGN PARA FORMULARIOS ===== */

/* Tablets */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
        margin: 1rem 0;
        border-radius: 12px;
    }
    
    .form-control, .form-select {
        padding: 0.75rem 0.875rem;
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* Móviles */
@media (max-width: 576px) {
    .form-container {
        padding: 1rem;
        margin: 0.5rem 0;
        border-radius: 10px;
    }
    
    .form-control, .form-select {
        padding: 0.875rem 0.75rem;
        font-size: 16px; /* Evitar zoom en iOS */
        border-radius: 8px;
    }
    
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.375rem;
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .btn-lg {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    /* Campos de fecha en móviles */
    .form-control[type="date"],
    .form-control[type="time"],
    .form-control[type="datetime-local"] {
        padding: 0.75rem;
        font-size: 16px;
    }
    
    /* Checkbox y radio en móviles */
    .form-check {
        margin-bottom: 1rem;
    }
    
    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
        margin-right: 1rem;
    }
    
    .form-check-label {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* Mensajes de validación en móviles */
    .invalid-feedback,
    .valid-feedback {
        font-size: 0.8rem;
        margin-top: 0.375rem;
    }
}

/* Móviles muy pequeños */
@media (max-width: 375px) {
    .form-container {
        padding: 0.75rem;
        border-radius: 8px;
    }
    
    .form-control, .form-select {
        padding: 0.75rem 0.625rem;
        font-size: 16px;
        border-radius: 6px;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border-radius: 6px;
    }
    
    .form-label {
        font-size: 0.85rem;
    }
    
    /* Iconos en móviles pequeños */
    .form-icon {
        left: 0.75rem;
        font-size: 0.9rem;
    }
    
    .form-control-with-icon {
        padding-left: 2.5rem;
    }
}

/* ===== OPTIMIZACIÓN DE MAPAS RESPONSIVE ===== */

/* Tablets */
@media (max-width: 768px) {
    #mapaUbicacion {
        height: 300px;
        margin: 1rem 0;
    }
    
    .mapboxgl-ctrl-group {
        transform: scale(0.9);
    }
    
    .mapboxgl-ctrl-zoom {
        margin-bottom: 0.5rem;
    }
    
    .mapboxgl-ctrl-geolocate {
        margin-bottom: 0.5rem;
    }
}

/* Móviles */
@media (max-width: 576px) {
    #mapaUbicacion {
        height: 250px;
        margin: 1rem 0;
        border-radius: 8px;
    }
    
    .mapboxgl-ctrl-group {
        transform: scale(0.8);
    }
    
    .mapboxgl-ctrl-zoom {
        margin-bottom: 0.5rem;
    }
    
    .mapboxgl-ctrl-geolocate {
        margin-bottom: 0.5rem;
    }
    
    .mapboxgl-ctrl-top-right {
        top: 10px;
        right: 10px;
    }
    
    .mapboxgl-ctrl-top-left {
        top: 10px;
        left: 10px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 375px) {
    #mapaUbicacion {
        height: 200px;
    }
    
    .mapboxgl-ctrl-group {
        transform: scale(0.7);
    }
}

/* ===== ANIMACIONES PARA FORMULARIOS ===== */

@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-container {
    animation: formSlideIn 0.5s ease-out;
}

@keyframes fieldFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.form-control:focus,
.form-select:focus {
    animation: fieldFocus 0.3s ease-out;
}

/* ===== ESTADOS ESPECIALES ===== */

/* Formulario deshabilitado */
.form-container.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.form-control:disabled,
.form-select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Formulario de carga */
.form-container.loading {
    position: relative;
}

.form-container.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

.form-container.loading::before {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 11;
}

/* ===== UTILIDADES ===== */

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.form-required {
    color: #e74c3c;
    margin-left: 0.25rem;
}

.form-hint {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
    margin-top: 0.25rem;
}

.form-divider {
    height: 1px;
    background: #e9ecef;
    margin: 2rem 0;
    border: none;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
    display: inline-block;
} 