.yeekit-dd-rule-edit {
    max-width: 1100px;
    margin-top: 20px;
}

.yeekit-dd-block {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    margin-bottom: 24px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.yeekit-dd-block-title {
    margin: 0;
    padding: 14px 18px;
    background: #f6f7f7;
    border-bottom: 1px solid #ccd0d4;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.yeekit-dd-block-content {
    padding: 18px;
}

/* =========================
   Rules (Conditions) layout
   ========================= */

/* Rules (Conditions) layout */
.yeekit-cond-row {
    display: flex;
    flex-wrap: wrap;
    /* Allow description to wrap */
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    justify-content: flex-start;
    background: #fff;
    padding: 16px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    position: relative;
}

.yeekit-cond-row:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.yeekit-cond-row select,
.yeekit-cond-row input[type="text"],
.yeekit-cond-row input[type="number"] {
    min-width: 180px;
}

.yeekit-cond-operator {
    min-width: 80px;
}

.yeekit-cond-value {
    min-width: 260px;
}

.yeekit-cond-value .select2-container,
.yeekit-cond-value .selectWoo-container {
    min-width: 260px !important;
}

/* Remove condition icon */
.yeekit-cond-remove {
    cursor: pointer;
    color: #d63638;
    margin-left: auto;
    /* Push to right */
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 20px;
}

.yeekit-cond-remove:hover {
    background: #f0f0f1;
    color: #d63638;
}

.yeekit-cond-desc {
    font-size: 13px;
    color: #666;
    margin: 8px 0 0 0;
    width: 100%;
    flex-basis: 100%;
    font-style: italic;
    display: block;
    /* Ensure it renders block */
}

/* Add condition button spacing */
#yeekit-dd-add-condition {
    margin-top: 10px;
}

.yeekit-dd-block .button {
    min-height: 34px;
}

.yeekit-dd-block .button-primary {
    font-weight: 600;
}

.yeekit-dd-block+.yeekit-dd-block {
    margin-top: 28px;
}

@media (max-width: 782px) {
    .yeekit-cond-row {
        flex-direction: column;
        align-items: stretch;
    }

    .yeekit-cond-remove {
        margin-left: 0;
        align-self: flex-end;
    }
}

/* =========================
   Filters (match Rules UI)
   ========================= */

.yeekit-filter-row {
    display: flex;
    flex-wrap: wrap;
    /* Allow description to wrap */
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    justify-content: flex-start;
    background: #fff;
    padding: 16px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    position: relative;
    /* For remove icon positioning if needed */
}

.yeekit-filter-row:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.yeekit-filter-row select,
.yeekit-filter-row input[type="text"],
.yeekit-filter-row input[type="number"] {
    min-width: 180px;
}

.yeekit-filter-operator {
    min-width: 80px;
}

.yeekit-filter-value {
    min-width: 260px;
}

.yeekit-filter-value .select2-container,
.yeekit-filter-value .selectWoo-container {
    min-width: 260px !important;
}

/* Remove filter icon */
.yeekit-filter-remove {
    cursor: pointer;
    color: #d63638;
    margin-left: auto;
    /* Push to right */
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 20px;
}

.yeekit-filter-remove:hover {
    background: #f0f0f1;
    color: #d63638;
}

@media (max-width: 782px) {
    .yeekit-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .yeekit-filter-remove {
        margin-left: 0;
        align-self: flex-end;
    }
}

/* =========================
   New Tiers Layout (Div-based)
   ========================= */

.yeekit-tiers-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.yeekit-tier-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 12px;
    background: #fbfbfc;
    border: 1px solid #e2e4e7;
    padding: 15px;
    border-radius: 4px;
}

.yeekit-tier-row:hover {
    background: #f6f7f7;
    border-color: #ccd0d4;
}

.tier-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    /* Fix flex overflow */
}

.tier-line-1,
.tier-line-2 {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    /* Align inputs to bottom */
    gap: 15px;
}

.yeekit-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.yeekit-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #646970;
}

