/* ========================================
   CHECKBOXES CUSTOMIZADOS
   Estilizados para todos os temas
   ======================================== */

/* Esconder checkbox nativo */
.custom-checkbox input[type="checkbox"],
.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    min-height: 0;
    min-width: 0;
}

/* ========================
   CHECKBOX ESTILO QUADRADO
   ======================== */

.custom-checkbox {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 32px;
    min-height: 24px;
    line-height: 24px;
}

.custom-checkbox .checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background: var(--bg-input, #12121F);
    border: 2px solid var(--border-color, #2A2A40);
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* Hover */
.custom-checkbox:hover .checkmark {
    border-color: var(--primary, #E85D04);
    background: rgba(232, 93, 4, 0.1);
}

/* Quando marcado */
.custom-checkbox input:checked ~ .checkmark {
    background: var(--primary, #E85D04);
    border-color: var(--primary, #E85D04);
}

/* Ícone do check */
.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0.9);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Mostrar ícone quando marcado */
.custom-checkbox input:checked ~ .checkmark:after {
    opacity: 1;
    transform: rotate(45deg) scale(1);
}

/* Focus */
.custom-checkbox input:focus ~ .checkmark {
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

.custom-checkbox input:focus-visible ~ .checkmark {
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

/* ==========================================
   TOGGLE SWITCH (INTERRUPTOR)
   ========================================== */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch .toggle-slider {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--bg-input, #12121F);
    border: 2px solid var(--border-color, #2A2A40);
    border-radius: 999px;
    transition: all 0.3s ease;
}

.toggle-switch .toggle-slider:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--text-primary, #FFFFFF);
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* Checked */
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary, #E85D04);
    border-color: var(--primary, #E85D04);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translate(24px, -50%);
}

/* Hover */
.toggle-switch:hover .toggle-slider {
    border-color: var(--primary, #E85D04);
}

/* Focus */
.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

/* ==========================================
   GRUPOS DE CHECKBOXES EM FORMULÁRIOS
   ========================================== */
.checkbox-group,
.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 15px;
    background: var(--bg-card, #1A1A2E);
    border: 1px solid var(--border-color, #2A2A40);
    border-radius: var(--radius-md, 10px);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.checkbox-group:hover,
.toggle-group:hover {
    border-color: var(--primary, #E85D04);
    background: rgba(232, 93, 4, 0.05);
}

.checkbox-group .checkbox-info,
.toggle-group .toggle-info {
    flex: 1;
}

.checkbox-group .checkbox-title,
.toggle-group .toggle-title {
    font-weight: 600;
    color: var(--text-primary, #FFFFFF);
    margin-bottom: 3px;
}

.checkbox-group .checkbox-description,
.toggle-group .toggle-description {
    font-size: 0.85rem;
    color: var(--text-muted, #6C6C7E);
}

/* ==========================================
   CHECKBOXES INLINE (LISTA)
   ========================================== */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-input, #12121F);
    border: 1px solid var(--border-color, #2A2A40);
    border-radius: var(--radius-md, 10px);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.checkbox-inline:hover {
    border-color: var(--primary, #E85D04);
    background: rgba(232, 93, 4, 0.05);
}

.checkbox-inline input[type="checkbox"] {
    position: relative;
    opacity: 1;
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-card, #1A1A2E);
    border: 2px solid var(--border-color, #2A2A40);
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-inline input[type="checkbox"]:hover {
    border-color: var(--primary, #E85D04);
}

.checkbox-inline input[type="checkbox"]:checked {
    background: var(--primary, #E85D04);
    border-color: var(--primary, #E85D04);
}

.checkbox-inline input[type="checkbox"]:indeterminate {
    background: var(--primary, #E85D04);
    border-color: var(--primary, #E85D04);
}

.checkbox-inline input[type="checkbox"]:indeterminate::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 10px;
    width: 12px;
    height: 2px;
    background: #fff;
}

.checkbox-inline input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-inline input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

.checkbox-inline input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

.checkbox-inline .checkbox-label {
    flex: 1;
    color: var(--text-primary, #FFFFFF);
}

.checkbox-inline .checkbox-description {
    font-size: 0.85rem;
    color: var(--text-muted, #6C6C7E);
}

/* ==========================================
   ESTILO GLOBAL PARA INPUTS CHECKBOX
   Aplica automaticamente em qualquer checkbox
   ========================================== */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    background: var(--bg-input, #12121F);
    border: 2px solid var(--border-color, #2A2A40);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    vertical-align: middle;
    margin: 0;
}

input[type="checkbox"]:hover {
    border-color: var(--primary, #E85D04);
    background: rgba(232, 93, 4, 0.1);
}

input[type="checkbox"]:checked {
    background: var(--primary, #E85D04);
    border-color: var(--primary, #E85D04);
}

input[type="checkbox"]:checked::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.3);
}

input[type="checkbox"]:indeterminate {
    background: var(--primary, #E85D04);
    border-color: var(--primary, #E85D04);
}

input[type="checkbox"]:indeterminate::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 10px;
    width: 12px;
    height: 2px;
    background: #fff;
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   TEMA CLARO
   ========================================== */
.light-theme input[type="checkbox"],
[data-theme="light"] input[type="checkbox"] {
    background: #FFFFFF;
    border-color: #DEE2E6;
}

.light-theme input[type="checkbox"]:hover,
[data-theme="light"] input[type="checkbox"]:hover {
    background: rgba(232, 93, 4, 0.1);
    border-color: var(--primary, #E85D04);
}

.light-theme .custom-checkbox .checkmark,
[data-theme="light"] .custom-checkbox .checkmark {
    background: #FFFFFF;
    border-color: #DEE2E6;
}

.light-theme .toggle-switch .toggle-slider,
[data-theme="light"] .toggle-switch .toggle-slider {
    background: #FFFFFF;
    border-color: #DEE2E6;
}

.light-theme .checkbox-group,
[data-theme="light"] .checkbox-group,
.light-theme .toggle-group,
[data-theme="light"] .toggle-group {
    background: #FFFFFF;
    border-color: #DEE2E6;
}

.light-theme .checkbox-inline,
[data-theme="light"] .checkbox-inline {
    background: #FFFFFF;
    border-color: #DEE2E6;
}

.light-theme .checkbox-inline input[type="checkbox"],
[data-theme="light"] .checkbox-inline input[type="checkbox"] {
    background: #FFFFFF;
    border-color: #DEE2E6;
}

.light-theme .checkbox-group .checkbox-title,
[data-theme="light"] .checkbox-group .checkbox-title,
.light-theme .toggle-group .toggle-title,
[data-theme="light"] .toggle-group .toggle-title,
.light-theme .checkbox-inline .checkbox-label,
[data-theme="light"] .checkbox-inline .checkbox-label {
    color: #212529;
}

.light-theme .checkbox-group .checkbox-description,
[data-theme="light"] .checkbox-group .checkbox-description,
.light-theme .toggle-group .toggle-description,
[data-theme="light"] .toggle-group .toggle-description,
.light-theme .checkbox-inline .checkbox-description,
[data-theme="light"] .checkbox-inline .checkbox-description {
    color: #6C757D;
}

.light-theme .toggle-switch .toggle-slider:before,
[data-theme="light"] .toggle-switch .toggle-slider:before {
    background: #212529;
}

/* ==========================================
   RESPONSIVIDADE
   ========================================== */
@media (max-width: 576px) {
    .checkbox-group,
    .toggle-group,
    .checkbox-inline {
        padding: 10px 12px;
        min-height: 44px;
    }
    
    .toggle-switch .toggle-slider {
        width: 46px;
        height: 26px;
    }
    
    .toggle-switch .toggle-slider:before {
        width: 18px;
        height: 18px;
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
        transform: translate(20px, -50%);
    }
    
    .checkbox-inline {
        padding: 12px 15px;
        min-height: 48px;
    }
    
    .checkbox-inline input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    
    .checkbox-inline input[type="checkbox"]:checked::after {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .checkbox-group,
    .toggle-group,
    .checkbox-inline {
        padding: 12px 15px;
        min-height: 56px;
    }
    
    .toggle-group {
        padding: 12px 15px;
        min-height: 60px;
    }
    
    .checkbox-inline {
        min-height: 56px;
        padding: 14px 15px;
    }
}
