/* === Form Elements === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.input-group-stack { display: flex; flex-direction: column; gap: 0.25rem; }
.input-group-stack.full { grid-column: span 2; }
.input-group-stack label { font-size: 0.9rem; font-weight: 300; color: var(--text-secondary); }
.sub-label { font-size: 0.9rem; font-weight: 300; color: var(--text-secondary); margin-bottom: 0.25rem; display: block; }

/* === Styled Input Wrapper === */
.styled-input-wrapper { 
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.8); 
    border-radius: 8px; 
    padding: 0 8px; 
    height: 32px; 
    display: flex; 
    align-items: center; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}
.styled-input-wrapper:hover { 
    border-color: rgba(255, 255, 255, 1); 
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.styled-input-wrapper:focus-within { 
    border-color: var(--accent-color); 
    background: #ffffff; 
    box-shadow: 0 4px 16px rgba(103, 119, 141, 0.1);
}
.styled-input-wrapper input { width: 100%; border: none; background: transparent; outline: none; font-size: 0.95rem; color: var(--text-primary); font-family: 'AiDianQuYaYuan', sans-serif; font-weight: 300; }
.styled-input-wrapper input::placeholder { color: var(--text-muted); opacity: 0.6; }
.styled-input-wrapper.full-width { width: 100%; flex: 1; }
.styled-input-wrapper.contact-input-wrapper { flex: 1; min-width: 0; width: 0; height: 28px; border-radius: 5px; }
.styled-input-wrapper.small-number { width: auto; flex: 1; justify-content: center; padding: 0 6px; flex-shrink: 1; min-width: 0; height: 28px; border-radius: 5px; }
.styled-input-wrapper.small-number input { text-align: center; padding-right: 2px; font-weight: 300; font-size: 1rem; padding: 0.25rem 0.2rem; width: 100%; min-width: 0; -moz-appearance: textfield; }
.styled-input-wrapper.small-number input::-webkit-outer-spin-button,
.styled-input-wrapper.small-number input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.styled-input-wrapper.small-number .suffix { margin-right: 2px; font-size: 0.9rem; color: var(--text-secondary); font-weight: 300; flex-shrink: 0; }
.styled-input-wrapper .suffix { font-size: 0.9rem; color: var(--text-secondary); flex-shrink: 0; font-weight: 300; }
.styled-input-wrapper.tag-adder { background-color: var(--bg-main); height: auto; position: relative; border-radius: var(--radius-full); z-index: 1; flex: 1; min-width: 100px; padding: 4px 10px 4px 36px; box-sizing: border-box; flex-shrink: 0; overflow: hidden; }
.styled-input-wrapper.tag-adder:hover { border-color: #c7c7d0; }
.styled-input-wrapper.tag-adder:focus-within { border-color: var(--accent-color); }
.styled-input-wrapper.tag-adder.is-active { z-index: 9998; }
.styled-input-wrapper.tag-adder input { font-size: 1rem; line-height: 1; height: auto; display: flex; align-items: center; width: 100%; padding: 0; overflow: hidden; text-overflow: clip; white-space: nowrap; }
.styled-input-wrapper.tag-adder input::placeholder { font-size: 0.9rem; opacity: 0.7; }

/* === Custom Select Container === */
.custom-select-container { position: relative; width: 100%; cursor: pointer; z-index: 1; }
.custom-select-container.is-active { z-index: 99999; }
.select-trigger { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    width: 100%; 
    padding: 0.625rem 0.75rem; 
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.8); 
    border-radius: 10px; 
    font-size: 0.95rem; 
    color: var(--text-primary); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    min-height: 40px; 
    box-sizing: border-box; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}
.select-trigger:hover { 
    border-color: rgba(255, 255, 255, 1); 
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.select-trigger.mini { height: 28px; min-width: 48px; padding: 0 8px; font-size: 0.9rem; justify-content: center; font-family: monospace; border-radius: 5px; cursor: pointer; }
.select-trigger.minimal { padding: 0.5rem 0.625rem; font-size: 1rem; min-height: 32px; border-radius: 5px; }
.select-trigger.icon-only { justify-content: center; padding: 0; width: 100%; height: 100%; border-radius: var(--radius-sm); box-sizing: border-box; min-height: 0; }
.select-trigger.icon-only .selected-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.select-dropdown { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 9999; max-height: 195px; overflow-y: auto; margin-bottom: 4px; animation: slideUp 0.2s ease; transform-origin: bottom; }
.select-dropdown.fixed { position: fixed !important; z-index: 99999 !important; bottom: auto !important; left: auto !important; right: auto !important; margin-bottom: 0 !important; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.select-option { padding: 0.4rem 0.6rem; font-size: 1rem; color: var(--text-primary); cursor: pointer; transition: all var(--transition-fast) ease; border-radius: var(--radius-sm); margin: 2px; text-align: center; flex-shrink: 0; min-width: 50px; display: flex; align-items: center; justify-content: center; }
.select-option:hover { background-color: var(--bg-subtle); color: var(--accent-color); }
.select-option.center-align { display: flex; align-items: center; justify-content: center; }
.arrow-icon { width: 16px; height: 16px; opacity: 0.4; transition: transform var(--transition-base) ease; }
.custom-select-container.is-active .select-trigger { border-color: var(--accent-color); }
.custom-select-container.is-active .arrow-icon { transform: rotate(180deg); }

/* === Row Delete Button === */
.row-delete-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-secondary); opacity: 0.5; cursor: pointer; border-radius: 6px; }
.row-delete-btn:hover { background-color: var(--error-bg); color: var(--error-text); opacity: 1; }

/* === Sort Button === */
.sort-btn { width: 24px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-secondary); opacity: 0.4; cursor: pointer; border-radius: 4px; padding: 0; }
.sort-btn:hover:not(:disabled) { background-color: var(--bg-subtle); color: var(--accent-color); opacity: 1; }
.sort-btn:disabled { opacity: 0.2; cursor: not-allowed; }
.sort-btn svg { width: 16px; height: 16px; }
.row-delete-btn svg { width: 16px; height: 16px; }
.row-delete-btn.icon-btn { width: 24px; height: 24px; padding: 2px; flex-shrink: 0; }
.row-delete-btn.icon-btn svg { width: 14px; height: 14px; }
.row-delete-btn.small { width: 28px; height: 28px; flex-shrink: 0; }
.row-delete-btn.small svg { width: 14px; height: 14px; }

