/**
 * Copyright © ApdSuite. All rights reserved.
 * APD Suite - Callback Modal Professional Styles
 */

/* CSS Custom Properties for easy theming */
:root {
    --apdsuite-modal-max-width: 620px; /* Sweet spot para 2 columnas */
    --apdsuite-modal-padding: 2rem;
    --apdsuite-modal-border-radius: 8px;
    --apdsuite-modal-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    --apdsuite-form-gap: 1.5rem;
    --apdsuite-field-gap: 1.2rem;
    --apdsuite-input-height: 44px;
    --apdsuite-input-border: 1px solid #d1d5db;
    --apdsuite-input-border-focus: 1px solid #3b82f6;
    --apdsuite-input-border-radius: 6px;
    --apdsuite-button-bg: #1e40af;
    --apdsuite-button-bg-hover: #1d4ed8;
    --apdsuite-button-text: #ffffff;
    --apdsuite-button-padding: 12px 32px;
    --apdsuite-button-border-radius: 6px;
    --apdsuite-label-color: #000000; /* NEGRO PURO - SIEMPRE VISIBLE */
    --apdsuite-text-color: #000000; /* BACKUP COLOR */
    --apdsuite-label-weight: 600; /* MÁS BOLD PARA VISIBILIDAD */
    /* Typography variables - PX DIRECTO */
    --apdsuite-font-size-base: 16px;
    --apdsuite-font-size-title: 24px;
    --apdsuite-font-size-label: 16px; /* MÁS GRANDE Y VISIBLE */
    --apdsuite-font-size-input: 16px;
    --apdsuite-font-size-button: 16px;
    --apdsuite-font-size-error: 14px;
}

/* Modal Container - SÚPER SIMPLE con clase específica */
.modal-inner-wrap.apdsuite-callback-modal-wrap {
    max-width: var(--apdsuite-modal-max-width) !important;
    width: 90% !important;
    margin: 2rem auto !important;
    border-radius: var(--apdsuite-modal-border-radius);
    box-shadow: var(--apdsuite-modal-shadow);
    font-size: var(--apdsuite-font-size-base) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

.apdsuite-callback-modal .modal-content {
    padding: var(--apdsuite-modal-padding);
    border-radius: var(--apdsuite-modal-border-radius);
    font-size: var(--apdsuite-font-size-base);
    line-height: 1.5;
    color: var(--apdsuite-label-color) !important;
}

/* FORZAR COLOR EN TODOS LOS ELEMENTOS DE TEXTO (excepto inputs y botones) */
.apdsuite-callback-modal *:not(input):not(button):not(select),
.modal-inner-wrap.apdsuite-callback-modal-wrap *:not(input):not(button):not(select) {
    color: inherit !important;
}

/* ASTERISCOS ROJOS - SELECTOR SÚPER ESPECÍFICO */
.apdsuite-callback-modal .field.required .label span span,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field.required .label span span {
    color: #dc2626 !important;
    font-weight: bold !important;
    font-size: inherit !important;
}

/* Modal Header */
.apdsuite-callback-modal .modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: var(--apdsuite-form-gap);
}

/* TÍTULO - FORZAR NEGRO SUPER AGRESIVO */
.apdsuite-callback-modal .modal-title,
.modal-inner-wrap.apdsuite-callback-modal-wrap .modal-title {
    font-size: 24px !important; /* 24PX DIRECTO */
    font-weight: 600 !important;
    color: #000000 !important; /* NEGRO PURO DIRECTO */
    margin: 0;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    line-height: 1.3 !important;
}

/* Form Layout - 2 Columns */
.apdsuite-callback-modal .form {
    display: grid;
    gap: var(--apdsuite-form-gap);
}

.apdsuite-callback-modal .fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--apdsuite-field-gap);
    border: none;
    margin: 0;
    padding: 0;
}

/* Department in second column */
.apdsuite-callback-modal .field-department {
    grid-column: 2; /* Segunda columna */
}

/* Field Styling */
.apdsuite-callback-modal .field {
    margin-bottom: 0;
}

/* LABELS - FORZAR COLOR NEGRO SUPER AGRESIVO */
.apdsuite-callback-modal .field .label,
.apdsuite-callback-modal .field .label span,
.apdsuite-callback-modal .fieldset .field .label,
.apdsuite-callback-modal .fieldset .field .label span,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field .label,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field .label span {
    margin-bottom: 0.5rem;
    font-weight: var(--apdsuite-label-weight) !important;
    color: #000000 !important; /* NEGRO PURO DIRECTO */
    font-size: 16px !important; /* 16PX DIRECTO */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    line-height: 1.4 !important;
}

