/**
 * Admin styles for ACO Subscriptions.
 *
 * Follows BEM naming convention with `acosuanr-` prefix.
 *
 * @package aco-subscription-and-recurring-payments-for-woocommerce
 * @since   1.0.0
 */

/* ==========================================================================
   Variables
   ========================================================================== */

$prefix: 'acosuanr';
$color-primary: #7c3aed;
$color-primary-dark: #6d28d9;
$color-primary-light: #ede9fe;
$color-success: #059669;
$color-danger: #dc2626;
$color-gray-50: #f9fafb;
$color-gray-100: #f3f4f6;
$color-gray-200: #e5e7eb;
$color-gray-300: #d1d5db;
$color-gray-400: #9ca3af;
$color-gray-500: #6b7280;
$color-gray-600: #4b5563;
$color-gray-700: #374151;
$color-gray-800: #1f2937;
$color-gray-900: #111827;
$color-white: #ffffff;
$border-radius: 8px;
$transition: all 0.2s ease-in-out;

/* ==========================================================================
   Wrap
   ========================================================================== */

.#{$prefix}-wrap {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ==========================================================================
   Header
   ========================================================================== */

.#{$prefix}-header {
    background: $color-white;
    border: 1px solid $color-gray-200;
    border-radius: $border-radius;
    margin-bottom: 24px;
    overflow: hidden;

    &__top {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 20px 24px 0;
    }

    &__title {
        font-size: 22px;
        font-weight: 600;
        color: $color-gray-900;
        margin: 0;
        line-height: 1.3;
    }

    &__version {
        display: inline-block;
        background: $color-primary-light;
        color: $color-primary;
        font-size: 11px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 10px;
        line-height: 1.5;
    }

    &__nav {
        display: flex;
        gap: 0;
        padding: 0 24px;
        margin-top: 16px;
        border-top: 1px solid $color-gray-100;
    }

    &__tab {
        display: inline-flex;
        align-items: center;
        padding: 12px 20px;
        font-size: 13px;
        font-weight: 500;
        color: $color-gray-500;
        text-decoration: none;
        border-bottom: 2px solid transparent;
        transition: $transition;
        margin-bottom: -1px;

        &:focus {
            outline: none;
            box-shadow: none;
        }

        &:focus-visible {
            outline: 2px solid $color-primary;
            outline-offset: -2px;
            border-radius: 4px;
        }

        &:hover {
            color: $color-gray-700;
            text-decoration: none;
        }

        &.is-active,
        &.active {
            color: $color-primary;
            border-bottom-color: $color-primary;
            font-weight: 600;
        }
    }
}

/* ==========================================================================
   Content
   ========================================================================== */

.#{$prefix}-content {
    min-height: 400px;
}

.#{$prefix}-page {
    background: $color-white;
    border: 1px solid $color-gray-200;
    border-radius: $border-radius;
    padding: 24px;
}

/* ==========================================================================
   Welcome Section
   ========================================================================== */

.#{$prefix}-welcome {
    text-align: center;
    padding: 40px 20px;
    border-bottom: 1px solid $color-gray-200;
    margin-bottom: 24px;

    &__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 64px;
        height: 64px;
        background: $color-primary-light;
        border-radius: 50%;
        margin-bottom: 16px;

        .dashicons {
            font-size: 32px;
            width: 32px;
            height: 32px;
            color: $color-primary;
        }
    }

    &__title {
        font-size: 20px;
        font-weight: 600;
        color: $color-gray-900;
        margin: 0 0 8px;
    }

    &__description {
        font-size: 14px;
        color: $color-gray-500;
        margin: 0;
    }
}

/* ==========================================================================
   Table
   ========================================================================== */

.#{$prefix}-table-wrap {
    overflow-x: auto;
}

.#{$prefix}-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;

    thead th {
        background: $color-gray-50;
        padding: 12px 16px;
        text-align: left;
        font-weight: 600;
        color: $color-gray-600;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        border-bottom: 1px solid $color-gray-200;

        &:first-child {
            border-radius: $border-radius 0 0 0;
        }

        &:last-child {
            border-radius: 0 $border-radius 0 0;
        }
    }

    tbody td {
        padding: 16px;
        border-bottom: 1px solid $color-gray-100;
        color: $color-gray-700;
    }

    &__empty {
        text-align: center;
        padding: 48px 16px !important;
    }
}

