/* ====================================
   Custom Overrides for Porto Template
   Targeted fixes only - no wildcards
   ==================================== */

/* ========== Z-INDEX LAYER SYSTEM ========== */

/* Background decorative elements */
.background-image-wrapper,
.shape-divider {
  z-index: -1;
  pointer-events: none;
}

/* Main content layers */
.section { position: relative; z-index: 1; }
.main { position: relative; z-index: 2; }
.container { position: relative; z-index: 3; }

/* Interactive elements above content */
.card { position: relative; z-index: 5; }
.card-body { position: relative; z-index: 2; }
.input-group { position: relative; z-index: 10; }
.input-group-text { z-index: 11; }

/* Navigation and overlays */
#header { z-index: 1000; }
.dropdown-menu { z-index: 1050; }
.modal { z-index: 9999; }
.modal-backdrop { z-index: 9998; }

/* ========== CARD STYLING ========== */

.card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  background-color: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* ========== FORM ELEMENT CONTRAST ========== */

.form-control,
.form-select,
textarea {
  background-color: #fff;
  color: #212529;
  border: 1px solid #ced4da;
}

.form-control:focus,
.form-select:focus {
  background-color: #fff;
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
  color: #212529;
}

.form-control::placeholder {
  color: #6c757d;
  opacity: 0.7;
}

select option,
.form-select option {
  background-color: #ffffff;
  color: #212529;
}

.form-check-label {
  color: #212529;
  cursor: pointer;
}

/* ========== CHECKBOX & RADIO CUSTOM STYLING ========== */

input[type="checkbox"],
input[type="radio"],
.form-check-input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #495057;
  background-color: #ffffff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

input[type="checkbox"],
.form-check-input[type="checkbox"] {
  border-radius: 4px;
}

input[type="radio"],
.form-check-input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked,
.form-check-input:checked {
  background-color: #667eea;
  border-color: #667eea;
}

input[type="checkbox"]:checked::before {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
}

/* Ensure unchecked has no pseudo-element */
input[type="checkbox"]:not(:checked)::before,
input[type="radio"]:not(:checked)::before {
  content: none;
}

input[type="radio"]:checked::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background-color: #ffffff;
  border-radius: 50%;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover,
.form-check-input:hover {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="checkbox"]:focus,
input[type="radio"]:focus,
.form-check-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

/* Reset for toggle switch checkboxes — must be fully hidden behind the slider */
.cfg-toggle-wrap input[type="checkbox"],
.cfg-toggle-wrap input[type="checkbox"]:checked,
.cfg-toggle-label input[type="checkbox"],
.cfg-toggle-label input[type="checkbox"]:checked,
.ns-toggle input[type="checkbox"],
.ns-toggle input[type="checkbox"]:checked,
.form-switch input[type="checkbox"],
.form-switch input[type="checkbox"]:checked,
.toggle-switch input[type="checkbox"],
.toggle-switch input[type="checkbox"]:checked,
.svc-toggle-label input[type="checkbox"],
.svc-toggle-label input[type="checkbox"]:checked,
.wf-toggle-label input[type="checkbox"],
.wf-toggle-label input[type="checkbox"]:checked,
.sd-toggle-label input[type="checkbox"],
.sd-toggle-label input[type="checkbox"]:checked {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  background: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/* ========== DISABLED ELEMENTS ========== */

input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled,
.form-select:disabled {
  background-color: #e9ecef;
  color: #6c757d;
  border-color: #ced4da;
  cursor: not-allowed;
}

/* ========== SHADOW ENHANCEMENTS ========== */

#header {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-content {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.dropdown-menu {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.alert {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-left: 4px solid;
}

.alert-success { border-left-color: #28a745; }
.alert-warning { border-left-color: #ffc107; }
.alert-danger { border-left-color: #dc3545; }
.alert-info { border-left-color: #17a2b8; }

/* ========== BACKGROUND DEFAULTS ========== */

body {
  background-color: #f8f9fa;
  color: #212529;
}

.section-default {
  background-color: #f9f9fb;
}

.section-secondary {
  background-color: #f8f9fa;
}

/* ========== UTILITY FIXES ========== */

/* Prevent Porto decorative overlays from blocking clicks */
.position-absolute {
  pointer-events: none;
}

.position-absolute > * {
  pointer-events: auto;
}

.appear-animation {
  pointer-events: auto;
}

a, button, input, select, textarea {
  pointer-events: auto;
}
