/* Form Fixes - PWA Parceiros */

/* Fix para inputs em iOS */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="url"],
textarea,
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 10px;
}

/* Fix para zoom em inputs no iOS */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="url"],
textarea,
select {
  font-size: 16px; /* Previne zoom no iOS */
}

/* Fix para select customizado */
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Fix para checkbox e radio customizados */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

input[type="radio"] {
  border-radius: 50%;
}

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

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

input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
}

/* Fix para file input */
input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  background-color: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.file-input-wrapper:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.file-input-wrapper i {
  margin-right: 8px;
}

/* Fix para range input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Fix para textarea resize */
textarea {
  resize: vertical;
  min-height: 100px;
}

/* Fix para placeholder */
::placeholder {
  color: #999;
  opacity: 1;
}

:-ms-input-placeholder {
  color: #999;
}

::-ms-input-placeholder {
  color: #999;
}

/* Fix para autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  -webkit-text-fill-color: #212121 !important;
}

/* Fix para focus outline */
input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Fix para disabled inputs */
input:disabled,
textarea:disabled,
select:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Fix para invalid inputs */
input:invalid,
textarea:invalid,
select:invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Fix para valid inputs */
input:valid,
textarea:valid,
select:valid {
  border-color: var(--success);
}

/* Fix para required inputs */
input:required,
textarea:required,
select:required {
  box-shadow: none;
}

/* Fix para floating labels */
.floating-label {
  position: relative;
  margin-bottom: 20px;
}

.floating-label input,
.floating-label textarea {
  width: 100%;
  padding: 16px 12px 8px 12px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  background: transparent;
  transition: all 0.3s ease;
}

.floating-label label {
  position: absolute;
  top: 16px;
  left: 12px;
  font-size: 16px;
  color: #999;
  transition: all 0.3s ease;
  pointer-events: none;
  background: white;
  padding: 0 4px;
}

.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label,
.floating-label textarea:focus + label,
.floating-label textarea:not(:placeholder-shown) + label {
  top: -8px;
  left: 8px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

.floating-label input:focus,
.floating-label textarea:focus {
  border-color: var(--primary);
  outline: none;
}

/* Fix para input groups */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.input-group-prepend,
.input-group-append {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border: 2px solid #ddd;
  color: #666;
}

.input-group-prepend {
  border-right: none;
  border-radius: 10px 0 0 10px;
}

.input-group-append {
  border-left: none;
  border-radius: 0 10px 10px 0;
}

.input-group input {
  border-radius: 0;
  border-left: none;
  border-right: none;
  margin-bottom: 0;
}

.input-group input:first-child {
  border-left: 2px solid #ddd;
  border-radius: 10px 0 0 10px;
}

.input-group input:last-child {
  border-right: 2px solid #ddd;
  border-radius: 0 10px 10px 0;
}

/* Fix para search input */
input[type="search"] {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cpath d='m21 21-4.35-4.35'%3e%3c/path%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Fix para dark mode */
@media (prefers-color-scheme: dark) {
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #2c2c2c inset !important;
    -webkit-text-fill-color: #f5f5f5 !important;
  }
  
  .floating-label label {
    background: #1e1e1e;
  }
  
  .input-group-prepend,
  .input-group-append {
    background-color: #2c2c2c;
    border-color: #444;
    color: #f5f5f5;
  }
  
  input:disabled,
  textarea:disabled,
  select:disabled {
    background-color: #2c2c2c;
    color: #666;
  }
}