.#{$prefix}-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: $color-gray-400;

    .dashicons {
        font-size: 40px;
        width: 40px;
        height: 40px;
        opacity: 0.5;
    }

    p {
        margin: 0;
        font-size: 14px;
    }
}

/* ==========================================================================
   Settings
   ========================================================================== */

.#{$prefix}-settings {
    &__nav {
        display: flex;
        gap: 0;
        border-bottom: 1px solid $color-gray-200;
        margin: -24px -24px 24px;
        padding: 0 24px;
    }

    &__tab {
        display: inline-flex;
        align-items: center;
        padding: 12px 16px;
        font-size: 13px;
        font-weight: 500;
        color: $color-gray-500;
        text-decoration: none;
        border-bottom: 2px solid transparent;
        transition: $transition;
        margin-bottom: -1px;

        &:focus {
            outline: none;
            box-shadow: none;
        }

        &:focus-visible {
            outline: 2px solid $color-primary;
            outline-offset: -2px;
            border-radius: 4px;
        }

        &:hover {
            color: $color-gray-700;
            text-decoration: none;
        }

        &.is-active,
        &.active {
            color: $color-primary;
            border-bottom-color: $color-primary;
            font-weight: 600;
        }
    }

    &__content {
        padding: 0;
    }
}

/* ==========================================================================
   Settings Form
   ========================================================================== */

.#{$prefix}-settings-form {
    &__title {
        font-size: 16px;
        font-weight: 600;
        color: $color-gray-900;
        margin: 0 0 20px;
        padding-bottom: 12px;
        border-bottom: 1px solid $color-gray-100;
    }

    .form-table {
        margin-top: 0;

        th {
            padding: 16px 12px 16px 0;
            font-weight: 500;
            color: $color-gray-700;
            font-size: 13px;
            width: 200px;
            vertical-align: top;
        }

        td {
            padding: 12px 0;

            .description {
                font-size: 12px;
                color: $color-gray-400;
                margin-top: 6px;
                font-style: normal;
            }
        }
    }

    &__actions {
        margin-top: 24px;
        padding-top: 20px;
        border-top: 1px solid $color-gray-100;

        .button-primary {
            background: $color-primary;
            border-color: $color-primary;
            color: $color-white;
            padding: 6px 24px;
            height: auto;
            line-height: 1.6;
            font-size: 13px;
            font-weight: 500;
            border-radius: 6px;
            transition: $transition;

            &:hover,
            &:focus {
                background: $color-primary-dark;
                border-color: $color-primary-dark;
                color: $color-white;
            }

            &:disabled {
                opacity: 0.5;
                cursor: not-allowed;
            }
        }
    }
}

/* ==========================================================================
   Toggle Switch
   ========================================================================== */

.#{$prefix}-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;

    input {
        opacity: 0;
        width: 0;
        height: 0;

        &:checked+.#{$prefix}-toggle__slider {
            background-color: $color-primary;

            &::before {
                transform: translateX(20px);
            }
        }

        &:focus+.#{$prefix}-toggle__slider {
            box-shadow: 0 0 0 2px $color-primary-light;
        }
    }

    &__slider {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: $color-gray-300;
        border-radius: 24px;
        transition: $transition;

        &::before {
            content: '';
            position: absolute;
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background-color: $color-white;
            border-radius: 50%;
            transition: $transition;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
    }
}

/* ==========================================================================
   Payment Gateway Card
   ========================================================================== */

.#{$prefix}-payment-gateway {
    border: 1px solid $color-gray-200;
    border-radius: $border-radius;
    overflow: hidden;
    margin-bottom: 20px;

    &__header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        padding: 20px;
        gap: 16px;
    }

    &__info {
        flex: 1;
    }

    &__name {
        font-size: 15px;
        font-weight: 600;
        color: $color-gray-900;
        margin: 0 0 4px;
    }

    &__description {
        font-size: 13px;
        color: $color-gray-500;
        margin: 0;
    }

    &__actions {
        flex-shrink: 0;
        padding-top: 2px;
    }

    &__footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        background: $color-gray-50;
        border-top: 1px solid $color-gray-200;
    }

    &__status {
        font-size: 12px;
        font-weight: 600;
        padding: 2px 10px;
        border-radius: 10px;

        &.is-enabled {
            background: #d1fae5;
            color: $color-success;
        }

        &.is-disabled {
            background: #fee2e2;
            color: $color-danger;
        }
    }
}

