/**
 * Free Form Certificate - Frontend Styles
 * 
 * v2.8.0: Added magic link preview styles
 */

/* ==========================================================================
   1. CORE INPUT STYLE
   ========================================================================== */
.ffc-input {
    width: 100% !important; /* ← 100% do field (que já está em 450px) */
    max-width: none !important; /* ← Remove limitação antiga */
    height: 45px !important;
    padding: 10px 12px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 18px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
    display: block !important;
    margin-bottom: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.ffc-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* ============================================
   FORM CONTAINER & LAYOUT
   ============================================ */
.ffc-form-wrapper {
    max-width: 600px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex; /* ← CENTRALIZAÇÃO */
    flex-direction: column; /* ← CENTRALIZAÇÃO */
    align-items: center; /* ← CENTRALIZAÇÃO */
}

.ffc-form-title {
    margin: 0 0 25px 0;
    font-size: 24px;
    color: #333;
    text-align: center;
    font-weight: 600;
    width: 100%; /* ← Título pega largura total */
}

/* ============================================
   FORM FIELDS
   ============================================ */
.ffc-submission-form {
    width: 100%; /* ← Form pega largura total do wrapper */
    max-width: 450px; /* ← Mas limitado a 450px */
    display: flex; /* ← CENTRALIZAÇÃO */
    flex-direction: column; /* ← CENTRALIZAÇÃO */
    align-items: stretch; /* ← Elementos pegam largura total */
}

.ffc-form-field {
    margin-bottom: 20px;
    width: 100%; /* ← Campo pega largura total do form (450px) */
}

.ffc-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 18px;
}

.ffc-form-field label .required {
    color: #d63638;
    font-weight: bold;
    margin-left: 3px;
}

.ffc-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ffc-radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

/* ============================================
   LGPD CONSENT CHECKBOX - v2.10.0
   ============================================ */

.ffc-lgpd-consent {
    margin: 25px 0 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #0073aa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.ffc-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 0;
    font-weight: normal;
}

.ffc-consent-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 2px 0 0 0;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #0073aa;
}

.ffc-consent-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

.ffc-consent-text a {
    color: #0073aa;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.ffc-consent-text a:hover {
    color: #005a87;
    text-decoration: none;
}

.ffc-consent-text .required {
    color: #d63638;
    font-weight: bold;
    margin-left: 3px;
}

.ffc-consent-description {
    margin: 12px 0 0 32px;
    padding: 12px;
    background: #fff;
    border-left: 3px solid #0073aa;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

.ffc-consent-description a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.ffc-consent-description a:hover {
    text-decoration: underline;
}

/* Checkbox validation states */
.ffc-consent-label input[type="checkbox"]:invalid {
    outline: 2px solid #d63638;
    outline-offset: 2px;
}

.ffc-consent-label input[type="checkbox"]:valid {
    outline: none;
}

.ffc-consent-label input[type="checkbox"]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Error state para validação customizada */
.ffc-lgpd-consent.error {
    border-color: #d63638;
    background: #fff5f5;
}

.ffc-lgpd-consent.error .ffc-consent-text {
    color: #d63638;
}

/* Success state (opcional - quando checkbox marcado) */
.ffc-lgpd-consent.checked {
    border-color: #46a049;
    background: #f0f9f0;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .ffc-lgpd-consent {
        padding: 15px;
        margin: 20px 0 15px 0;
    }
    
    .ffc-consent-label {
        gap: 10px;
    }
    
    .ffc-consent-text {
        font-size: 14px;
    }
    
    .ffc-consent-description {
        margin-left: 0;
        font-size: 12px;
    }
}

/* ============================================
   ACCESSIBILITY - HIGH CONTRAST
   ============================================ */

@media (prefers-contrast: high) {
    .ffc-lgpd-consent {
        border-width: 3px;
        border-color: #000;
    }
    
    .ffc-consent-text {
        color: #000;
    }
    
    .ffc-consent-text a {
        color: #0000EE;
        text-decoration: underline;
    }
}

/* ============================================
   PRINT - HIDE CHECKBOX
   ============================================ */

@media print {
    .ffc-lgpd-consent {
        display: none;
    }
}

