/* Claude AI Forms CSS - UPDATED: Compact & Consistent Styling */

/* Form Foundation */
.form {
    width: 100%;
}

/* REDESIGNED: Compact Form Groups */
.form-group {
    margin-bottom: var(--space-3); /* Reduced from space-6 */
}

/* REDESIGNED: Compact Labels */
.label {
    display: flex;
    align-items: center;
    gap: var(--space-1); /* Reduced gap */
    margin-bottom: var(--space-2); /* Reduced margin */
    font-size: 11px; /* Smaller text */
    font-weight: var(--font-semibold);
    color: var(--gray-800);
    line-height: 1.2;
}

/* REDESIGNED: Compact Input Styles */
.input,
.textarea,
.select {
    width: 100%;
    padding: var(--space-2) var(--space-3); /* Reduced padding */
    border: 1px solid var(--gray-300); /* Thinner border */
    border-radius: var(--radius-md); /* Smaller radius */
    font-size: var(--text-xs); /* Smaller text */
    font-family: var(--font-family);
    color: var(--gray-900);
    background: white;
    transition: all var(--transition-normal);
    line-height: var(--leading-normal);
    min-height: 32px; /* Compact minimum height */
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--orange-400);
    box-shadow: 0 0 0 2px rgba(238, 119, 35, 0.08);
    background: var(--orange-25, #fefaf8);
}

.input:hover,
.textarea:hover,
.select:hover {
    border-color: var(--gray-400);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--gray-500);
    font-style: italic;
    font-size: 11px; /* Smaller placeholder */
}

/* REDESIGNED: Compact Textarea */
.textarea {
    resize: vertical;
    min-height: 64px; /* Smaller minimum height */
    max-height: 120px; /* Prevent excessive height */
    line-height: var(--leading-relaxed);
}

/* REDESIGNED: Compact Select */
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23374151' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--space-2) center;
    background-repeat: no-repeat;
    background-size: 14px; /* Smaller arrow */
    padding-right: var(--space-8);
    cursor: pointer;
}

.select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ee7723' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Legacy Topic/Custom Inputs - COMPACT */
.form-group.topic-input,
.form-group.custom-prompt {
    background: var(--gray-25);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-3); /* Compact padding */
    margin-bottom: var(--space-3);
    transition: all var(--transition-normal);
}

.form-group.topic-input:hover,
.form-group.custom-prompt:hover {
    border-color: var(--gray-300);
    background: white;
    box-shadow: var(--shadow-xs);
}

.form-group.topic-input:focus-within,
.form-group.custom-prompt:focus-within {
    border-color: var(--orange-300);
    background: white;
    box-shadow: 0 0 0 2px rgba(238, 119, 35, 0.08);
}

/* REDESIGNED: Compact Word Counter */
.word-counter {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: var(--space-2); /* Reduced margin */
    gap: var(--space-2);
    font-size: 10px; /* Smaller text */
    color: var(--gray-500);
}

.counter-item {
    display: flex;
    align-items: center;
    gap: 2px; /* Tighter spacing */
    background: var(--gray-100);
    padding: 2px var(--space-1); /* Smaller padding */
    border-radius: var(--radius-sm);
    font-weight: var(--font-medium);
    border: 1px solid var(--gray-200);
}

.counter-number {
    font-weight: var(--font-semibold);
    color: var(--orange-600);
}

/* Error States */
.input.error,
.textarea.error,
.select.error {
    border-color: var(--error-500);
    background: var(--error-25, #fefcfc);
}

.input.error:focus,
.textarea.error:focus,
.select.error:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08);
}

/* Success States */
.input.success,
.textarea.success,
.select.success {
    border-color: var(--success-500);
    background: var(--success-25, #fcfffe);
}

/* Disabled States */
.input:disabled,
.textarea:disabled,
.select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--gray-100);
    border-color: var(--gray-200);
}

/* Required Field Indicator */
.label .required {
    color: var(--error-500);
    margin-left: var(--space-1);
    font-size: 10px;
}

/* REDESIGNED: Compact Validation Messages */
.field-error {
    margin-top: var(--space-1);
    font-size: 10px; /* Smaller text */
    color: var(--error-600);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    line-height: 1.2;
}

.field-success {
    margin-top: var(--space-1);
    font-size: 10px; /* Smaller text */
    color: var(--success-600);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    line-height: 1.2;
}

.field-help {
    margin-top: var(--space-1);
    font-size: 9px; /* Very small help text */
    color: var(--gray-500);
    line-height: var(--leading-normal);
    font-style: italic;
}

