/**
 * FORMS - PharmData Design System v2.0
 * Componentes de formulário com feedback visual aprimorado
 *
 * Estes componentes complementam o Tailwind CSS, fornecendo
 * estilos pré-definidos para inputs, selects e labels.
 *
 * Para usar: importe este arquivo após o Tailwind.
 */

/* ===================
   CSS CUSTOM PROPERTIES
   Tokens específicos para forms
   =================== */

:root {
    /* Border colors */
    --form-border-default: rgba(183, 228, 213, 0.4);
    --form-border-hover: var(--teal-intense, #1a8b7d);
    --form-border-disabled: rgba(183, 228, 213, 0.2);

    /* Focus ring */
    --form-ring-color: rgba(42, 161, 152, 0.12);
    --form-ring-shadow: 0 2px 8px rgba(42, 161, 152, 0.08);

    /* Error states */
    --form-error-ring: rgba(239, 68, 68, 0.12);
    --form-error-shadow: 0 2px 8px rgba(239, 68, 68, 0.08);

    /* Success states */
    --form-success-ring: rgba(16, 185, 129, 0.12);
    --form-success-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

/* ===================
   FORM GROUP
   Container para label + input
   =================== */

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* ===================
   FORM LABEL
   Labels padronizados com hierarquia clara
   =================== */

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: var(--emerald-abyss, #0B2D2A);
}

.form-label i,
.form-label svg {
    margin-right: 0.375rem;
    opacity: 0.6;
}

/* Optional indicator */
.form-label-optional::after {
    content: '(opcional)';
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: normal;
    margin-left: 0.5rem;
    opacity: 0.6;
}

/* Required indicator */
.form-label-required::after {
    content: '*';
    color: var(--error, #EF4444);
    margin-left: 0.25rem;
}

/* ===================
   FORM INPUT
   Input de texto estilizado com mint-signal border
   =================== */

.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background: var(--cloud);
    border: 1.5px solid var(--form-border-default);
    color: var(--graphite-depth, #1F2937);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
}

.form-input:hover:not(:disabled):not(:focus) {
    border-color: var(--form-border-hover);
}

.form-input:focus {
    outline: none;
    border-color: var(--form-border-hover);
    box-shadow:
        0 0 0 3px var(--form-ring-color),
        var(--form-ring-shadow);
}

.form-input::placeholder {
    color: var(--soft-steel, #374151);
    opacity: 0.6;
}

.form-input:disabled {
    background: var(--arctic-mist, #E9ECEF);
    border-color: var(--form-border-disabled);
    color: var(--soft-steel, #374151);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===================
   SIZE VARIANTS
   =================== */

.form-input-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 0.375rem;
}

.form-input-lg {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    border-radius: 0.625rem;
}

/* ===================
   VALIDATION STATES
   =================== */

/* Error */
.form-input-error,
.form-input.error {
    border-color: var(--error, #EF4444) !important;
    background: rgba(239, 68, 68, 0.04);
}

.form-input-error:focus,
.form-input.error:focus {
    box-shadow:
        0 0 0 3px var(--form-error-ring),
        var(--form-error-shadow);
}

/* Success */
.form-input-success,
.form-input.success {
    border-color: var(--success, #10B981);
}

.form-input-success:focus,
.form-input.success:focus {
    box-shadow:
        0 0 0 3px var(--form-success-ring),
        var(--form-success-shadow);
}

/* Error message */
.form-error {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--error, #EF4444);
}

/* ===================
   FORM SELECT
   Select customizado com chevron teal
   =================== */

.form-select {
    width: 100%;
    padding: 0.625rem 1rem;
    padding-right: 2.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    background: var(--cloud);
    border: 1.5px solid var(--form-border-default);
    color: var(--graphite-depth, #1F2937);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Chevron-down SVG em teal-intense */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232AA198' 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: 18px;
}

.form-select:hover:not(:disabled):not(:focus) {
    border-color: var(--form-border-hover);
    background-color: rgba(183, 228, 213, 0.03);
}

.form-select:focus {
    outline: none;
    border-color: var(--form-border-hover);
    box-shadow:
        0 0 0 3px var(--form-ring-color),
        var(--form-ring-shadow);
}

.form-select:disabled {
    background-color: var(--arctic-mist, #E9ECEF);
    border-color: var(--form-border-disabled);
    color: var(--soft-steel, #374151);
    cursor: not-allowed;
    opacity: 0.7;
    /* Seta cinza quando disabled */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23374151' 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");
}

/* Select size variants */
.form-select-sm {
    padding: 0.375rem 0.75rem;
    padding-right: 2.25rem;
    font-size: 0.8125rem;
    border-radius: 0.375rem;
    background-size: 16px;
    background-position: right 8px center;
}

.form-select-lg {
    padding: 0.875rem 1.25rem;
    padding-right: 3rem;
    font-size: 1rem;
    border-radius: 0.625rem;
    background-size: 20px;
    background-position: right 14px center;
}

/* Select error state */
.form-select-error,
.form-select.error {
    border-color: var(--error, #EF4444) !important;
    background-color: rgba(239, 68, 68, 0.04);
}

/* ===================
   FORM INPUT WITH ICON
   Container para input com icone
   =================== */

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: 2.75rem;
}

.form-input-icon > i,
.form-input-icon > svg,
.form-input-icon > .icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--teal-intense, #1a8b7d);
    pointer-events: none;
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
}

/* Icon on right */
.form-input-icon-right {
    position: relative;
}

.form-input-icon-right .form-input {
    padding-right: 2.75rem;
}

.form-input-icon-right > i,
.form-input-icon-right > svg {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--teal-intense, #1a8b7d);
    pointer-events: none;
}

/* ===================
   FORM TEXTAREA
   =================== */

.form-textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background: var(--cloud);
    border: 1.5px solid var(--form-border-default);
    color: var(--graphite-depth, #1F2937);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
}

.form-textarea:hover:not(:disabled):not(:focus) {
    border-color: var(--form-border-hover);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--form-border-hover);
    box-shadow:
        0 0 0 3px var(--form-ring-color),
        var(--form-ring-shadow);
}

.form-textarea::placeholder {
    color: var(--soft-steel, #374151);
    opacity: 0.6;
}

.form-textarea:disabled {
    background: var(--arctic-mist, #E9ECEF);
    border-color: var(--form-border-disabled);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===================
   FORM HELPER TEXT
   =================== */

.form-helper {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--soft-steel, #374151);
    line-height: 1.4;
}

.form-helper i,
.form-helper svg {
    margin-right: 0.25rem;
    opacity: 0.6;
}

/* ===================
   FORM ROW (inline forms)
   =================== */

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.form-row > * {
    flex: 1;
    min-width: 0;
}

.form-row > .form-group {
    margin-bottom: 0;
}

/* ===================
   FORM SECTION
   =================== */

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(183, 228, 213, 0.3);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--emerald-abyss, #0B2D2A);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i,
.form-section-title svg {
    color: var(--teal-intense, #1a8b7d);
}

/* ===================
   FORM ACTIONS
   =================== */

.form-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(183, 228, 213, 0.3);
}

.form-actions.right {
    justify-content: flex-end;
}

.form-actions.center {
    justify-content: center;
}

.form-actions.between {
    justify-content: space-between;
}

/* ===================
   INPUT ADDONS
   =================== */

.form-input-group {
    display: flex;
    align-items: stretch;
}

.form-input-group .form-input {
    flex: 1;
    border-radius: 0;
}

.form-input-group .form-input:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.form-input-group .form-input:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
}

.form-input-addon {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--arctic-mist, #E9ECEF);
    border: 1.5px solid var(--form-border-default);
    color: var(--soft-steel, #374151);
    font-size: 0.875rem;
    white-space: nowrap;
}

.form-input-addon:first-child {
    border-right: none;
    border-radius: 0.5rem 0 0 0.5rem;
}

.form-input-addon:last-child {
    border-left: none;
    border-radius: 0 0.5rem 0.5rem 0;
}

/* ===================
   CURATION FIELD
   Dual-value pattern: Official (readonly) + Normalized (editable)
   =================== */

.curation-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.curation-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.curation-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--emerald-abyss, #0B2D2A);
}

/* Official value (readonly, from external source) */
.curation-official {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--arctic-mist, #E9ECEF);
    border: 1px solid var(--soft-arctic, #E5E8EB);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--soft-steel, #374151);
}

.curation-official-value {
    flex: 1;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
}

.curation-official-lock {
    color: var(--soft-steel, #374151);
    opacity: 0.5;
    font-size: 0.75rem;
}

/* Arrow connector between official and normalized */
.curation-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal-intense, #1a8b7d);
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

/* Normalized value container (with icon) */
.curation-normalized {
    position: relative;
}

.curation-normalized .form-input,
.curation-normalized .form-textarea {
    padding-left: 2rem;
}

.curation-normalized-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
}

/* ===================
   SOURCE BADGES
   Indicate data source (ANVISA, SPOR, SNOMED, etc.)
   =================== */

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 500;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.source-anvisa { background: #E8F5E9; color: #1B5E20; }
.source-spor { background: #E3F2FD; color: #1565C0; }
.source-snomed { background: #FFF3E0; color: #E65100; }
.source-fda { background: #E8EAF6; color: #283593; }
.source-who { background: #E1F5FE; color: #01579B; }
.source-pharmdata { background: #E0F5EE; color: #0B2D2A; }
.source-obm { background: #F3E5F5; color: #7B1FA2; }
.source-tuss { background: #E0F2F1; color: #00695C; }

/* ===================
   CURATION STATUS
   Mapping status indicators
   =================== */

.curation-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.status-mapped {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

.status-conflict {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

.status-new {
    background: rgba(59, 130, 246, 0.1);
    color: #2563EB;
}

/* ===================
   COMPARISON FIELD
   Side-by-side official vs normalized
   =================== */

.comparison-field {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
}

.comparison-side {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.comparison-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--soft-steel, #374151);
}

.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    color: var(--teal-intense, #1a8b7d);
}

/* ===================
   ENRICHMENT CARD
   For displaying external source data
   =================== */

.enrichment-card {
    background: var(--cloud);
    border: 1px solid rgba(183, 228, 213, 0.4);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 4px 12px -2px rgba(11, 45, 42, 0.18));
}

.enrichment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background: rgba(233, 236, 239, 0.5);
    border-bottom: 1px solid var(--soft-arctic, #E5E8EB);
}

.enrichment-body {
    padding: 0.75rem;
}

.enrichment-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.375rem 0;
}

.enrichment-row:not(:last-child) {
    border-bottom: 1px dashed rgba(183, 228, 213, 0.3);
}

.enrichment-key {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--soft-steel, #374151);
    min-width: 5rem;
}

.enrichment-value {
    font-size: 0.8125rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--graphite-depth, #1F2937);
}

/* ===================
   FORM CARD
   Collapsible section container
   =================== */

.form-card {
    background: var(--cloud);
    border: 1px solid rgba(183, 228, 213, 0.4);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 4px 12px -2px rgba(11, 45, 42, 0.18));
}

.form-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(248, 249, 250, 0.5);
    border-bottom: 1px solid var(--soft-arctic, #E5E8EB);
}

.form-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--emerald-abyss, #0B2D2A);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-card-title i,
.form-card-title svg {
    color: var(--teal-intense, #1a8b7d);
}

.form-card-body {
    padding: 1rem;
}

.form-card-footer {
    padding: 0.75rem 1rem;
    background: rgba(248, 249, 250, 0.5);
    border-top: 1px solid var(--soft-arctic, #E5E8EB);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===================
   BADGE REQUIRED
   =================== */

.badge-required {
    font-size: 0.625rem;
    font-weight: 500;
    padding: 0.125rem 0.375rem;
    background: rgba(42, 161, 152, 0.1);
    color: var(--teal-intense, #1a8b7d);
    border-radius: 0.25rem;
}

/* ===================
   REDUCED MOTION
   =================== */

@media (prefers-reduced-motion: reduce) {
    .form-input,
    .form-select,
    .form-textarea {
        transition: none;
    }
}

/* ===================
   DARK MODE
   =================== */

:root.dark-mode,
[data-theme="dark"] {
    /* Form tokens - dark */
    --form-border-default: rgba(183, 228, 213, 0.2);
    --form-border-hover: var(--teal-intense, #1a8b7d);
    --form-border-disabled: rgba(183, 228, 213, 0.1);

    --form-ring-color: rgba(61, 201, 189, 0.2);
    --form-ring-shadow: 0 2px 8px rgba(61, 201, 189, 0.15);

    --form-error-ring: rgba(248, 113, 113, 0.2);
    --form-error-shadow: 0 2px 8px rgba(248, 113, 113, 0.15);

    --form-success-ring: rgba(34, 197, 94, 0.2);
    --form-success-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

:root.dark-mode .form-input,
:root.dark-mode .form-select,
:root.dark-mode .form-textarea,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    background: var(--arctic-mist);
    color: var(--graphite-depth);
}

:root.dark-mode .form-input::placeholder,
:root.dark-mode .form-textarea::placeholder,
[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder {
    color: var(--soft-steel);
    opacity: 0.7;
}

:root.dark-mode .form-input:disabled,
:root.dark-mode .form-select:disabled,
:root.dark-mode .form-textarea:disabled,
[data-theme="dark"] .form-input:disabled,
[data-theme="dark"] .form-select:disabled,
[data-theme="dark"] .form-textarea:disabled {
    background: var(--soft-arctic);
    color: var(--soft-steel);
}

:root.dark-mode .form-select,
[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%233dc9bd' 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");
}

:root.dark-mode .form-select:disabled,
[data-theme="dark"] .form-select:disabled {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b949e' 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");
}

:root.dark-mode .form-label,
:root.dark-mode .form-section-title,
:root.dark-mode .curation-field-label,
:root.dark-mode .form-card-title,
[data-theme="dark"] .form-label,
[data-theme="dark"] .form-section-title,
[data-theme="dark"] .curation-field-label,
[data-theme="dark"] .form-card-title {
    color: var(--graphite-depth);
}

:root.dark-mode .form-input-addon,
[data-theme="dark"] .form-input-addon {
    background: var(--soft-arctic);
    color: var(--soft-steel);
}

/* Curation components - dark */
:root.dark-mode .curation-official,
[data-theme="dark"] .curation-official {
    background: var(--soft-arctic);
    border-color: rgba(183, 228, 213, 0.1);
}

:root.dark-mode .enrichment-card,
:root.dark-mode .form-card,
[data-theme="dark"] .enrichment-card,
[data-theme="dark"] .form-card {
    background: var(--arctic-mist);
    border: 1px solid rgba(183, 228, 213, 0.2);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(183, 228, 213, 0.08);
}

:root.dark-mode .enrichment-header,
:root.dark-mode .form-card-header,
:root.dark-mode .form-card-footer,
[data-theme="dark"] .enrichment-header,
[data-theme="dark"] .form-card-header,
[data-theme="dark"] .form-card-footer {
    background: var(--soft-arctic);
    border-color: rgba(183, 228, 213, 0.1);
}

:root.dark-mode .enrichment-row:not(:last-child),
[data-theme="dark"] .enrichment-row:not(:last-child) {
    border-bottom-color: rgba(183, 228, 213, 0.1);
}

/* Source badges - dark */
:root.dark-mode .source-anvisa,
[data-theme="dark"] .source-anvisa {
    background: rgba(27, 94, 32, 0.15);
    color: #4ade80;
}

:root.dark-mode .source-spor,
[data-theme="dark"] .source-spor {
    background: rgba(21, 101, 192, 0.15);
    color: #60a5fa;
}

:root.dark-mode .source-snomed,
[data-theme="dark"] .source-snomed {
    background: rgba(230, 81, 0, 0.15);
    color: #fb923c;
}

:root.dark-mode .source-fda,
[data-theme="dark"] .source-fda {
    background: rgba(40, 53, 147, 0.15);
    color: #818cf8;
}

:root.dark-mode .source-who,
[data-theme="dark"] .source-who {
    background: rgba(1, 87, 155, 0.15);
    color: #38bdf8;
}

:root.dark-mode .source-pharmdata,
[data-theme="dark"] .source-pharmdata {
    background: rgba(183, 228, 213, 0.1);
    color: #B7E4D5;
}

:root.dark-mode .source-obm,
[data-theme="dark"] .source-obm {
    background: rgba(123, 31, 162, 0.15);
    color: #c084fc;
}

:root.dark-mode .source-tuss,
[data-theme="dark"] .source-tuss {
    background: rgba(0, 105, 92, 0.15);
    color: #2dd4bf;
}

/* Curation status - dark */
:root.dark-mode .status-mapped,
[data-theme="dark"] .status-mapped {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

:root.dark-mode .status-pending,
[data-theme="dark"] .status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

:root.dark-mode .status-conflict,
[data-theme="dark"] .status-conflict {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

:root.dark-mode .status-new,
[data-theme="dark"] .status-new {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

:root.dark-mode .badge-required,
[data-theme="dark"] .badge-required {
    background: rgba(61, 201, 189, 0.15);
    color: #3dc9bd;
}

/* ================================================================
   EXTENDED INPUT TYPES
   Number, Date, Time, Range, File, Color
   ================================================================ */

/* ===================
   NUMBER INPUT
   Com spinners customizados
   =================== */

.form-input-number {
    -moz-appearance: textfield;
    appearance: textfield;
}

.form-input-number::-webkit-outer-spin-button,
.form-input-number::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Number input com controles */
.form-number-wrapper {
    position: relative;
    display: inline-flex;
    align-items: stretch;
}

.form-number-wrapper .form-input {
    border-radius: 0.5rem 0 0 0.5rem;
    padding-right: 0.75rem;
    text-align: center;
}

.form-number-controls {
    display: flex;
    flex-direction: column;
    border: 1.5px solid var(--form-border-default);
    border-left: none;
    border-radius: 0 0.5rem 0.5rem 0;
    overflow: hidden;
}

.form-number-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    flex: 1;
    background: var(--arctic-mist, #E9ECEF);
    border: none;
    color: var(--soft-steel, #374151);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
}

.form-number-btn:hover {
    background: rgba(42, 161, 152, 0.1);
    color: var(--teal-intense, #1a8b7d);
}

.form-number-btn:active {
    background: rgba(42, 161, 152, 0.2);
}

.form-number-btn:first-child {
    border-bottom: 1px solid var(--form-border-default);
}

.form-number-wrapper:focus-within .form-input {
    border-color: var(--form-border-hover);
    box-shadow: 0 0 0 3px var(--form-ring-color), var(--form-ring-shadow);
}

.form-number-wrapper:focus-within .form-number-controls {
    border-color: var(--form-border-hover);
}

/* Inline number controls */
.form-number-inline {
    flex-direction: row;
}

.form-number-inline .form-input {
    border-radius: 0;
    order: 2;
}

.form-number-inline .form-number-btn-dec {
    border-radius: 0.5rem 0 0 0.5rem;
    order: 1;
    border: 1.5px solid var(--form-border-default);
    border-right: none;
}

.form-number-inline .form-number-btn-inc {
    border-radius: 0 0.5rem 0.5rem 0;
    order: 3;
    border: 1.5px solid var(--form-border-default);
    border-left: none;
}

/* ===================
   DATE & TIME INPUTS
   =================== */

.form-input-date,
.form-input-time,
.form-input-datetime {
    position: relative;
}

/* Reset browser styles */
.form-input-date::-webkit-calendar-picker-indicator,
.form-input-time::-webkit-calendar-picker-indicator,
.form-input-datetime::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2.5rem;
    opacity: 0;
    cursor: pointer;
}

/* Custom icon */
.form-date-wrapper,
.form-time-wrapper {
    position: relative;
}

.form-date-wrapper .form-input,
.form-time-wrapper .form-input {
    padding-right: 2.75rem;
}

.form-date-wrapper::after,
.form-time-wrapper::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    opacity: 0.6;
}

.form-date-wrapper::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232AA198' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

.form-time-wrapper::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232AA198' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Date range */
.form-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-date-range-separator {
    color: var(--soft-steel, #374151);
    font-size: 0.875rem;
}

/* ===================
   RANGE SLIDER
   =================== */

.form-range {
    width: 100%;
    height: 0.5rem;
    background: rgba(183, 228, 213, 0.3);
    border-radius: 0.25rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Webkit (Chrome, Safari, Edge) */
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--teal-intense, #1a8b7d);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(42, 161, 152, 0.3);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(42, 161, 152, 0.4);
}

.form-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(42, 161, 152, 0.2);
}

/* Firefox */
.form-range::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    background: var(--teal-intense, #1a8b7d);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(42, 161, 152, 0.3);
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.form-range::-moz-range-track {
    background: rgba(183, 228, 213, 0.3);
    height: 0.5rem;
    border-radius: 0.25rem;
}

/* Range with value display */
.form-range-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-range-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--teal-intense, #1a8b7d);
    min-width: 3rem;
    text-align: right;
}

.form-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--soft-steel, #374151);
}

/* Range sizes */
.form-range-sm {
    height: 0.375rem;
}

.form-range-sm::-webkit-slider-thumb {
    width: 1rem;
    height: 1rem;
}

.form-range-lg {
    height: 0.625rem;
}

.form-range-lg::-webkit-slider-thumb {
    width: 1.5rem;
    height: 1.5rem;
}

/* ===================
   FILE INPUT
   =================== */

.form-file {
    position: relative;
}

.form-file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.form-file-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    background: var(--cloud);
    border: 1.5px dashed var(--form-border-default);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-file-label:hover {
    border-color: var(--form-border-hover);
    background: rgba(183, 228, 213, 0.03);
}

.form-file-input:focus + .form-file-label {
    border-color: var(--form-border-hover);
    box-shadow: 0 0 0 3px var(--form-ring-color);
}

.form-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(42, 161, 152, 0.1);
    color: var(--teal-intense, #1a8b7d);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.form-file-text {
    flex: 1;
}

.form-file-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--graphite-depth, #1F2937);
}

.form-file-subtitle {
    font-size: 0.75rem;
    color: var(--soft-steel, #374151);
}

.form-file-btn {
    padding: 0.5rem 1rem;
    background: var(--teal-intense, #1a8b7d);
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: background 0.15s ease;
}

.form-file-label:hover .form-file-btn {
    background: var(--emerald-abyss, #0B2D2A);
}

/* Drag & Drop Zone */
.form-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    min-height: 10rem;
    border-style: dashed;
    border-width: 2px;
}

.form-file-dropzone.dragover {
    border-color: var(--teal-intense, #1a8b7d);
    background: rgba(42, 161, 152, 0.05);
}

.form-file-dropzone .form-file-icon {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* File list */
.form-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.form-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(183, 228, 213, 0.08);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
}

.form-file-item-icon {
    color: var(--teal-intense, #1a8b7d);
}

.form-file-item-name {
    flex: 1;
    color: var(--graphite-depth, #1F2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-file-item-size {
    color: var(--soft-steel, #374151);
    font-size: 0.75rem;
}

.form-file-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: transparent;
    border: none;
    color: var(--soft-steel, #374151);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.form-file-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error, #EF4444);
}

/* ===================
   COLOR INPUT
   =================== */

.form-color-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-color {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.25rem;
    border: 1.5px solid var(--form-border-default);
    border-radius: 0.5rem;
    cursor: pointer;
    background: var(--cloud);
    transition: all 0.15s ease;
}

.form-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-color::-webkit-color-swatch {
    border: none;
    border-radius: 0.25rem;
}

.form-color::-moz-color-swatch {
    border: none;
    border-radius: 0.25rem;
}

.form-color:hover {
    border-color: var(--form-border-hover);
}

.form-color:focus {
    outline: none;
    border-color: var(--form-border-hover);
    box-shadow: 0 0 0 3px var(--form-ring-color);
}

.form-color-value {
    font-family: 'JetBrains Mono', 'Fira Code', var(--font-mono, monospace);
    font-size: 0.875rem;
    color: var(--graphite-depth, #1F2937);
    text-transform: uppercase;
}

/* Color presets */
.form-color-presets {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.form-color-preset {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.form-color-preset:hover {
    transform: scale(1.1);
}

.form-color-preset.active {
    border-color: var(--graphite-depth, #1F2937);
    box-shadow: 0 0 0 2px white;
}

/* ===================
   DARK MODE - EXTENDED INPUTS
   =================== */

:root.dark-mode .form-number-btn,
[data-theme="dark"] .form-number-btn {
    background: rgba(183, 228, 213, 0.1);
}

:root.dark-mode .form-number-btn:hover,
[data-theme="dark"] .form-number-btn:hover {
    background: rgba(42, 161, 152, 0.2);
}

:root.dark-mode .form-range,
[data-theme="dark"] .form-range {
    background: rgba(183, 228, 213, 0.15);
}

:root.dark-mode .form-file-label,
[data-theme="dark"] .form-file-label {
    background: var(--arctic-mist, #E9ECEF);
}

:root.dark-mode .form-file-item,
[data-theme="dark"] .form-file-item {
    background: rgba(183, 228, 213, 0.1);
}

:root.dark-mode .form-color,
[data-theme="dark"] .form-color {
    background: var(--arctic-mist, #E9ECEF);
}

/* ===================
   ACCESSIBILITY - EXTENDED INPUTS
   =================== */

@media (prefers-reduced-motion: reduce) {
    .form-range::-webkit-slider-thumb,
    .form-color-preset,
    .form-number-btn {
        transition: none;
    }
}
