/* Tailwind CSS Floating Labels - Estilo customizado */

/* Container para floating labels */
.floating-label-group {
    position: relative;
    margin-bottom: 1rem;
}

/* Input e Select base */
.floating-label-group input,
.floating-label-group select,
.floating-label-group textarea {
    width: 100%;
    padding: 1rem 0.75rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
    background-color: #ffffff;
    color: #1f2937;
}

.floating-label-group input:focus,
.floating-label-group select:focus,
.floating-label-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.floating-label-group input:disabled,
.floating-label-group select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Label flutuante */
.floating-label-group label {
    position: absolute;
    left: 0.75rem;
    top: 1rem;
    font-size: 1rem;
    color: #6b7280;
    pointer-events: none;
    transition: all 0.2s ease-in-out;
    background-color: #ffffff;
    padding: 0 0.25rem;
    z-index: 1;
}

/* Label flutuado (quando tem valor ou está em foco) */
.floating-label-group input:focus ~ label,
.floating-label-group input:not(:placeholder-shown) ~ label,
.floating-label-group select:focus ~ label,
.floating-label-group select:not([value=""]) ~ label,
.floating-label-group textarea:focus ~ label,
.floating-label-group textarea:not(:placeholder-shown) ~ label {
    top: -0.5rem;
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 500;
}

/* Select sempre mostra label flutuado quando tem valor */
.floating-label-group select:not([value=""]) ~ label,
.floating-label-group select option:checked:not([value=""]) ~ label {
    top: -0.5rem;
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 500;
}

/* JavaScript vai adicionar classe quando select tiver valor */
.floating-label-group select.has-value ~ label {
    top: -0.5rem;
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 500;
}

/* Estados de erro */
.floating-label-group.has-error input,
.floating-label-group.has-error select,
.floating-label-group.has-error textarea {
    border-color: #ef4444;
}

.floating-label-group.has-error input:focus,
.floating-label-group.has-error select:focus,
.floating-label-group.has-error textarea:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.floating-label-group.has-error label {
    color: #ef4444;
}

/* Mensagem de erro */
.floating-label-group .error-message {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: 500;
}

/* Textarea com altura customizada */
.floating-label-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Select com seta customizada */
.floating-label-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Input type="date" */
.floating-label-group input[type="date"] {
    position: relative;
    color-scheme: light;
}

.floating-label-group input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: 0.5rem;
}

.floating-label-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Garantir que o label flutue corretamente para date inputs */
.floating-label-group input[type="date"]:focus ~ label,
.floating-label-group input[type="date"]:not(:placeholder-shown) ~ label,
.floating-label-group input[type="date"]:valid ~ label {
    top: -0.5rem;
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 500;
}