/* REDESIGNED: Compact Input Groups */
.input-group {
    display: flex;
    gap: var(--space-2); /* Reduced gap */
    align-items: flex-end;
}

.input-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* REDESIGNED: Compact Checkbox and Radio Styles */
.checkbox,
.radio {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    margin-bottom: var(--space-2); /* Reduced margin */
    font-size: var(--text-xs); /* Smaller text */
}

.checkbox input,
.radio input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox .checkmark,
.radio .checkmark {
    width: 16px; /* Smaller checkmarks */
    height: 16px;
    border: 1px solid var(--gray-400); /* Thinner border */
    border-radius: var(--radius-sm);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.radio .checkmark {
    border-radius: var(--radius-full);
}

.checkbox:hover .checkmark,
.radio:hover .checkmark {
    border-color: var(--orange-400);
}

.checkbox input:checked + .checkmark,
.radio input:checked + .checkmark {
    background: var(--orange-500);
    border-color: var(--orange-500);
    color: white;
}

.checkbox input:checked + .checkmark::after {
    content: '✓';
    font-size: 10px; /* Smaller checkmark */
    font-weight: bold;
}

.radio input:checked + .checkmark::after {
    content: '';
    width: 6px; /* Smaller dot */
    height: 6px;
    border-radius: var(--radius-full);
    background: white;
}

/* REDESIGNED: Compact File Input */
.file-input {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.file-input input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3); /* Smaller padding */
    border: 1px dashed var(--gray-300); /* Thinner border */
    border-radius: var(--radius-md);
    background: var(--gray-25);
    color: var(--gray-700);
    font-size: var(--text-xs); /* Smaller text */
    transition: all var(--transition-normal);
    min-height: 40px; /* Compact height */
}

.file-input:hover .file-input-label {
    border-color: var(--orange-400);
    background: var(--orange-50);
    color: var(--orange-700);
}

/* REDESIGNED: Compact Toggle Switches */
.toggle-switch {
    width: 36px; /* Compact size */
    height: 20px;
    background: var(--gray-300);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background-color var(--transition-normal);
    border: 1px solid var(--gray-400);
}

.toggle-switch.active {
    background: var(--orange-500);
    border-color: var(--orange-500);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-xs);
}

.toggle-switch.active::after {
    transform: translateX(16px);
}

/* Input with Icon */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    padding-left: var(--space-8);
}

.input-with-icon .input-icon {
    position: absolute;
    left: var(--space-2);
    color: var(--gray-500);
    pointer-events: none;
    width: 14px;
    height: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .word-counter {
        flex-direction: column;
        gap: var(--space-1);
    }
    
    .form-group.topic-input,
    .form-group.custom-prompt {
        padding: var(--space-2);
    }
    
    .input,
    .textarea,
    .select {
        padding: var(--space-2);
        font-size: 11px;
        min-height: 30px;
    }
    
    .textarea {
        min-height: 60px;
    }
    
    .checkbox .checkmark,
    .radio .checkmark {
        width: 14px;
        height: 14px;
    }
    
    .toggle-switch {
        width: 32px;
        height: 18px;
    }
    
    .toggle-switch::after {
        width: 12px;
        height: 12px;
    }
    
    .toggle-switch.active::after {
        transform: translateX(14px);
    }
}

@media (max-width: 480px) {
    .form-group {
        margin-bottom: var(--space-2);
    }
    
    .counter-item {
        font-size: 9px;
        padding: 1px var(--space-1);
    }
    
    .input,
    .textarea,
    .select {
        font-size: 11px;
        padding: var(--space-1) var(--space-2);
        min-height: 28px;
    }
    
    .textarea {
        min-height: 56px;
    }
    
    .label {
        font-size: 10px;
    }
    
    .field-error,
    .field-success {
        font-size: 9px;
    }
    
    .field-help {
        font-size: 8px;
    }
}

/* Focus management for accessibility */
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
    outline: 2px solid var(--orange-500);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .input,
    .textarea,
    .select {
        border-width: 2px;
    }
    
    .input:focus,
    .textarea:focus,
    .select:focus {
        border-color: var(--orange-600);
    }
    
    .checkbox .checkmark,
    .radio .checkmark {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .input,
    .textarea,
    .select {
        border: 1px solid black;
        background: white;
        color: black;
    }
    
    .word-counter,
    .field-help {
        display: none;
    }
    
    .form-group.topic-input,
    .form-group.custom-prompt {
        border: 1px solid black;
        background: white;
    }
}