/* ==================================
   Minimal Base CSS - Essential UI/UX Only
   No opinionated styling - works with any framework
   ================================== */

/* Basic Reset */
* {
    box-sizing: border-box;
}

/* Ensure body takes full height */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ==================================
   Form Field Structure
   ================================== */

.form-field {
    margin-bottom: 1.5rem;
}

/* ==================================
   Labels
   ================================== */

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-label__required {
    color: #dc2626;
}

/* ==================================
   Descriptions and Hints
   ================================== */

.form-description {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.75;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

.form-error {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc2626;
}

/* ==================================
   Base Input Styles
   ================================== */

.form-input {
    width: 100%;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

.form-input:focus {
    outline: 2px solid #F2651C;
    outline-offset: 2px;
}

.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Textarea */
.form-input--textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select */
.form-input--select {
    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='%234b5563' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 2rem;
}

/* ==================================
   Checkbox and Radio
   ================================== */

.form-checkbox-wrapper,
.form-checkbox-item,
.form-radio-item {
    margin-bottom: 0.5rem;
}

.form-checkbox-label,
.form-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-input--checkbox,
.form-input--radio {
    width: auto;
    cursor: pointer;
}

/* ==================================
   File Upload
   ================================== */

.form-file-wrapper {
    width: 100%;
}

.form-file-list {
    margin-top: 0.5rem;
}

.form-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
}

.form-file-name {
    flex: 1;
    font-size: 0.875rem;
}

.form-file-size {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.5rem;
}

.form-file-remove {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #dc2626;
}

/* ==================================
   Message and List Display
   ================================== */

.form-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #F2651C;
    background: #fef7f0;
}

.form-list {
    list-style: none;
    padding-left: 0;
}

.form-list-item {
    padding: 0.25rem 0 0.25rem 1.5rem;
    position: relative;
}

.form-list-item::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
}

/* ==================================
   Fieldset
   ================================== */

.form-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.form-checkbox-group,
.form-radio-group {
    margin-top: 0.5rem;
}

/* ==================================
   Inputs Array (Repeatable Fields)
   ================================== */

.form-array-container {
    margin-top: 1rem;
}

.form-array-instance {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
}

.form-array-instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-array-instance-title {
    margin: 0;
    font-size: 1.125rem;
}

.form-array-instance-actions {
    display: flex;
    gap: 0.5rem;
}

.form-array-instance-fields .form-field {
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 0.25rem;
}

.form-array-footer {
    margin-top: 1rem;
}

.form-array-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
    cursor: pointer;
}

.form-array-btn:hover {
    background: #f3f4f6;
}

.form-array-btn--add {
    background: #F2651C;
    color: white;
    border-color: #F2651C;
}

.form-array-btn--add:hover {
    background: #BB6C0F;
}

.form-array-btn--remove {
    color: #dc2626;
    border-color: #dc2626;
}

.form-array-btn--remove:hover {
    background: #fef2f2;
}

/* ==================================
   Form Navigation
   ================================== */

.form-navigation {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

/* ==================================
   Buttons
   ================================== */

.form-btn {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-family: inherit;
}

.form-btn--primary {
    background: #F2651C;
    color: white;
}

.form-btn--primary:hover {
    background: #BB6C0F;
}

.form-btn--primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.form-btn--secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.form-btn--secondary:hover {
    background: #f3f4f6;
}

.form-btn--text {
    background: transparent;
    padding: 0.5rem;
}

.form-btn--text:hover {
    background: #f3f4f6;
}

.form-btn--danger {
    color: #dc2626;
}

/* ==================================
   Auto-save Indicator
   ================================== */

.form-autosave {
    padding: 0.5rem 1rem;
    background: #f9fafb;
    text-align: center;
}

.form-autosave-text {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ==================================
   Success State
   ================================== */

.form-success {
    padding: 2rem;
    text-align: center;
}

.form-success-title {
    color: #2FA763;
    margin-bottom: 1rem;
}

.form-success-details {
    margin: 1rem 0;
}

.form-success-details summary {
    cursor: pointer;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 0.25rem;
}

.form-success-data {
    margin-top: 0.5rem;
    padding: 1rem;
    background: #1f2937;
    color: #f3f4f6;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875rem;
    text-align: left;
    overflow-x: auto;
    white-space: pre;
}

/* ==================================
   Loading State
   ================================== */

.loading-container,
.error-container {
    padding: 2rem;
    text-align: center;
}

/* ==================================
   Accessibility - Focus Visible
   ================================== */

*:focus-visible {
    outline: 2px solid #F2651C;
    outline-offset: 2px;
}

/* ==================================
   Responsive Design
   ================================== */

@media (max-width: 640px) {
    .form-navigation {
        flex-direction: column;
    }

    .form-btn {
        width: 100%;
    }

    .form-array-instance-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ==================================
   Print Styles
   ================================== */

@media print {
    .form-navigation,
    .form-actions,
    .form-autosave,
    .form-btn {
        display: none;
    }
}
