/**
 * Admin CSS for Dynamic Pricing by AICOSO
 */

/* General Panel Styling */
.dp-aicoso-panel {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.dp-aicoso-panel h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.dp-aicoso-panel h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Import/Export Page Styling */
.dp-aicoso-import-export-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.dp-aicoso-import-export-wrapper .dp-aicoso-panel {
    flex: 1;
    min-width: 300px;
}

.export-format-wrapper {
    padding: 10px 0;
}

.export-format-wrapper label {
    display: inline-block;
    margin-right: 20px;
}

.file-upload-wrapper {
    margin: 15px 0;
}

.file-upload-wrapper .description {
    display: block;
    margin-top: 5px;
    color: #666;
}

/* Form Styling */
#dp-aicoso-rule-form .form-table th {
    width: 200px;
}

#dp-aicoso-rule-form .required {
    color: #dc3232;
}

#dp-aicoso-rule-form input[type="text"],
#dp-aicoso-rule-form input[type="number"],
#dp-aicoso-rule-form input[type="date"],
#dp-aicoso-rule-form input[type="time"],
#dp-aicoso-rule-form select {
    max-width: 400px;
}

#dp-aicoso-rule-form textarea {
    width: 100%;
    max-width: 600px;
}

/* Status Badge Styling */
.dp-aicoso-status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.dp-aicoso-status-active {
    background: #46b450;
    color: #fff;
}

.dp-aicoso-status-inactive {
    background: #dc3232;
    color: #fff;
}

.dp-aicoso-status-scheduled {
    background: #ffb900;
    color: #fff;
}

/* Rule Type Badge Styling */
.dp-aicoso-rule-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    background: #f1f1f1;
    color: #555;
}

.dp-aicoso-type-product {
    background: #e3f2fd;
    color: #1565c0;
}

.dp-aicoso-type-category {
    background: #f3e5f5;
    color: #7b1fa2;
}

.dp-aicoso-type-role {
    background: #e8f5e9;
    color: #2e7d32;
}

.dp-aicoso-type-time {
    background: #fff3e0;
    color: #e65100;
}

.dp-aicoso-type-custom {
    background: #fce4ec;
    color: #c2185b;
}

/* Quantity Pricing Table */
#quantity-pricing-table {
    margin-top: 15px;
}

#quantity-pricing-table input[type="number"] {
    width: 100px;
}

#quantity-pricing-table select {
    width: 150px;
}

#add-quantity-row {
    margin-top: 10px;
}

/* Conditions Container */
#conditions-container {
    margin: 15px 0;
}

.condition-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.condition-row .condition-type-select {
    min-width: 120px;
    max-width: 150px;
}

.condition-row .condition-operator-select {
    min-width: 150px;
    max-width: 200px;
}

.condition-row .condition-value-input {
    flex: 1;
    min-width: 150px;
}

.condition-row .select2-container {
    min-width: 300px !important;
    flex: 1;
}

.condition-row select,
.condition-row input {
    flex: 1;
    min-width: 120px;
}

.condition-row button {
    flex: 0 0 auto;
}

/* Rule List Table Actions */
.dp-aicoso-rules-list-table .column-actions {
    width: 200px;
}

.dp-aicoso-rules-list-table .button-small {
    margin-right: 5px;
}

/* Notice Styling */
.notice.is-dismissible {
    position: relative;
    padding-right: 38px;
}

.notice-dismiss {
    position: absolute;
    top: 0;
    right: 1px;
    border: none;
    margin: 0;
    padding: 9px;
    background: none;
    color: #72777c;
    cursor: pointer;
}

.notice-dismiss:hover:before,
.notice-dismiss:focus:before {
    color: #c00;
}

.notice-dismiss:before {
    background: none;
    color: #72777c;
    content: "\f153";
    display: block;
    font: normal 16px/20px dashicons;
    speak: none;
    height: 20px;
    text-align: center;
    width: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Select2 Override Styles */
.select2-container {
    max-width: 400px !important;
}

.select2-container .select2-selection--single {
    height: 30px;
    line-height: 28px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 28px;
}

/* Submit Buttons */
.submit {
    padding: 20px 0 0;
    margin: 20px 0 0;
    border-top: 1px solid #eee;
}

.submit .button {
    margin-right: 10px;
}

/* Clear Dates Button */
#clear-dates-btn {
    margin-top: 5px;
}

#clear-dates-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

#clear-dates-btn:hover {
    border-color: #d63638;
    color: #d63638;
}

#clear-dates-btn.button-primary {
    background: #00a32a;
    border-color: #00a32a;
    color: #fff;
}

#clear-dates-btn.button-primary:hover {
    background: #008a20;
    border-color: #008a20;
}

/* Loading Spinner */
.spinner.is-active {
    visibility: visible;
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    #dp-aicoso-rule-form .form-table th {
        width: auto;
        display: block;
        padding-bottom: 5px;
    }
    
    .condition-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .condition-row select,
    .condition-row input {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Import/Export Styles */
.dp-aicoso-import-export {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.dp-aicoso-import-export > div {
    flex: 1;
}

.dp-aicoso-import-export textarea {
    width: 100%;
    height: 200px;
    font-family: monospace;
    font-size: 12px;
}

/* Reports Dashboard */
.dp-aicoso-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.dp-aicoso-stat-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
}

.dp-aicoso-stat-card h3 {
    margin: 0 0 10px;
    color: #23282d;
}

.dp-aicoso-stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #0073aa;
}

.dp-aicoso-stat-card .stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* Hide panels initially that should be shown based on rule type */
#rule-targets-panel,
#adjustments-panel {
    display: none;
}

/* Make sure buttons are properly styled */
.button.remove-quantity-row,
.button.remove-condition {
    color: #a00;
}

.button.remove-quantity-row:hover,
.button.remove-condition:hover {
    color: #dc3232;
    border-color: #dc3232;
}

/* Date and Time Input Styling */
input[type="date"],
input[type="time"] {
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    background-color: #fff;
    color: #2c3338;
    box-shadow: 0 0 0 transparent;
    transition: border-color 150ms ease-in-out;
}

input[type="date"]:focus,
input[type="time"]:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
    outline: none;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}