/* ==========================================================================
   Payment Gateways Grid & Card Layout
   ========================================================================== */

.aco-gateways-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.aco-settings-card {
    background: #fff;
    border: 1px solid $color-gray-200;
    border-radius: $border-radius;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: $transition;
    margin-bottom: 24px;

    &:hover {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    }

    &__header {
        padding: 24px;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
    }

    &__info {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex: 1;
    }

    &__title-wrap {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    &__name {
        font-size: 16px;
        font-weight: 600;
        color: $color-gray-900;
        margin: 0;
    }

    &__description {
        font-size: 13px;
        color: $color-gray-500;
        line-height: 1.5;
        margin: 0;
    }

    &__badge {
        font-size: 10px;
        font-weight: 700;
        background: $color-primary;
        color: $color-white;
        padding: 2px 6px;
        border-radius: 4px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    &__actions {
        flex-shrink: 0;
        padding-top: 2px;
    }

    &__body {
        padding: 24px;
        border-top: 1px solid $color-gray-200;
        background: #fdfdfd;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    &__footer {
        padding: 16px 24px;
        background: $color-gray-50;
        border-top: 1px solid $color-gray-200;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom-left-radius: $border-radius;
        border-bottom-right-radius: $border-radius;
    }

    &__status {
        font-size: 12px;
        font-weight: 600;
        padding: 2px 10px;
        border-radius: 12px;

        &.is-enabled {
            background: #d1fae5;
            color: $color-success;
        }

        &.is-disabled {
            background: #fee2e2;
            color: $color-danger;
        }

        &.is-locked {
            background: #f3f4f6;
            color: #6b7280;
        }
    }

    &--locked {
        background: #fafafa;
        border-style: dashed;
        opacity: 0.85;

        .aco-settings-card__name {
            color: #9ca3af;
        }

        .aco-settings-card__description {
            color: #9ca3af;
        }
    }
}

.aco-settings-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.aco-settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;

    label {
        font-weight: 600;
        font-size: 13px;
        color: $color-gray-700;
    }

    input[type="number"],
    select {
        height: 36px;
        border-radius: 4px;
        border: 1px solid $color-gray-300;
        padding: 0 12px;
        font-size: 13px;
        background: #fff;
        width: 100%;
        max-width: 100%;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
        box-sizing: border-box;

        &:focus {
            border-color: $color-primary;
            outline: none;
            box-shadow: 0 0 0 2px rgba($color-primary, 0.1);
        }
    }
}

.aco-schedule-list {
    margin-top: 16px;
    border-top: 1px dashed $color-gray-200;
    padding-top: 20px;
}

.aco-schedule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;

    &:last-child {
        margin-bottom: 0;
    }

    &__label {
        font-size: 13px;
        font-weight: 500;
        color: $color-gray-600;
        width: 90px;
        display: inline-block;
    }

    &__input {
        width: 90px !important;
        height: 32px !important;
        border-radius: 4px;
        border: 1px solid $color-gray-300;
        padding: 0 10px;
        font-size: 13px;

        &:focus {
            border-color: $color-primary;
            outline: none;
            box-shadow: 0 0 0 2px rgba($color-primary, 0.1);
        }
    }

    &__select {
        width: 110px !important;
        height: 32px !important;
        border-radius: 4px;
        border: 1px solid $color-gray-300;
        padding: 0 8px;
        font-size: 13px;

        &:focus {
            border-color: $color-primary;
            outline: none;
            box-shadow: 0 0 0 2px rgba($color-primary, 0.1);
        }
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.#{$prefix}-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    gap: 12px;

    .spinner {
        float: none;
        margin: 0;
    }

    p {
        margin: 0;
        color: $color-gray-500;
        font-size: 13px;
    }
}

/* ==========================================================================
   Dashboard, Cards, Badges, Modals, Details Layouts
   ========================================================================== */

.aco-notices-wrap {
    margin-bottom: 20px;
}

.aco-notice {
    background: #fff;
    border-left: 4px solid #00a0d2;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
    margin: 5px 0 15px;
    padding: 12px 35px 12px 12px;
    position: relative;
    border-radius: 3px;
    font-size: 13px;

    &--success {
        border-left-color: #46b450;
    }

    &--error {
        border-left-color: #dc3232;
    }

    &--warning {
        border-left-color: #ffb900;
    }

    &--info {
        border-left-color: #00a0d2;
    }

    &__dismiss {
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        border: none;
        background: transparent;
        cursor: pointer;
        padding: 0;
        color: #72777c;

        &:hover {
            color: #dc3232;
        }

        .dashicons {
            font-size: 16px;
            width: 16px;
            height: 16px;
        }
    }
}

.acosuanr-dashboard__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;

    h2 {
        font-size: 23px;
        font-weight: 400;
        margin: 0;
        color: #23282d;
    }

    .description {
        margin: 4px 0 0;
        color: #666;
    }
}

