/* Promotion Add Form Styles */
#promotion-add-form-wrapper {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    max-width: 800px; /* Adjust max-width as needed */
    margin: 20px auto; /* Center the form */
    font-family: sans-serif; /* Use a common sans-serif font */
}

#promotion-add-form-wrapper h2 {
    color: #D40000; /* Rosso Corsa Red */
    margin-bottom: 20px;
    border-bottom: 2px solid #D40000;
    padding-bottom: 10px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
}

#promotion-add-form-wrapper h2 i {
    margin-right: 10px;
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

/* Base styles for inputs and selects */
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="url"],
.form-field input[type="password"],
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
    background-color: #fff;
    min-height: 45px; /* Consistent height */
    font-size: 1em; /* Consistent font size */
    line-height: normal; /* Consistent line height */
}

/* Custom styling for select dropdowns */
.form-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23D40000' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); /* Custom dropdown arrow (Red) */
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px; /* Make space for the arrow */
}

/* Focus styles */
.form-field input[type="text"]:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: #D40000; /* Rosso Corsa Red on focus */
    outline: none;
    box-shadow: 0 0 5px rgba(212, 0, 0, 0.3);
}

.form-field .required {
    color: #D40000; /* Rosso Corsa Red */
    margin-left: 4px;
}

/* Inline fields container for dates */
.form-field-inline {
    display: flex;
    gap: 20px; /* Space between start and end date groups */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* Individual date group (start or end) */
.date-select-group {
    flex: 1; /* Each group tries to take equal space */
    min-width: 280px; /* Minimum width before wrapping - adjust as needed */
}

.date-select-group label {
     margin-bottom: 8px; /* Ensure space below label */
}

/* Container for the day/month/year dropdowns */
.date-dropdowns {
    display: flex; /* Arrange dropdowns in a row */
    gap: 10px; /* Space between day, month, year dropdowns */
    align-items: center; /* Align items vertically */
}

/* Styling for individual date dropdowns */
.date-dropdowns select {
    flex: 1 1 auto; /* Allow shrinking but prefer auto width based on content */
    width: auto; /* Override the 100% width set earlier */
    /* Adjust min-width as needed, e.g., for year */
}
/* Specific widths/growth factors for better layout */
.date-dropdowns select[id$='_day']   { min-width: 70px; flex-grow: 0; flex-shrink: 1; } /* Day: fixed min, can shrink */
.date-dropdowns select[id$='_month'] { min-width: 80px; flex-grow: 1; flex-shrink: 1; } /* Month: takes more space, can shrink */
.date-dropdowns select[id$='_year']  { min-width: 90px; flex-grow: 0; flex-shrink: 1; } /* Year: fixed min, can shrink */


/* WP Editor Styles */
.wp-editor-wrap {
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
}
.wp-editor-tools {
    background-color: #f1f1f1;
    border-bottom: 1px solid #ccc;
    border-radius: 5px 5px 0 0;
}
.wp-editor-container textarea#promo_detail {
    border: none;
    border-radius: 0 0 5px 5px;
    box-shadow: none;
    width: 100% !important;
}

/* Image Uploader Styles */
#promo-image-uploader.drop-zone {
    border: 3px dashed #ccc;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background-color: #fff;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    position: relative;
}

#promo-image-uploader.drop-zone.dragover {
    border-color: #D40000; /* Rosso Corsa Red */
    background-color: #ffeaea;
}

#promo-image-uploader.drop-zone p {
    margin: 0 0 15px 0;
    color: #666;
}

#promo-image-uploader.drop-zone.has-image p {
    display: none; /* Hide text when image is present */
}


#upload-image-button.button {
    background-color: #555;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 1em; /* Match other inputs */
    line-height: normal;
    vertical-align: middle; /* Align with dropdowns if needed */
}

#upload-image-button.button:hover {
    background-color: #333;
}

#promo-image-preview {
    margin-top: 15px;
    max-width: 100%;
    text-align: center;
}

#promo-image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 5px;
    border: 1px solid #eee;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Submit Button and Spinner */
.form-submit {
    text-align: right;
    margin-top: 30px;
}

#submit-promotion.button-primary {
    background-color: #D40000; /* Rosso Corsa Red */
    border-color: #b30000; /* Darker red for border */
    color: white;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    line-height: normal;
}
#submit-promotion.button-primary i {
    margin-right: 8px;
}


#submit-promotion.button-primary:hover:not(:disabled) {
    background-color: #b30000; /* Darker red on hover */
    border-color: #990000;
}

#submit-promotion:disabled {
    background-color: #e0e0e0;
    border-color: #ccc;
    color: #999;
    cursor: not-allowed;
}

/* WordPress Spinner */
.spinner {
    background: url(/wp-admin/images/spinner.gif) no-repeat; /* Adjust path if needed */
    background-size: 20px 20px;
    display: inline-block;
    vertical-align: middle;
    opacity: 0;
    width: 20px;
    height: 20px;
    margin: 0 0 0 10px; /* Position relative to the button */
    transition: opacity .25s;
    visibility: hidden; /* Hide spinner initially */
}

.spinner.is-active {
    opacity: 1;
    visibility: visible; /* Show spinner when active */
}

/* Messages */
#promotion-add-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid transparent;
    display: none; /* Hidden by default */
    text-align: center;
}

#promotion-add-message.success {
    background-color: #dff0d8; /* Light green */
    border-color: #d6e9c6;
    color: #3c763d; /* Dark green */
}

#promotion-add-message.error {
    background-color: #f2dede; /* Light red */
    border-color: #ebccd1;
    color: #a94442; /* Dark red */
}

#promotion-add-message p {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#promotion-add-message p i {
    margin-right: 8px;
    font-size: 1.2em;
}

/* Responsive Adjustments */
@media (max-width: 700px) { /* Adjust breakpoint if needed */
    .form-field-inline {
        flex-direction: column; /* Stack date groups on small screens */
        gap: 0; /* Remove gap when stacked */
    }
    .date-select-group {
        margin-bottom: 20px; /* Add space between stacked date groups */
        min-width: 100%; /* Take full width when stacked */
    }
     .date-select-group:last-child {
        margin-bottom: 0;
    }
    .date-dropdowns {
        /* Keep dropdowns inline within their group */
        gap: 8px; /* Adjust gap if needed */
    }
     #promotion-add-form-wrapper {
        padding: 15px;
    }
    .form-submit {
        text-align: center;
    }
    #submit-promotion.button-primary {
        width: 100%;
        justify-content: center; /* Center button text/icon */
    }
    .spinner {
        margin: 0 0 0 5px;
    }
}

@media (max-width: 400px) {
    /* Optional: Stack dropdowns on very small screens if needed */
    /* This might be too cramped, but uncomment to test */
    /*
    .date-dropdowns {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
     .date-dropdowns select {
        width: 100%;
        min-width: 100%;
    }
    */
}
