/**
 * Kalpian Pagos - Estilos del Sistema de Objetivos Personalizado
 */

/* Contenedor principal */
.kalpian-objectives-wrapper {
    background: #f8f9fa;
    border: 2px solid #007cba;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.kalpian-objectives-wrapper .gfield_label {
    font-size: 18px;
    font-weight: 600;
    color: #007cba;
    margin-bottom: 15px;
}

/* Header con información */
.kalpian-objectives-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.header-info {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.header-info span {
    font-size: 14px;
    color: #495057;
}

.header-info strong {
    color: #212529;
}

.percentage-remaining {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    color: #1976d2;
}

.percentage-remaining.warning {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #f57c00;
}

.percentage-remaining.error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #d32f2f;
}

/* Lista de objetivos */
.kalpian-objectives-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Fila de objetivo */
.objective-row {
    display: grid;
    grid-template-columns: 40px 2fr 2.5fr 180px 80px 50px;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
}

.objective-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #007cba;
}

.objective-row input[type="text"],
.objective-row input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

 .objective-row input[type="text"]::placeholder,
 .objective-row input[type="number"]::placeholder {
     color: #c0c4cc;
 }

.objective-row input[type="text"]:focus,
.objective-row input[type="number"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.objective-number {
    font-weight: 700;
    font-size: 16px;
    color: #007cba;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.objective-name {
    font-weight: 500;
}

.objective-detail {
    color: #6c757d;
}

.objective-percentage {
    text-align: center;
}

.objective-amount-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.objective-amount {
    text-align: right;
    width: 100%;
}

/* Botón eliminar */
.remove-objective {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s;
    white-space: nowrap;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-objective:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Botón agregar objetivo */
#kalpian-add-objective {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#kalpian-add-objective:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#kalpian-add-objective:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.kalpian-objectives-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

#kalpian-accept-objectives.button.button-primary {
    background: linear-gradient(135deg, #007cba 0%, #005f8d 100%);
    border: none;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 700;
}

#kalpian-accept-objectives.button.button-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.kalpian-objectives-accepted-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid rgba(76, 175, 80, 0.35);
}

.kalpian-objectives-locked .objective-row {
    opacity: 0.92;
}

.kalpian-objectives-locked .objective-row input[type="text"],
.kalpian-objectives-locked .objective-row input[type="number"] {
    background: #f3f4f6;
    cursor: not-allowed;
}

.kalpian-objectives-locked .remove-objective {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Estado vacío */
.objectives-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.objectives-empty p {
    font-size: 16px;
    margin: 10px 0;
}

/* Resumen en modal */
.kalpian-modal-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
}

.kalpian-modal-summary h3 {
    color: #007cba;
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.summary-row:last-child {
    border-bottom: none;
    font-weight: 600;
    font-size: 18px;
    color: #007cba;
}

/* Modal de confirmación */
.kalpian-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.kalpian-modal.active {
    display: flex;
}

.kalpian-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.kalpian-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.kalpian-modal-header h2 {
    margin: 0;
    color: #007cba;
}

.kalpian-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.2s;
}

.kalpian-modal-close:hover {
    color: #dc3545;
}

.kalpian-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.kalpian-modal-actions button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
}

.kalpian-modal-actions .btn-cancel {
    background: #6c757d;
    color: white;
}

.kalpian-modal-actions .btn-cancel:hover {
    background: #5a6268;
}

.kalpian-modal-actions .btn-confirm {
    background: #007cba;
    color: white;
}

.kalpian-modal-actions .btn-confirm:hover {
    background: #005f8d;
}

/* Validaciones y mensajes */
.validation-message {
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.validation-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.validation-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.validation-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .objective-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .kalpian-objectives-header {
        flex-direction: column;
        gap: 15px;
    }

    .header-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .kalpian-modal-content {
        padding: 20px;
    }
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.objective-row {
    animation: slideIn 0.3s ease-out;
}

/* Tooltip para botón deshabilitado */
#kalpian-add-objective:disabled {
    position: relative;
}

#kalpian-add-objective:disabled::after {
    content: 'Has alcanzado el máximo de objetivos para este pack';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #212529;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 8px;
}

#kalpian-add-objective:disabled:hover::after {
    opacity: 1;
}

/* ===== Estilos para input de porcentaje readonly ===== */

.objective-percentage[readonly] {
    background-color: #f8f9fa !important;
    cursor: not-allowed !important;
    color: #495057 !important;
    border-color: #dee2e6 !important;
}

.objective-percentage[readonly]:focus {
    box-shadow: none !important;
    outline: none !important;
}