.aco-statistics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.aco-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);

    &__icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f7fafc;
        color: #718096;

        .dashicons {
            font-size: 20px;
            width: 20px;
            height: 20px;
        }
    }

    &__content {
        display: flex;
        flex-direction: column;
    }

    &__label {
        font-size: 12px;
        color: #718096;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    &__value {
        font-size: 24px;
        font-weight: 700;
        margin: 4px 0 0;
        color: #2d3748;
    }

    &--total &__icon {
        background: #ebf8ff;
        color: #3182ce;
    }

    &--active &__icon {
        background: #f0fff4;
        color: #38a169;
    }

    &--pending &__icon {
        background: #fffaf0;
        color: #dd6b20;
    }

    &--on-hold &__icon {
        background: #fff5f5;
        color: #e53e3e;
    }

    &--cancelled &__icon {
        background: #edf2f7;
        color: #4a5568;
    }

    &--expired &__icon {
        background: #faf5ff;
        color: #805ad5;
    }
}

.aco-table-wrapper-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.aco-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    gap: 16px;
    flex-wrap: wrap;
}

.aco-bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;

    &__select {
        height: 30px;
        font-size: 13px;
    }

    &__selected-count {
        font-size: 13px;
        color: #718096;
    }
}

.aco-table-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;

    &__search-wrap {
        position: relative;
        display: flex;
        align-items: center;

        .aco-search-icon {
            position: absolute;
            left: 8px;
            color: #a0aec0;
            font-size: 16px;
            width: 16px;
            height: 16px;
        }
    }

    &__search {
        padding-left: 32px !important;
        height: 30px;
        font-size: 13px;
        border-radius: 4px;
        border: 1px solid #cbd5e0;
        width: 200px;
    }

    &__dropdowns {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    &__select {
        height: 30px;
        font-size: 13px;
        border-radius: 4px;
    }
}

.acosuanr-table-container {
    overflow-x: auto;
}

.acosuanr-table {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;

    th,
    td {
        vertical-align: middle !important;
    }

    th {
        font-weight: 600 !important;
        background: #f8fafc !important;
        color: #4a5568 !important;
    }

    tr.is-selected {
        background-color: #f7fafc;
    }

    .column-actions {
        text-align: right;
    }

    .aco-row-actions {
        text-align: right;
        font-size: 12px;
        color: #a0aec0;

        a,
        button.button-link {
            color: #3182ce;
            text-decoration: none;
            cursor: pointer;
            font-size: 12px;

            &:hover {
                color: #2b6cb0;
            }
        }

        button.aco-action-delete {
            color: #e53e3e;

            &:hover {
                color: #c53030;
            }
        }
    }

    .aco-products-cell {
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .aco-sort-indicator {
        font-size: 14px;
        width: 14px;
        height: 14px;
        margin-left: 4px;
        color: #cbd5e0;

        &--active {
            color: #4a5568;
        }
    }
}

.aco-status-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
    background: #edf2f7;
    color: #4a5568;

    &--active {
        background-color: #c6f6d5;
        color: #22543d;
    }

    &--pending {
        background-color: #feebc8;
        color: #744210;
    }

    &--on-hold {
        background-color: #e2e8f0;
        color: #2d3748;
    }

    &--paused {
        background-color: #ebf8ff;
        color: #2b6cb0;
    }

    &--cancelled {
        background-color: #fed7d7;
        color: #742a2a;
    }

    &--pending-cancel {
        background-color: #fee2e2;
        color: #9b1c1c;
    }

    &--expired {
        background-color: #edf2f7;
        color: #4a5568;
    }

    &--switched {
        background-color: #e9d8fd;
        color: #553c9a;
    }
}