/* ============================================
   SECURITY FIELDS
   ============================================ */
.ffc-security-container {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
    width: 100%; /* ← Pega largura total do form (450px) */
}

.ffc-honeypot-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.ffc-captcha-row {
    margin-bottom: 20px;
    padding: 20px; /* ← Padding confortável */
    background: #f0f6fc; /* ← DESTAQUE: fundo azul claro */
    border: 2px solid #0073aa; /* ← DESTAQUE: borda azul */
    border-radius: 8px; /* ← DESTAQUE: bordas arredondadas */
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1); /* ← DESTAQUE: sombra suave */
    width: 100%; /* ← 100% do security-container (450px) */
    box-sizing: border-box; /* ← Padding incluído na largura */
}

.ffc-captcha-row label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600; /* ← DESTAQUE: negrito mais forte */
    color: #0073aa; /* ← DESTAQUE: cor azul */
    font-size: 18px; /* ← DESTAQUE: fonte um pouco maior */
}

.ffc-captcha-row .ffc-input {
    border: 2px solid #0073aa !important; /* ← DESTAQUE: borda azul mais grossa */
    background: #fff !important; /* ← Fundo branco para contraste */
    margin-bottom: 0 !important; /* ← Remove margem inferior */
}

.ffc-captcha-row .ffc-input:focus {
    border-color: #005a87; /* ← DESTAQUE: azul mais escuro no focus */
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2); /* ← Sombra mais visível */
}

/* ============================================
   BUTTONS
   ============================================ */
.ffc-submit-btn {
    width: 100%; /* ← 100% do form (450px) */
    padding: 15px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    box-sizing: border-box; /* ← Padding incluído */
}

.ffc-submit-btn:hover {
    background: #005a87;
}

.ffc-submit-btn:active {
    transform: scale(0.98);
}

.ffc-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   MESSAGES
   ============================================ */
.ffc-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.5;
}

.ffc-message.ffc-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ffc-message.ffc-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================
   VERIFICATION PAGE
   ============================================ */
.ffc-verification-container {
    max-width: 700px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ffc-verification-header {
    margin-bottom: 30px;
    text-align: center;
}

.ffc-verification-header h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.ffc-verification-header p {
    margin: 0;
    color: #666;
    font-size: 18px;
}

/* ============================================
   VERIFICATION FORM (Manual)
   ============================================ */
.ffc-verification-form {
    margin-bottom: 30px;
}

.ffc-verify-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ffc-verify-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 18px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: border-color 0.3s;
}

.ffc-verify-input:focus {
    outline: none;
    border-color: #0073aa;
}

.ffc-verify-input-group .ffc-submit-btn {
    flex: 0 0 120px;
    width: auto;
}

.ffc-no-js-security {
    margin-top: 15px;
}

/* ============================================
   VERIFICATION RESULTS
   ============================================ */
.ffc-verify-result {
    margin-top: 20px;
}

.ffc-verify-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    font-size: 18px;
}

.ffc-verify-success {
    padding: 20px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
}

.ffc-verify-success h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.ffc-verify-success p {
    margin: 10px 0;
    font-size: 18px;
}

.ffc-verify-success hr {
    margin: 15px 0;
    border: none;
    border-top: 1px solid #c3e6cb;
}

.ffc-verify-success h4 {
    margin: 15px 0 10px 0;
    font-size: 18px;
}

.ffc-verify-data-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ffc-verify-data-list li {
    padding: 8px 0;
    border-bottom: 1px solid #c3e6cb;
    font-size: 18px;
}

.ffc-verify-data-list li:last-child {
    border-bottom: none;
}

/* ============================================
   MAGIC LINK - CERTIFICATE PREVIEW (v2.8.0)
   ============================================ */
.ffc-magic-link-container {
    position: relative;
    min-height: 200px;
}