.yeekit-form-group input[type="number"],
.yeekit-form-group input[type="text"],
.yeekit-form-group select,
.yeekit-form-group .select2-container,
.yeekit-form-group .selectWoo-container {
    width: 100%;
    min-width: 120px;
    max-width: 250px !important;
}

/* Specific Widths */
.yeekit-form-group input[type="number"] {
    width: 100px;
}

.tier-grow {
    flex-grow: 1;
}

.tier-grow input {
    width: 100% !important;
}

.yeekit-checkbox-wrapper {
    height: 30px;
    /* Match input height roughly */
    display: flex;
    align-items: center;
}

.tier-actions {
    display: flex;
    align-items: center;
    padding-top: 20px;
    /* Align with first row inputs roughly */
}

.yeekit-remove-tier,
.yeekit-remove-set-tier,
.yeekit-remove-bogo-tier,
.yeekit-remove-bxgy-tier {
    margin: 0;
    font-size: 20px;
    height: 20px;
    width: 20px;
}

/* Responsive adjustments */
@media (max-width: 782px) {

    .tier-line-1,
    .tier-line-2 {
        flex-direction: column;
        align-items: stretch;
    }

    .yeekit-form-group input[type="number"],
    .yeekit-form-group input[type="text"],
    .yeekit-form-group select {
        width: 100%;
        max-width: none;
    }

    .tier-actions {
        padding-top: 0;
        align-self: flex-start;
    }
}

/* Fieldset Group Styling */
.yeekit-fieldset-group {
    position: relative;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 15px 12px 12px 12px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
}

.yeekit-fieldset-legend {
    position: absolute;
    top: -9px;
    left: 10px;
    background: #fbfbfc;
    /* Match row background */
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    color: #646970;
    line-height: 1.4;
}

.yeekit-fieldset-content {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

/* Discount Bar Styling */
.yeekit-db-colors-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.yeekit-db-colors-row .yeekit-form-group {
    flex: 1;
}

.yeekit-color-picker-wrapper input[type="color"] {
    width: 60px;
    height: 36px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    max-width: 60px !important;
    /* Override global select max-width if applied */
}

.yeekit-db-message-row {
    margin-top: 20px;
}

/* Discount Bar Textarea */
.yeekit-db-message-row textarea {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    resize: vertical;
    min-height: 80px;
}

/* Settings Tab Styling */
.yeekit-settings-wrapper {
    margin-top: 20px;
}

.yeekit-settings-wrapper>h3 {
    background: #fff;
    padding: 20px;
    margin: 0 0 0 0;
    border-bottom: 1px solid #eee;
    font-size: 1.3em;
    border-radius: 8px 8px 0 0;
    margin-top: 30px;
    border: 1px solid #dcdcde;
    border-bottom: none;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}

.yeekit-settings-wrapper>.form-table {
    background: #fff;
    padding: 20px;
    margin-top: 0 !important;
    border-radius: 0 0 8px 8px;
    border: 1px solid #dcdcde;
    border-top: none;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
    display: table;
    /* Ensure it behaves like a table/card */
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.yeekit-settings-wrapper>.form-table th {
    padding: 20px 20px 20px 20px;
    width: 250px;
    font-weight: 500;
}

.yeekit-settings-wrapper>.form-table td {
    padding: 15px 20px;
}

/* Fix for standard WC checkboxes spacing in card */
.yeekit-settings-wrapper .form-table td fieldset {
    margin-top: 0;
}

.yeekit-type-desc {
    display: none;
    margin-top: 5px;
    font-style: italic;
    color: #666;
}

.yeekit-filter-row {
    flex-wrap: wrap;
}

.yeekit-filter-desc {
    display: none;
    font-size: 13px;
    /* Slightly larger for readability if it has its own line */
    color: #666;
    margin: 8px 0 0 0;
    width: 100%;
    flex-basis: 100%;
    font-style: italic;
}



.yeekit-block-desc {

    padding: 12px 0px;
    line-height: 1.5;
}

/* Hide WooCommerce submit button on tabs that don't need it */
body.woocommerce_page_wc-settings[class*="yeekit-dd-tab-rules"] p.submit,
body.woocommerce_page_wc-settings[class*="yeekit-dd-tab-import_export"] p.submit,
body.woocommerce_page_wc-settings[class*="yeekit-dd-tab-reports"] p.submit {
    display: none !important;
}

/* ===================================
   Reports Dashboard Styles
   =================================== */

/* Filters */
.yeekit-reports-filters {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.yeekit-filter-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: nowrap;
}

.yeekit-date-range-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.yeekit-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yeekit-filter-group label {
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
}

.yeekit-filter-group input[type="date"],
.yeekit-filter-group select {
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
}

.yeekit-filter-actions {
    display: flex;
    gap: 10px;
}

/* Metrics Grid */
.yeekit-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.yeekit-metric-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #2271b1;
}

.yeekit-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.yeekit-metric-card.yeekit-metric-primary {
    border-left-color: #2271b1;
}

.yeekit-metric-card.yeekit-metric-success {
    border-left-color: #00a32a;
}

.yeekit-metric-card.yeekit-metric-info {
    border-left-color: #00a0d2;
}

.yeekit-metric-card.yeekit-metric-warning {
    border-left-color: #f0b849;
}

.yeekit-metric-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}