.aco-pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #4a5568;
}

.aco-pagination-limit {
    display: flex;
    align-items: center;
    gap: 8px;

    &__select {
        height: 28px;
        font-size: 12px;
        border-radius: 4px;
    }
}

.aco-pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;

    .aco-pagination-btn {
        padding: 2px 6px !important;
        height: 28px !important;
        min-width: 28px;

        .dashicons {
            font-size: 16px;
            width: 16px;
            height: 16px;
            margin-top: 2px;
        }
    }

    .aco-pagination-total-items {
        color: #718096;
    }
}

.aco-table-empty-row {
    padding: 64px 16px !important;
    text-align: center;
}

.aco-table-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #a0aec0;

    .aco-empty-icon {
        font-size: 48px;
        width: 48px;
        height: 48px;
    }

    p {
        font-size: 15px;
        margin: 0;
    }
}

.aco-skeleton {
    background: linear-gradient(90deg, #f7fafc 25%, #edf2f7 50%, #f7fafc 75%);
    background-size: 200% 100%;
    animation: aco-shimmer 1.5s infinite;
    border-radius: 4px;

    &--text {
        display: inline-block;
    }

    &--row {
        height: 24px;
        width: 100%;
        margin: 8px 0;
    }

    &--title {
        height: 32px;
        width: 200px;
    }
}

@keyframes aco-shimmer {
    0% {
        background-position: 200% 0;
    }

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

.aco-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.aco-modal-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 450px;
    max-width: 90%;
    overflow: hidden;
}

.aco-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;

    .aco-modal-title {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        color: #2d3748;
    }

    .aco-modal-close {
        border: none;
        background: transparent;
        cursor: pointer;
        color: #a0aec0;
        padding: 0;

        &:hover {
            color: #718096;
        }

        .dashicons {
            font-size: 18px;
            width: 18px;
            height: 18px;
        }
    }
}

.aco-modal-body {
    padding: 20px 16px;
    font-size: 14px;
    color: #4a5568;

    p {
        margin: 0 0 12px;

        &:last-child {
            margin: 0;
        }
    }

    .aco-modal-warning {
        background: #fff5f5;
        border-left: 4px solid #e53e3e;
        padding: 10px;
        color: #c53030;
        border-radius: 0 4px 4px 0;
        font-size: 13px;
    }
}

.aco-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;

    .aco-modal-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 34px !important;
        min-height: 34px !important;
        padding: 0 18px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        line-height: 1 !important;
        border-radius: 4px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        cursor: pointer !important;
        vertical-align: middle !important;
        transition: all 0.15s ease-in-out !important;

        &--cancel {
            background: #fff !important;
            border: 1px solid #2271b1 !important;
            color: #2271b1 !important;

            &:hover,
            &:focus {
                background: #f0f6fc !important;
                border-color: #135e96 !important;
                color: #135e96 !important;
            }
        }

        &--danger {
            background-color: #e53e3e !important;
            border-color: #e53e3e !important;
            color: #fff !important;

            &:hover,
            &:focus {
                background-color: #c53030 !important;
                border-color: #c53030 !important;
                color: #fff !important;
            }
        }
    }
}

.aco-back-link {
    display: inline-flex;
    align-items: center;
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 12px;
    gap: 4px;

    &:hover {
        color: #2b6cb0;
        text-decoration: none;
    }

    .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
}

