/**
 * CSS para Seção Dispositivo Confiável - Design Profissional
 * Interface moderna e intuitiva para configuração de dispositivos confiáveis
 */

/* ========================================
   CONTAINER PRINCIPAL
======================================== */
.trusted-device-section {
    margin: var(--space-4) 0;
    width: 100%;
}

.trusted-device-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.trusted-device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981 0%, #059669 50%, #047857 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.trusted-device-card:hover {
    border-color: #10b981;
    box-shadow: 0 4px 20px -2px rgba(16, 185, 129, 0.15);
    transform: translateY(-1px);
}

/* ========================================
   HEADER PRINCIPAL
======================================== */
.trusted-device-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.checkbox-container-modern {
    flex: 1;
    display: flex;
    align-items: center;
}

.trusted-checkbox {
    display: none;
}

.trusted-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    user-select: none;
    flex: 1;
}

.trusted-checkbox-label:hover {
    background: rgba(16, 185, 129, 0.05);
}

.checkbox-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-lg);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.trusted-checkbox:checked + .trusted-checkbox-label .checkbox-icon {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.checkbox-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checkbox-title {
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.2;
}

.checkbox-description {
    font-size: var(--text-info);
    color: var(--gray-600);
    line-height: 1.3;
}

.trusted-device-help-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.trusted-device-help-btn:hover {
    background: white;
    border-color: #10b981;
    color: #10b981;
    transform: scale(1.05);
}

/* ========================================
   BENEFÍCIOS
======================================== */
.trusted-device-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-2);
    margin: var(--space-3) 0;
    padding: var(--space-3);
    background: rgba(16, 185, 129, 0.05);
    border-radius: var(--radius-lg);
    border-left: 3px solid #10b981;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--gray-700);
    font-weight: 500;
}

.benefit-item i {
    color: #10b981;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* ========================================
   CONFIGURAÇÕES AVANÇADAS
======================================== */
.trusted-device-config {
    margin-top: var(--space-4);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.config-divider {
    display: flex;
    align-items: center;
    margin: var(--space-4) 0 var(--space-3);
    text-align: center;
    position: relative;
}

.config-divider::before {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
}

.config-divider span {
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-600);
    background: #f8fafc;
}

.trusted-device-fields {
    display: grid;
    gap: var(--space-4);
}

/* ========================================
   CAMPOS DO FORMULÁRIO
======================================== */
.field-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.field-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
}

.field-label i {
    color: #10b981;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.field-input,
.field-select {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 400;
    background: white;
    transition: all 0.2s ease;
    color: var(--gray-900);
}

.field-input:focus,
.field-select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.field-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.field-select {
    cursor: pointer;
    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 var(--space-3) center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: var(--space-8);
}

.field-hint {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
    font-style: italic;
}

.field-hint i {
    color: #10b981;
    font-size: 10px;
}

/* ========================================
   ESTADOS ESPECIAIS
======================================== */

/* Dispositivo já confiável */
.trusted-device-section.device-already-trusted .trusted-device-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
}

.trusted-device-section.device-already-trusted .trusted-device-card::before {
    background: linear-gradient(90deg, #059669 0%, #047857 50%, #065f46 100%);
}

.device-trusted-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.device-trusted-indicator i {
    font-size: var(--text-lg);
}

/* Checkbox desabilitado */
.trusted-checkbox:disabled + .trusted-checkbox-label {
    opacity: 0.6;
    cursor: not-allowed;
}

.trusted-checkbox:disabled + .trusted-checkbox-label:hover {
    background: transparent;
}

/* ========================================
   RESPONSIVIDADE
======================================== */
@media (max-width: 768px) {
    .trusted-device-card {
        padding: var(--space-3);
    }
    
    .trusted-device-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }
    
    .trusted-device-help-btn {
        align-self: flex-end;
    }
    
    .trusted-device-benefits {
        grid-template-columns: 1fr;
        gap: var(--space-1);
        padding: var(--space-2);
    }
    
    .benefit-item {
        font-size: 12px;
    }
    
    .checkbox-icon {
        width: 36px;
        height: 36px;
        font-size: var(--text-base);
    }
    
    .checkbox-title {
        font-size: var(--text-caption);
    }
    
    .checkbox-description {
        font-size: var(--text-info);
    }
}

@media (max-width: 480px) {
    .trusted-device-card {
        padding: var(--space-2);
    }
    
    .trusted-device-benefits {
        padding: var(--space-1);
    }
    
    .benefit-item {
        font-size: 11px;
        gap: var(--space-1);
    }
    
    .benefit-item i {
        font-size: 12px;
        width: 14px;
    }
    
    .checkbox-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .field-input,
    .field-select {
        padding: var(--space-2);
        font-size: 12px;
    }
    
    .field-label {
        font-size: 12px;
    }
    
    .field-hint {
        font-size: 10px;
    }
}

/* ========================================
   ANIMAÇÕES
======================================== */
@keyframes checkboxPulse {
    0% {
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    }
    100% {
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
    }
}

.trusted-checkbox:checked + .trusted-checkbox-label .checkbox-icon {
    animation: checkboxPulse 1s ease-in-out;
}

/* Transições suaves para mostrar/ocultar configurações */
.trusted-device-config[style*="display: none"] {
    display: block !important;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.trusted-device-config[style*="display: block"] {
    opacity: 1;
    max-height: 300px;
    transition: all 0.3s ease;
}