/* Estilos generales del formulario de avisos - OPTIMIZADO VISUALMENTE */
#ap-form {
    max-width: 1100px;
    margin: 0 auto;
    font-family: Arial, sans-serif;
}
.ap-form {
    max-width: 1100px;
    margin: 14px auto;
    padding: 10px;
    border-radius: 6px;
}

/* Etiquetas y Hints (compactación de entrelineas y espaciado) */
.ap-form label,
.ap-section label {
    font-style: normal;
    font-size: 16px;
    font-weight: 600;
    color: #504247;
    display: block;
    margin-bottom: 2px; /* Mínima separación con el hint/input */
}
.ap-hint {
    font-size: 13px;
    font-weight: 400;
    color: #666;
    font-style: italic;
    margin-bottom: 3px; /* Espaciado muy reducido */
    display: block;
    line-height: 1.2; /* Linea más corta para compactar verticalmente */
}

/* Bloques de sección (Fondo gris suave y compactación) */
.ap-section {
    border: 2px solid #cd004b;
    border-radius: 12px; /* Ligeramente más redondo */
    padding: 14px; /* Menos padding interno */
    margin-bottom: 12px; /* Menos margen entre secciones */
    background: #eeeeee; /* Gris suave que no lastima la vista */
    transition: all 0.15s ease;
}
.ap-section.ap-active {
    border-color: #cd004b;  /* #cd004b;
    background: #eeecec; /* Blanco para destacar la sección activa */
    box-shadow: 0 4px 12px rgba(242, 92, 116, 0.08); /* Sombra suave */
}
.ap-inactive {
    display: none;
}
.ap-active {
    display: block;
}
.ap-title-section {
    color: #504247;
    font-weight: 800;
    margin-bottom: 8px; /* Reducido */
}
.ap-section[data-plan="contratante"] {
    background-color: #edf0f3;
    border-color: #0091cd;
}
.ap-section.ap-comprobante {
    background-color: #eef1ef;
    border-color: #6ca080;
}

/* Filas y Columnas (compactación de gaps) */
.ap-row {
    display: flex;
    gap: 10px; /* Reducido a 10px */
    flex-wrap: wrap;
    margin-bottom: 8px; /* Reducido a 8px */
}
.ap-col {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
}
.ap-col[style*="span 3"],
.ap-col[style*="grid-column: span"] {
    flex: 1 1 100%;
    min-width: 100%;
}

/* Campos de formulario (compactación vertical) */
.ap-section input,
.ap-section select,
.ap-section textarea {
    width: 100%;
    border-radius: 6px; /* Ligeramente menos redondo */
    border: 2px solid #ddd;
    padding: 6px 10px;
    height: auto;
    margin-bottom: 4px; /* Reducido para compactar */
    transition: border-color 0.2s ease;
    line-height: 1.4;
    box-sizing: border-box;
}
.ap-section input:focus,
.ap-section select:focus,
.ap-section textarea:focus {
    border-color: #b7295a;
    outline: none;
    box-shadow: 0 0 0 2px rgba(183, 41, 90, 0.1);
}
.ap-disabled,
.ap-section.ap-inactive input,
.ap-section.ap-inactive select,
.ap-section.ap-inactive textarea {
    background: #e5e5e5;
    color: #999;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Botón de envío */
.ap-submit {
    background: #b7295a;
    color: #fff;
    padding: 10px 18px; /* Ligeramente más alto */
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}
.ap-submit:hover {
    background: #9a1f48;
    color: #cbb8c0;
    transform: translateY(-1px);
}

/* Archivos */
.ap-section input[type="file"] {
    color: transparent;
    padding: 8px;
}
.ap-section input[type="file"]::file-selector-button,
.ap-section input[type="file"]::-webkit-file-upload-button {
    margin-right: 10px;
    padding: 6px 12px;
    background: #b7295a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.ap-section input[type="file"]::file-selector-button:hover {
    background: #9a1f48;
}

.ap-section input[type="file"]:not([value])::after,
.ap-section input[type="file"][value=""]::after {
    content: "Aún nada";
    color: #999;
    font-size: 13px;
    font-style: italic;
    display: inline-block;
    margin-left: 10px;
    pointer-events: none;
}

/* Popup de éxito - FORZADO CON !IMPORTANT */
#apSuccessPopup,
.ap-success-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 999999 !important;
    backdrop-filter: blur(5px);
    animation: ap-fade-in 0.3s ease;
}

#apSuccessPopup[style*="flex"],
.ap-success-popup[style*="flex"] {
    display: flex !important;
}

.ap-success-content {
    background: linear-gradient(135deg, #4caf50, #45a049, #66bb6a) !important;
    color: white !important;
    padding: 30px !important;
    border-radius: 20px !important;
    text-align: center !important;
    box-shadow: 0 20px 60px rgba(76, 175, 80, 0.3), 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    max-width: 500px !important;
    width: 90% !important;
    position: relative !important;
    animation: ap-popup-scale 0.4s ease forwards;
    border: 3px solid rgba(255, 255, 255, 0.2) !important;
}

.ap-success-content:before {
    content: "✓";
    display: block;
    font-size: 60px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    animation: ap-check-bounce 0.6s ease 0.2s both;
    line-height: 1;
}

.ap-success-content p {
    font-size: 18px;
    line-height: 1.3;
    margin: 0 0 20px 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

.ap-success-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.ap-success-buttons .ap-btn {
    padding: 12px 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #4caf50;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    min-width: 160px;
    cursor: pointer;
    line-height: 1.2;
}

.ap-success-buttons .ap-btn:hover {
    background: #fff;
    color: #388e3c;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.ap-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

@keyframes ap-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ap-popup-scale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes ap-check-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Media Query para responsividad */
@media (max-width: 768px) {
    .ap-row {
        flex-direction: column;
    }
    .ap-col {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .ap-success-content {
        padding: 25px 20px;
        margin: 20px;
    }
    .ap-success-content:before {
        font-size: 50px;
        margin-bottom: 12px;
    }
    .ap-success-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .ap-success-buttons .ap-btn {
        width: 100%;
    }
}

/* Estilos para preview de imágenes */
.ap-image-preview-wrapper {
    margin-top: 10px;
}

.ap-image-loader {
    padding: 15px;
    background: #f0f6fc;
    border: 2px dashed #0073aa;
    border-radius: 6px;
    text-align: center;
    color: #0073aa;
    font-weight: 600;
}

.ap-image-loader .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(0, 115, 170, 0.3);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: ap-spin 0.8s linear infinite;
}

@keyframes ap-spin {
    to { transform: rotate(360deg); }
}

.ap-image-preview-box {
    padding: 12px;
    background: #f0f9ff;
    border: 2px solid #4caf50;
    border-radius: 8px;
    margin-top: 10px;
}

.ap-image-thumbnail {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ap-file-info {
    text-align: center;
    margin-bottom: 10px;
}

.ap-file-info strong {
    display: block;
    color: #155724;
    font-size: 14px;
    margin-bottom: 4px;
}

.ap-file-info small {
    color: #666;
    font-size: 12px;
}

.ap-btn-remove-image {
    display: block;
    width: 100%;
    padding: 8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}

.ap-btn-remove-image:hover {
    background: #c82333;
    transform: translateY(-1px);
}