.aco-subscription-view__title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;

    h2 {
        margin: 0;
        font-size: 23px;
        font-weight: 400;
    }
}

.aco-view-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;

    @media (max-width: 900px) {
        grid-template-columns: 1fr;
    }
}

.aco-view-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;

    &__title {
        font-size: 16px;
        font-weight: 600;
        margin: 0 0 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid #edf2f7;
        color: #2d3748;
    }
}

.aco-view-details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aco-details-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    border-bottom: 1px dashed #edf2f7;
    padding-bottom: 8px;

    &:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .aco-details-label {
        color: #718096;
        font-weight: 500;
    }

    .aco-details-val {
        color: #2d3748;
        font-weight: 600;

        a {
            color: #3182ce;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }
    }
}

.aco-items-table {
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px;

    th {
        background: #f8fafc !important;
    }
}

.aco-totals-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 16px;
    gap: 8px;
    font-size: 13px;
}

.aco-totals-row {
    display: flex;
    width: 250px;
    justify-content: space-between;
    color: #4a5568;

    &--grand {
        border-top: 2px solid #e2e8f0;
        padding-top: 8px;
        color: #2d3748;
        font-size: 15px;
    }
}

.aco-notes-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding-right: 8px;
}

.aco-note-item {
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;

    .aco-note-text {
        color: #2d3748;
        line-height: 1.4;
    }

    .aco-note-meta {
        display: flex;
        justify-content: space-between;
        margin-top: 6px;
        font-size: 11px;
        color: #a0aec0;
    }

    .aco-customer-note-tag {
        background: #ebf8ff;
        color: #2b6cb0;
        padding: 0 4px;
        border-radius: 2px;
        font-weight: 600;
    }

    &--customer {
        background: #f0fff4;
        border-color: #c6f6d5;
    }
}

.aco-no-notes,
.aco-no-logs {
    font-style: italic;
    color: #a0aec0;
    font-size: 13px;
    margin: 0;
}

.aco-add-note-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid #edf2f7;
    padding-top: 16px;

    textarea {
        border-radius: 4px;
        border: 1px solid #cbd5e0;
        padding: 8px;
        font-size: 13px;
    }

    .aco-note-form-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 13px;
        color: #4a5568;
    }
}

.aco-logs-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aco-log-item {
    font-family: monospace;
    font-size: 11px;
    padding: 6px;
    border-radius: 4px;
    background: #edf2f7;
    border-left: 3px solid #cbd5e0;
    color: #4a5568;

    .aco-log-date {
        color: #718096;
        margin-right: 8px;
    }

    .aco-log-level {
        margin-right: 8px;
    }

    .aco-log-msg {
        margin-top: 2px;
        white-space: pre-wrap;
    }

    &--error {
        background: #fff5f5;
        border-left-color: #e53e3e;
        color: #c53030;
    }

    &--warning {
        background: #fffaf0;
        border-left-color: #dd6b20;
        color: #dd6b20;
    }
}

.aco-subscription-edit {
    h2 {
        font-size: 23px;
        font-weight: 400;
        margin: 0 0 20px;
    }
}

.aco-edit-form {
    padding: 20px;

    .aco-form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;

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

    .aco-form-group {
        display: flex;
        flex-direction: column;
        gap: 6px;

        label {
            font-weight: 600;
            font-size: 13px;
            color: #4a5568;
        }

        input,
        select {
            height: 36px;
            border-radius: 4px;
            border: 1px solid #cbd5e0;
            padding: 0 10px;
            font-size: 13px;
        }
    }

    .aco-form-submit {
        display: flex;
        justify-content: flex-end;
        gap: 12px;
        margin-top: 32px;
        padding-top: 20px;
        border-top: 1px solid #edf2f7;

        .aco-submit-btn {
            background-color: #3182ce !important;
            border-color: #3182ce !important;
            color: #fff !important;
            height: 32px !important;

            &:hover {
                background-color: #2b6cb0 !important;
                border-color: #2b6cb0 !important;
            }
        }
    }
}

/* ==========================================================================
   Remove Click/Focus Border on Admin Buttons
   ========================================================================== */
button:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
.button:focus,
.button-primary:focus,
.button-secondary:focus,
.aco-pagination-btn:focus,
.aco-modal-btn:focus,
.aco-submit-btn:focus,
.aco-modal-close:focus {
    outline: none !important;
    box-shadow: none !important;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active,
.button:active,
.button-primary:active,
.button-secondary:active,
.aco-pagination-btn:active,
.aco-modal-btn:active,
.aco-submit-btn:active,
.aco-modal-close:active {
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Reports Styles
   ========================================================================== */
.acosuanr-reports-page {
    background: transparent;
    padding: 0;
}

.aco-reports-header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.aco-kpi-grid {
    grid-gap: 20px;
}

.aco-kpi-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;

    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    }
}

/* ==========================================================================
   Import / Export Wizard Styles
   ========================================================================== */

.acosuanr-migration-actions {
    display: flex;
    gap: 16px;
    margin: 24px 0;

    &__button {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 12px 24px;
        font-size: 14px;
        font-weight: 600;
        color: $color-gray-700;
        background: $color-white;
        border: 1px solid $color-gray-300;
        border-radius: $border-radius;
        cursor: pointer;
        transition: $transition;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

        svg {
            width: 18px;
            height: 18px;
            color: $color-gray-500;
            transition: $transition;
        }

        &:hover {
            color: $color-primary;
            background: $color-gray-50;
            border-color: $color-primary-light;
            box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);

            svg {
                color: $color-primary;
            }
        }

        &:focus {
            outline: none;
            box-shadow: none;
        }

        &:focus-visible {
            outline: 2px solid $color-primary;
            outline-offset: 2px;
        }

        &.is-active {
            color: $color-primary;
            background: $color-primary-light;
            border-color: $color-primary;
            box-shadow: 0 2px 4px rgba(124, 58, 237, 0.12);

            svg {
                color: $color-primary;
            }
        }
    }
}

.acosuanr-migration-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid $color-gray-200;

    &__step {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 14px;
        font-size: 13px;
        font-weight: 500;
        color: $color-gray-500;
        background: $color-gray-100;
        border-radius: 20px;
        transition: $transition;

        &.is-active {
            color: $color-primary;
            background: $color-primary-light;
            font-weight: 600;
        }

        &.is-complete {
            color: $color-success;
            background: rgba(5, 150, 105, 0.1);
        }
    }
}

/* ==========================================================================
   Help Tooltip Component
   ========================================================================== */

.aco-help-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 6px;
    line-height: 1;

    &__trigger {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #64748b;
        border-radius: 50%;
        outline: none !important;
        box-shadow: none !important;
        transition: color 0.15s ease-in-out;
        vertical-align: middle;

        &:hover,
        &:focus,
        &:focus-visible {
            color: #7c3aed;
            outline: none !important;
            box-shadow: none !important;
        }

        .dashicons {
            font-size: 15px;
            width: 15px;
            height: 15px;
            line-height: 15px;
        }
    }

    &__bubble {
        position: absolute;
        bottom: calc(100% + 8px);
        left: -4px;
        right: auto;
        width: max-content;
        max-width: 280px;
        min-width: 160px;
        background: #1e293b;
        color: #ffffff;
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 400;
        line-height: 1.45;
        text-align: left;
        white-space: normal;
        word-break: break-word;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.1);
        z-index: 999999;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transform: translateY(4px);
        transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;

        /* Bottom arrow (for default top placement) */
        &::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 8px;
            border-width: 5px;
            border-style: solid;
            border-color: #1e293b transparent transparent transparent;
        }
    }

    /* Bottom placement */
    &--bottom &__bubble {
        bottom: auto;
        top: calc(100% + 8px);
        transform: translateY(-4px);

        &::after {
            top: auto;
            bottom: 100%;
            border-color: transparent transparent #1e293b transparent;
        }
    }

    /* Right-aligned */
    &--align-right &__bubble {
        left: auto;
        right: -4px;

        &::after {
            left: auto;
            right: 8px;
        }
    }

    /* Hover and focus states */
    &:hover &__bubble,
    &.is-visible &__bubble,
    &__trigger:focus &__bubble,
    &__trigger:focus-visible &__bubble {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}