/* === Add Button === */
.editor-add-btn { 
    width: 100%; 
    padding: 0.75rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.6rem; 
    background: rgba(255, 255, 255, 0.4); 
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1.5px dashed rgba(103, 119, 141, 0.25); 
    border-radius: 12px; 
    color: var(--text-secondary); 
    cursor: pointer; 
    font-family: inherit; 
    font-size: 0.95rem; 
    font-weight: 300; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    margin-top: 0.5rem; 
    flex-shrink: 0; 
}
.editor-add-btn:hover { 
    border-color: var(--accent-color); 
    color: var(--accent-color); 
    background: rgba(103, 119, 141, 0.05); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 16px rgba(103, 119, 141, 0.1); 
}
.editor-add-btn:active { transform: translateY(0); }
.editor-add-btn svg { width: 18px; height: 18px; }
.editor-add-btn.small { width: auto; margin-top: 0; padding: 0.375rem 0.625rem; font-size: 0.9rem; gap: 0.25rem; border-style: solid; border-width: 1px; }
.editor-add-btn.small svg { width: 14px; height: 14px; }

/* === Checkbox === */
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; padding-left: 0.625rem; border-left: 1.5px solid var(--border-color); transition: all var(--transition-base) ease; }
.checkbox-label:hover .checkbox-custom { border-color: var(--accent-color); }
.checkbox-custom { width: 18px; height: 18px; border: 2px solid var(--text-secondary); border-radius: var(--radius-sm); position: relative; transition: all var(--transition-base) ease; background-color: var(--bg-main); }
.checkbox-label input:checked + .checkbox-custom { background-color: var(--accent-color); border-color: var(--accent-color); transform: scale(1.05); }
.checkbox-label input:checked + .checkbox-custom::after { content: ''; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkbox-text { font-size: 1rem; font-weight: 300; color: var(--text-secondary); transition: color var(--transition-base) ease; }
.checkbox-label.checked .checkbox-text { color: var(--accent-color); font-weight: 500; }

/* === Form Row === */
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; }
.form-row.date-row { margin-top: 0.25rem; background: var(--bg-workspace); padding: 0.5rem; border-radius: 6px; border: 1px solid var(--border-color); }

/* === Date Input Group === */
.date-input-group.custom-date-logic { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.date-select-wrapper { display: flex; gap: 2px; flex: 1; min-width: 0; transition: opacity 0.2s; }
.date-select-wrapper.disabled { opacity: 0.4; pointer-events: none; }
.date-select-wrapper.disabled .select-trigger.mini { cursor: not-allowed; }
.date-part { flex: 1; min-width: 0; }
.date-part.year { flex: 1.4; }
.date-separator { font-size: 1rem; color: var(--text-secondary); font-weight: 300; }