.ffc-certificate-preview {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    border: 2px solid #0073aa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   PREVIEW HEADER (Badge)
   ============================================ */
.ffc-preview-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.ffc-status-badge {
    display: inline-block;
    font-size: 22px;
    font-weight: 600;
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.ffc-status-badge.success {
    background: rgba(212, 237, 218, 0.3);
}

/* ============================================
   PREVIEW BODY (Certificate Details)
   ============================================ */
.ffc-preview-body {
    padding: 30px;
}

.ffc-preview-body h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.ffc-preview-body h4 {
    margin: 25px 0 15px 0;
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

.ffc-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.ffc-detail-row:last-child {
    border-bottom: none;
}

.ffc-detail-row .label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.ffc-detail-row .value {
    color: #333;
    font-size: 14px;
    text-align: right;
    max-width: 60%;
    word-wrap: break-word;
}

.ffc-detail-row .value.code {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #0073aa;
    font-weight: 600;
    letter-spacing: 1px;
}

.ffc-preview-body hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* ============================================
   PREVIEW ACTIONS (Download Button)
   ============================================ */
.ffc-preview-actions {
    padding: 25px 30px;
    text-align: center;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.ffc-download-btn {
    display: inline-block;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.ffc-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
}

.ffc-download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
}

.ffc-download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================
   GEOFENCE - PREVENT FORM FLASH (v3.0.0)
   ============================================ */
/* Hide form initially when geofence is active to prevent flash */
.ffc-has-geofence .ffc-submission-form {
    display: none !important;
}

/* Show form after successful validation */
.ffc-has-geofence.ffc-validated .ffc-submission-form {
    display: block !important;
}

/* Geofence loading message */
.ffc-geofence-loading-msg {
    text-align: center;
    padding: 30px 20px;
}

.ffc-geofence-loading-msg p {
    margin: 20px 0 0 0;
    color: #666;
    font-size: 16px;
}

/* Geofence blocked message */
.ffc-geofence-blocked {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.ffc-geofence-blocked p {
    margin: 0;
    color: #856404;
    font-size: 15px;
}

/* Admin bypass message (informational - blue theme) */
.ffc-geofence-admin-bypass {
    background: #d1ecf1;
    border-left: 4px solid #0c5460;
    padding: 15px 20px;
    margin: 0 0 20px 0;
    border-radius: 4px;
}

.ffc-geofence-admin-bypass p {
    margin: 0;
    color: #0c5460;
    font-size: 15px;
    font-weight: 500;
}

/* ============================================
   LOADING STATE (Magic Link)
   ============================================ */
.ffc-verify-loading {
    text-align: center;
    padding: 60px 20px;
}

.ffc-verify-loading p {
    margin: 20px 0 0 0;
    color: #666;
    font-size: 18px;
}

.ffc-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .ffc-form-wrapper,
    .ffc-verification-container,
    .ffc-certificate-preview {
        padding: 20px;
        margin: 15px;
    }

    .ffc-form-title,
    .ffc-verification-header h2 {
        font-size: 18px;
    }

    .ffc-verify-input-group {
        flex-direction: column;
    }

    .ffc-verify-input-group .ffc-submit-btn {
        flex: 1;
        width: 100%;
    }

    .ffc-detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ffc-detail-row .value {
        text-align: left;
        max-width: 100%;
    }

    .ffc-download-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 18px;
    }

    .ffc-preview-body h3 {
        font-size: 18px;
    }

    .ffc-status-badge {
        font-size: 18px;
    }
}

/* ============================================
   PRINT STYLES (Hide UI elements when printing)
   ============================================ */
@media print {
    .ffc-preview-header,
    .ffc-preview-actions,
    .ffc-verify-input-group,
    .ffc-submit-btn {
        display: none !important;
    }

    .ffc-certificate-preview {
        border: none;
        box-shadow: none;
    }
}
/* ==========================================================================
   SUCCESS PAGE STYLES - v2.9.13
   Only truly new classes (no duplicates)
   ========================================================================== */
.ffc-success-container {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

.ffc-success-icon {
    width: 80px;
    height: 80px;
    background: #00a32a;
    color: white;
    font-size: 50px;
    line-height: 80px;
    border-radius: 50%;
    margin: 0 auto 20px;
    text-align: center;
}

.ffc-success-title {
    color: #1d2327;
    margin-bottom: 20px;
}

.ffc-auth-code {
    background: #f0f0f1;
    padding: 5px 10px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 18px;
}

/* ✅ v3.1.0 Phase 3: Removed .ffc-success-actions (never used in templates) */