.yeekit-metric-content {
    flex: 1;
}

.yeekit-metric-label {
    font-size: 13px;
    color: #646970;
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.yeekit-metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.2;
}

/* Charts Layout */
.yeekit-charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45%, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.yeekit-chart-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.yeekit-chart-container h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 2px solid #f0f0f1;
    padding-bottom: 12px;
}

.yeekit-chart-container canvas {
    max-height: 300px;
    width: 100% !important;
}

.yeekit-chart-small {
    grid-column: span 1;
}

.yeekit-chart-large {
    grid-column: span 1;
}

/* Top Rules Table */
.yeekit-top-rules-table {
    overflow-x: auto;
}

.yeekit-top-rules-table table {
    width: 100%;
    border-collapse: collapse;
}

.yeekit-top-rules-table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    background: #f6f7f7;
    border-bottom: 2px solid #c3c4c7;
}

.yeekit-top-rules-table td {
    padding: 12px;
    font-size: 13px;
    color: #1d2327;
    border-bottom: 1px solid #e0e0e0;
}

.yeekit-top-rules-table code {
    background: #f6f7f7;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #d63638;
}

.yeekit-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .yeekit-charts-row {
        grid-template-columns: 1fr;
    }

    .yeekit-chart-small,
    .yeekit-chart-large {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .yeekit-metrics-grid {
        grid-template-columns: 1fr;
    }

    .yeekit-filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .yeekit-filter-group input[type="date"],
    .yeekit-filter-group select {
        width: 100%;
        min-width: unset;
    }

    .yeekit-metric-value {
        font-size: 24px;
    }
}

/* ============================================
   LOADING ANIMATIONS & SKELETONS
   ============================================ */

/* Loading skeleton animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.yeekit-loading-skeleton {
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Loading state for reports */
.yeekit-reports.loading {
    pointer-events: none;
    opacity: 0.7;
}

.yeekit-reports.loading .yeekit-chart-container canvas {
    opacity: 0.3;
}

/* Button loading state */
.yeekit-filter-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spinner for button */
.yeekit-filter-btn.loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

/* Chart container loading state */
.yeekit-chart-container.loading {
    position: relative;
    min-height: 300px;
}

.yee kit-chart-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   REPORTS PAGE - HIDE FOOTER
   ============================================ */

/* Hide WordPress footer on reports page */
body.woocommerce_page_wc-settings .yeekit-reports~#wpfooter {
    display: none !important;
}

/* Alternative: Hide footer when reports section is active */
.woocommerce_page_wc-settings-yeekit_dynamic_discounts #wpfooter {
    display: none !important;
}