/**
 * Flavor Forms - Public Styles
 * @package FlavorForms
 */

/* ==========================================================================
   Form Container
   ========================================================================== */

.flavor-form-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

.flavor-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

/* ==========================================================================
   Form Fields
   ========================================================================== */

.ff-field-wrapper {
    margin-bottom: 20px;
}

.ff-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1e1e1e;
}

.ff-field-label .ff-required {
    color: #dc3545;
    margin-left: 3px;
}

.ff-field-description {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    color: #666;
}

/* Input fields */
.ff-field-input,
.ff-field-select,
.ff-field-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.ff-field-input:focus,
.ff-field-select:focus,
.ff-field-textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.ff-field-input::placeholder,
.ff-field-textarea::placeholder {
    color: #999;
}

/* Textarea specific */
.ff-field-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Select specific */
.ff-field-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='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 40px;
    cursor: pointer;
}

/* Checkbox and Radio */
.ff-checkbox-group,
.ff-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ff-checkbox-item,
.ff-radio-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.ff-checkbox-item input[type="checkbox"],
.ff-radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: #0073aa;
}

.ff-checkbox-item label,
.ff-radio-item label {
    cursor: pointer;
    font-weight: normal;
    color: #333;
}

/* File upload */
.ff-file-input {
    position: relative;
}

.ff-file-input input[type="file"] {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border: 2px dashed #e0e0e0;
    border-radius: 6px;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.ff-file-input input[type="file"]:hover {
    border-color: #0073aa;
}

.ff-file-input input[type="file"]:focus {
    outline: none;
    border-color: #0073aa;
    border-style: solid;
}

/* Range slider */
.ff-range-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ff-field-range {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 4px;
    outline: none;
}

.ff-field-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #0073aa;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ff-field-range::-webkit-slider-thumb:hover {
    background: #005a87;
}

.ff-range-value {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

/* Color picker */
.ff-field-color {
    width: 60px;
    height: 45px;
    padding: 4px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}

/* Date/Time inputs */
.ff-field-input[type="date"],
.ff-field-input[type="time"],
.ff-field-input[type="datetime-local"] {
    padding-right: 12px;
}

/* ==========================================================================
   Confirmation Fields (Repeater)
   ========================================================================== */

.ff-confirm-field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .ff-confirm-field-wrapper {
        flex-direction: row;
        gap: 20px;
    }
    
    .ff-confirm-field-wrapper .ff-field-group {
        flex: 1;
    }
}

.ff-field-group {
    display: flex;
    flex-direction: column;
}

.ff-field-group .ff-field-label {
    margin-bottom: 8px;
}

/* ==========================================================================
   Layout Fields
   ========================================================================== */

.ff-heading {
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.ff-heading h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1e1e1e;
}

.ff-heading h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e1e1e;
}

.ff-heading h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e1e1e;
}

.ff-divider {
    margin: 30px 0;
    border: 0;
    border-top: 2px solid #e0e0e0;
}

.ff-html-content {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
}

/* ==========================================================================
   Validation States
   ========================================================================== */

.ff-field-wrapper.ff-has-error .ff-field-input,
.ff-field-wrapper.ff-has-error .ff-field-select,
.ff-field-wrapper.ff-has-error .ff-field-textarea {
    border-color: #dc3545;
}

.ff-field-wrapper.ff-has-error .ff-field-input:focus,
.ff-field-wrapper.ff-has-error .ff-field-select:focus,
.ff-field-wrapper.ff-has-error .ff-field-textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.ff-field-error {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    color: #dc3545;
    font-weight: 500;
}

.ff-field-wrapper.ff-has-success .ff-field-input,
.ff-field-wrapper.ff-has-success .ff-field-select,
.ff-field-wrapper.ff-has-success .ff-field-textarea {
    border-color: #28a745;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

.ff-submit-wrapper {
    margin-top: 30px;
}

.ff-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background-color: #0073aa;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.ff-submit-button:hover {
    background-color: #005a87;
}

.ff-submit-button:active {
    transform: translateY(1px);
}

.ff-submit-button:disabled {
    background-color: #999;
    cursor: not-allowed;
    transform: none;
}

.ff-submit-button .ff-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ff-spin 0.8s linear infinite;
}

@keyframes ff-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Form Messages
   ========================================================================== */

.ff-form-message {
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
}

.ff-form-message.ff-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ff-form-message.ff-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.ff-form-message ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.ff-form-message li {
    margin-bottom: 5px;
}

/* ==========================================================================
   Honeypot
   ========================================================================== */

.ff-hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

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

@media (max-width: 767px) {
    .ff-field-wrapper {
        margin-bottom: 16px;
    }
    
    .ff-field-input,
    .ff-field-select,
    .ff-field-textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .ff-submit-button {
        width: 100%;
        padding: 14px 20px;
    }
    
    .ff-heading h2 {
        font-size: 20px;
    }
    
    .ff-heading h3 {
        font-size: 18px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .flavor-form {
        color: #e0e0e0;
    }
    
    .ff-field-label {
        color: #e0e0e0;
    }
    
    .ff-field-description {
        color: #a0a0a0;
    }
    
    .ff-field-input,
    .ff-field-select,
    .ff-field-textarea {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .ff-field-input::placeholder,
    .ff-field-textarea::placeholder {
        color: #888;
    }
    
    .ff-checkbox-item label,
    .ff-radio-item label {
        color: #e0e0e0;
    }
    
    .ff-heading h2,
    .ff-heading h3,
    .ff-heading h4 {
        color: #e0e0e0;
    }
    
    .ff-html-content {
        background-color: #2d2d2d;
    }
}

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

@media print {
    .ff-submit-wrapper {
        display: none;
    }
    
    .ff-field-input,
    .ff-field-select,
    .ff-field-textarea {
        border-color: #000;
    }
}