/* ELIMINAR TODOS LOS ASTERISCOS CSS - USAR SOLO HTML */
.apdsuite-callback-modal .field.required .label:after,
.apdsuite-callback-modal .field.required .label span:after,
.apdsuite-callback-modal .field.required .label:before,
.apdsuite-callback-modal .field.required .label span:before,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field.required .label:after,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field.required .label span:after,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field.required .label:before,
.modal-inner-wrap.apdsuite-callback-modal-wrap .field.required .label span:before {
    content: none !important;
    display: none !important;
}

/* Input and Select Styling */
.apdsuite-callback-modal .control {
    position: relative;
}

.apdsuite-callback-modal .input-text,
.apdsuite-callback-modal .select {
    width: 100%;
    height: var(--apdsuite-input-height);
    padding: 0.75rem;
    border: var(--apdsuite-input-border);
    border-radius: var(--apdsuite-input-border-radius);
    font-size: var(--apdsuite-font-size-input);
    font-family: inherit;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    background-color: #ffffff;
    box-sizing: border-box;
}

.apdsuite-callback-modal .input-text:focus,
.apdsuite-callback-modal .select:focus {
    border: var(--apdsuite-input-border-focus);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.apdsuite-callback-modal .input-text::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Select specific styling */
.apdsuite-callback-modal .select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Actions Toolbar - Centered Button */
.apdsuite-callback-modal .actions-toolbar {
    margin-top: var(--apdsuite-form-gap);
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
}

.apdsuite-callback-modal .actions-toolbar .primary {
    margin: 0;
}

/* Submit Button Styling */
.apdsuite-callback-modal .action.submit {
    background-color: var(--apdsuite-button-bg);
    color: var(--apdsuite-button-text);
    padding: var(--apdsuite-button-padding);
    border: none;
    border-radius: var(--apdsuite-button-border-radius);
    font-size: var(--apdsuite-font-size-button);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    min-width: 120px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apdsuite-callback-modal .action.submit:hover {
    background-color: var(--apdsuite-button-bg-hover);
    transform: translateY(-1px);
}

.apdsuite-callback-modal .action.submit:active {
    transform: translateY(0);
}

/* Validation Error Styling */
.apdsuite-callback-modal .field-error .input-text,
.apdsuite-callback-modal .field-error .select {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.apdsuite-callback-modal .mage-error {
    color: #dc2626;
    font-size: var(--apdsuite-font-size-error);
    font-family: inherit;
    margin-top: 0.25rem;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --apdsuite-modal-max-width: 90vw; /* Buen ancho en tablet */
        --apdsuite-modal-padding: 1.5rem;
        --apdsuite-form-gap: 1.2rem;
        --apdsuite-field-gap: 1rem;
    }
    
    .modal-inner-wrap.apdsuite-callback-modal-wrap {
        margin: 1rem auto !important;
        max-width: var(--apdsuite-modal-max-width) !important;
        width: 95% !important;
    }
    
    /* Stack fields on mobile */
    .apdsuite-callback-modal .fieldset {
        grid-template-columns: 1fr;
    }
    
    .apdsuite-callback-modal .field-department {
        grid-column: 1;
    }
}

@media (max-width: 480px) {
    :root {
        --apdsuite-modal-max-width: 96vw; /* Pantalla completa en móvil */
        --apdsuite-modal-padding: 1rem;
        --apdsuite-button-padding: 10px 24px;
    }
    
    .modal-inner-wrap:has(.apdsuite-callback-modal),
    .modal-inner-wrap:has(#callback-modal),
    .modal-inner-wrap.apdsuite-callback-modal-wrap {
        margin: 0.5rem auto !important;
        max-width: var(--apdsuite-modal-max-width) !important;
        width: 96% !important;
    }
    
    .apdsuite-callback-modal .modal-title {
        font-size: 1.25rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --apdsuite-input-border: 1px solid #4b5563;
        --apdsuite-input-border-focus: 1px solid #60a5fa;
        --apdsuite-label-color: #f3f4f6;
    }
    
    .apdsuite-callback-modal .input-text,
    .apdsuite-callback-modal .select {
        background-color: #1f2937;
        color: #f3f4f6;
    }
    
    .apdsuite-callback-modal .modal-content {
        background-color: #111827;
    }
}

/* Loading state for form submission */
.apdsuite-callback-modal .loading .action.submit {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.apdsuite-callback-modal .loading .action.submit::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Close button styling */
.apdsuite-callback-modal .action-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease-in-out;
}

.apdsuite-callback-modal .action-close:hover {
    color: #374151;
} 

/* Message styles for validation feedback */
.apdsuite-message {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--apdsuite-input-border-radius);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.apdsuite-message--error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.apdsuite-message--success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.apdsuite-message--notice {
    background-color: #fffbeb;
    border: 1px solid #fed7aa;
    color: #ea580c;
}

/* Enhanced field validation states */
.apdsuite-callback-modal .field.mage-error input,
.apdsuite-callback-modal .field.mage-error select {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* Honeypot field (hidden from bots) */
.apdsuite-callback-modal input[name="website_url"] {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}