/**
 * DS Recipe Form - Frontend Styles
 * 
 * Styles for the recipe form on product pages and modal.
 * Uses minimal design with black, white, and accent color.
 * No shadows as per design preference.
 */

/* =====================================================
   Product Page Form
   ===================================================== */
.dsrf-product-form {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
}

/* Form title */
.dsrf-form-title {
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #d93a5e;
}

/* Form fields */
.dsrf-product-form .dsrf-field {
    margin-bottom: 15px;
}

.dsrf-product-form .dsrf-field:last-child {
    margin-bottom: 0;
}

/* Labels */
.dsrf-product-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Required asterisk */
.dsrf-product-form abbr.required {
    color: #d93a5e;
    text-decoration: none;
    border: none;
}

/* Input and textarea styling */
.dsrf-product-form input[type="text"],
.dsrf-product-form textarea {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #333;
    transition: border-color 0.2s ease;
}

.dsrf-product-form input[type="text"]:focus,
.dsrf-product-form textarea:focus {
    border-color: #d93a5e;
    outline: none;
}

.dsrf-product-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* =====================================================
   Modal Styles
   ===================================================== */
.dsrf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal overlay/backdrop */
.dsrf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

/* Modal content container */
.dsrf-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    padding: 30px;
    animation: dsrf-fadeIn 0.3s ease;
}

/* Fade in animation */
@keyframes dsrf-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close button */
.dsrf-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    padding: 0;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 30px;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dsrf-modal-close:hover {
    color: #d93a5e;
}

/* Modal title */
.dsrf-modal-title {
    margin: 0 0 5px 0;
    padding: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #d93a5e;
}

/* Product name in modal */
.dsrf-modal-product-name {
    margin: 10px 0 20px 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Modal form fields */
.dsrf-modal-form .dsrf-field {
    margin-bottom: 15px;
}

.dsrf-modal-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.dsrf-modal-form abbr.required {
    color: #d93a5e;
    text-decoration: none;
    border: none;
}

.dsrf-modal-form input[type="text"],
.dsrf-modal-form textarea {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #333;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.dsrf-modal-form input[type="text"]:focus,
.dsrf-modal-form textarea:focus {
    border-color: #d93a5e;
    outline: none;
}

.dsrf-modal-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* Error state for inputs */
.dsrf-modal-form input.dsrf-error,
.dsrf-modal-form textarea.dsrf-error {
    border-color: #d93a5e;
}

/* Modal buttons */
.dsrf-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.dsrf-btn-cancel,
.dsrf-btn-submit {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Cancel button */
.dsrf-btn-cancel {
    background: #fff;
    border-color: #e0e0e0;
    color: #666;
}

.dsrf-btn-cancel:hover {
    background: #f5f5f5;
    border-color: #333;
    color: #333;
}

/* Submit button */
.dsrf-btn-submit {
    background: #d93a5e;
    border-color: #d93a5e;
    color: #fff;
}

.dsrf-btn-submit:hover {
    background: #c42d4f;
    border-color: #c42d4f;
}

.dsrf-btn-submit:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

/* Modal message */
.dsrf-modal-message {
    margin-top: 15px;
    padding: 10px 15px;
    font-size: 14px;
    text-align: center;
}

.dsrf-modal-message.dsrf-success {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    color: #2e7d32;
}

.dsrf-modal-message.dsrf-error {
    background: #ffebee;
    border: 1px solid #d93a5e;
    color: #c62828;
}

/* Loading state */
.dsrf-modal-form.dsrf-loading .dsrf-btn-submit {
    position: relative;
    color: transparent;
}

.dsrf-modal-form.dsrf-loading .dsrf-btn-submit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: dsrf-spin 0.8s linear infinite;
}

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

/* =====================================================
   Archive Page Button
   ===================================================== */
.dsrf-modal-trigger {
    cursor: pointer;
}

/* =====================================================
   Cart Item Display
   ===================================================== */
.woocommerce-cart-form .dsrf-cart-item-data,
.woocommerce-checkout .dsrf-cart-item-data {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f9f9f9;
    border-left: 3px solid #d93a5e;
    font-size: 13px;
}

.dsrf-cart-item-data dt {
    font-weight: 600;
    color: #666;
}

.dsrf-cart-item-data dd {
    margin: 0 0 5px 0;
    color: #333;
}

/* =====================================================
   Responsive Styles
   ===================================================== */
@media screen and (max-width: 600px) {
    /* Modal adjustments */
    .dsrf-modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .dsrf-modal-title {
        font-size: 18px;
        padding-right: 30px;
    }
    
    /* Stack buttons on mobile */
    .dsrf-modal-buttons {
        flex-direction: column;
    }
    
    .dsrf-btn-cancel,
    .dsrf-btn-submit {
        width: 100%;
    }
    
    /* Product form adjustments */
    .dsrf-product-form {
        padding: 15px;
    }
}

