/* ==========================================================================
   STANDALONE APP SHELL (OVERRIDES THEME FULLY)
   ========================================================================== */

body.wp-ai-standalone-body {
    margin: 0;
    padding: 0;
    background-color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
}

.wp-ai-app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.wp-ai-app-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.wp-ai-header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}
.wp-ai-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}
.wp-ai-nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wp-ai-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
}
.wp-ai-nav-link:hover {
    color: #2563eb;
    background: #f8fafc;
}
.wp-ai-nav-link.active {
    color: #2563eb;
    background: #eff6ff;
}

/* Header Right */
.wp-ai-header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}
.wp-ai-header-wallet {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
}
.wp-ai-header-wallet .wallet-val {
    font-weight: 700;
    color: #2563eb;
    font-size: 14px;
}
.wallet-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #2563eb;
    color: #fff !important;
    border-radius: 50%;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    margin-left: 4px;
}
.wp-ai-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}
.wp-ai-avatar img {
    border-radius: 50%;
    display: block;
}
.wp-ai-username {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}
.wp-ai-logout-btn {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
}
.wp-ai-logout-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* Guest buttons */
.wp-ai-guest-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.wp-ai-btn-ghost {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    border-radius: 6px;
}
.wp-ai-btn-primary {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff !important;
    background: #2563eb;
    text-decoration: none;
    border-radius: 6px;
}
.wp-ai-btn-primary:hover {
    background: #1d4ed8;
}

/* Main Container */
.wp-ai-app-main {
    flex: 1;
    padding: 24px;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.wp-ai-app-footer {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

/* ==========================================================================
   AUTH PAGE & BOX
   ========================================================================== */
.wp-ai-auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}
.wp-ai-auth-box {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}
.wp-ai-auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.wp-ai-auth-logo {
    font-size: 24px;
    font-weight: 800;
    color: #2563eb;
    margin-bottom: 8px;
}
.wp-ai-auth-header h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
    color: #0f172a;
}
.wp-ai-auth-header p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}
.wp-ai-auth-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}
.wp-ai-auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.wp-ai-auth-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.wp-ai-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.wp-ai-auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wp-ai-auth-field label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}
.wp-ai-auth-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}
.wp-ai-auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.wp-ai-auth-submit-btn:hover {
    background: #1d4ed8;
}
.wp-ai-auth-msg {
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
}
.wp-ai-auth-msg.error {
    background: #fee2e2;
    color: #991b1b;
}
.wp-ai-auth-msg.success {
    background: #dcfce7;
    color: #166534;
}

/* ==========================================================================
   PRICING & PACKAGES GRID
   ========================================================================== */
.wp-ai-pricing-page {
    margin: 20px 0;
}
.wp-ai-pricing-header {
    text-align: center;
    margin-bottom: 36px;
}
.wp-ai-badge-gold {
    display: inline-block;
    background: #fef3c7;
    color: #b45309;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}
.wp-ai-pricing-header h2 {
    font-size: 28px;
    margin: 0 0 10px 0;
    color: #0f172a;
}
.wp-ai-pricing-header p {
    font-size: 15px;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
}
.wp-ai-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.wp-ai-pricing-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.wp-ai-pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.06);
}
.wp-ai-pricing-card.featured {
    border: 2px solid #2563eb;
    background: #fcfdfe;
}
.wp-ai-card-ribbon {
    position: absolute;
    top: -12px;
    right: 24px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}
.wp-ai-pricing-card__title h3 {
    margin: 0 0 6px 0;
    font-size: 20px;
    color: #0f172a;
}
.wp-ai-pricing-card__desc {
    font-size: 13px;
    color: #64748b;
    min-height: 38px;
}
.wp-ai-pricing-card__price {
    margin: 16px 0;
}
.wp-ai-pricing-card__price .price-val {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
}
.credit-highlight {
    background: #eff6ff;
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.credit-number {
    font-size: 24px;
    font-weight: 800;
    color: #2563eb;
}
.credit-unit {
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}
.credit-sub-note {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}
.wp-ai-pricing-features {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.wp-ai-pricing-features li {
    font-size: 13px;
    color: #334155;
}
.wp-ai-buy-btn {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
}
.wp-ai-buy-btn.primary {
    background: #2563eb;
    color: #fff !important;
}
.wp-ai-buy-btn.primary:hover {
    background: #1d4ed8;
}
.wp-ai-buy-btn.secondary {
    background: #f1f5f9;
    color: #0f172a !important;
    border: 1px solid #cbd5e1;
}
.wp-ai-buy-btn.secondary:hover {
    background: #e2e8f0;
}

/* ==========================================================================
   USER CREDIT HISTORY TABLE
   ========================================================================== */
.wp-ai-history-page {
    margin: 10px 0 30px 0;
}
.wp-ai-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.wp-ai-history-header h2 {
    margin: 0 0 6px 0;
    font-size: 24px;
    color: #0f172a;
}
.wp-ai-history-header p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}
.wp-ai-history-balance-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.wp-ai-history-balance-card .label {
    font-size: 12px;
    color: #64748b;
}
.wp-ai-history-balance-card .val {
    font-size: 20px;
    font-weight: 800;
    color: #2563eb;
}
.wp-ai-history-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.03);
}
.wp-ai-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}
.wp-ai-table-responsive {
    width: 100%;
    overflow-x: auto;
}
.wp-ai-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.wp-ai-history-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 2px solid #e2e8f0;
}
.wp-ai-history-table td {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.wp-ai-history-table tr:hover td {
    background: #fcfdfe;
}
.tx-date {
    font-size: 13px;
    color: #64748b;
}
.wp-ai-tx-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.wp-ai-tx-badge.plus {
    background: #dcfce7;
    color: #15803d;
}
.wp-ai-tx-badge.minus {
    background: #fee2e2;
    color: #b91c1c;
}
.wp-ai-tx-badge.neutral {
    background: #f1f5f9;
    color: #475569;
}
.wp-ai-amount {
    font-weight: 700;
    font-size: 15px;
}
.wp-ai-amount.plus {
    color: #16a34a;
}
.wp-ai-amount.minus {
    color: #dc2626;
}
.tx-desc {
    font-size: 13px;
    line-height: 1.4;
}
/* Modern Pagination Styling */
.wp-ai-history-pagination-wrapper {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 18px 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wp-ai-history-pagination-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wp-ai-history-pagination-info .info-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.wp-ai-history-pagination-info .info-text {
    font-size: 13px;
    color: #64748b;
}

.wp-ai-history-pagination-info .info-text strong {
    color: #1e293b;
    font-weight: 600;
}

.wp-ai-history-pagination-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Per-page selector */
.wp-ai-per-page-select {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.wp-ai-per-page-select .select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.wp-ai-per-page-select select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 6px 32px 6px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.wp-ai-per-page-select select:hover {
    border-color: #94a3b8;
    background-color: #f8fafc;
}

.wp-ai-per-page-select select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.wp-ai-per-page-select .select-icon {
    position: absolute;
    right: 8px;
    pointer-events: none;
    width: 16px;
    height: 16px;
    color: #64748b;
}

/* Pagination buttons container */
.wp-ai-history-pagination {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.wp-ai-history-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.wp-ai-history-pagination .page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.wp-ai-history-pagination .page-num:hover:not(.active) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
}

.wp-ai-history-pagination .page-num.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    cursor: default;
}

/* Prev / Next buttons */
.wp-ai-history-pagination .page-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.wp-ai-history-pagination .page-nav svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.wp-ai-history-pagination a.page-nav:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #2563eb;
    transform: translateY(-1px);
}

.wp-ai-history-pagination a.page-nav.prev:hover svg {
    transform: translateX(-2px);
}

.wp-ai-history-pagination a.page-nav.next:hover svg {
    transform: translateX(2px);
}

.wp-ai-history-pagination .page-nav.disabled {
    background: #f8fafc;
    border-color: #edf2f7;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.wp-ai-history-pagination .dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 36px;
    color: #94a3b8;
    font-size: 14px;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .wp-ai-history-pagination-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }
    .wp-ai-history-pagination-info {
        justify-content: space-between;
    }
    .wp-ai-history-pagination-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .wp-ai-per-page-select {
        justify-content: space-between;
    }
    .wp-ai-history-pagination {
        justify-content: center;
    }
}



/* ==========================================================================
   ORIGINAL STUDIO COMPONENT
   ========================================================================== */

.wp-ai-studio-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    color: #1e293b;
}


/* Topbar */
.wp-ai-studio-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.wp-ai-studio-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}
.wp-ai-user-wallet {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    padding: 6px 14px;
    border-radius: 9999px;
    border: 1px solid #cbd5e1;
}
.wp-ai-wallet-label {
    font-size: 13px;
    color: #64748b;
}
.wp-ai-wallet-badge {
    font-size: 15px;
    font-weight: 700;
    color: #2563eb;
}
.wp-ai-wallet-unit {
    font-size: 13px;
    color: #64748b;
}

/* Workspace Grid */
.wp-ai-studio-workspace {
    display: grid;
    grid-template-columns: 420px 1fr;
    min-height: 600px;
}
@media (max-width: 900px) {
    .wp-ai-studio-workspace {
        grid-template-columns: 1fr;
    }
}

/* Left Controls */
.wp-ai-studio-controls {
    padding: 24px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.wp-ai-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wp-ai-control-label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}
.wp-ai-service-selector-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.wp-ai-service-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8fafc;
}
.wp-ai-service-card:hover {
    border-color: #93c5fd;
    background: #ffffff;
}
.wp-ai-service-card.active {
    border-color: #2563eb;
    background: #eff6ff;
}
.wp-ai-service-card__thumb {
    width: 100%;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
}
.wp-ai-service-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.wp-ai-service-card__title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}
.wp-ai-service-card__cost {
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
}

/* Dynamic form box */
.wp-ai-params-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.wp-ai-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wp-ai-field label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}
.wp-ai-field input[type="text"],
.wp-ai-field textarea,
.wp-ai-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
}
.wp-ai-field textarea {
    min-height: 80px;
    resize: vertical;
}

/* Image input container tabs & panes */
.wp-ai-image-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wp-ai-image-tabs {
    display: flex;
    gap: 6px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
}

.wp-ai-image-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wp-ai-image-tab:hover:not(.active) {
    color: #0f172a;
}

.wp-ai-image-tab.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* URL Input Tab */
.wp-ai-url-input-group {
    display: flex;
    gap: 6px;
}

.wp-ai-input-url {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s ease;
}

.wp-ai-input-url:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.wp-ai-btn-apply-url {
    padding: 8px 14px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.wp-ai-btn-apply-url:hover {
    background: #1d4ed8;
}

.wp-ai-url-note {
    font-size: 11px;
    color: #64748b;
    margin-top: 5px;
}

/* Upload zone */
.wp-ai-upload-dropzone {
    display: block;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}
.wp-ai-upload-dropzone:hover,
.wp-ai-upload-dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: scale(1.01);
}
.wp-ai-upload-dropzone.dragover {
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.wp-ai-upload-dropzone input[type="file"] {
    display: none !important;
}
.wp-ai-upload-dropzone .wp-ai-dropzone-inner {
    pointer-events: none;
}

/* Preview wrapper with remove button */
.wp-ai-image-preview-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin-top: 8px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.wp-ai-upload-dropzone__preview {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    display: block;
    object-fit: contain;
}

.wp-ai-remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, background 0.15s ease;
}

.wp-ai-remove-image-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}


/* Generate button */
.wp-ai-generate-btn {
    width: 100%;
    padding: 14px 20px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease;
}
.wp-ai-generate-btn:hover:not(:disabled) {
    background: #1d4ed8;
}
.wp-ai-generate-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}
.wp-ai-btn-cost {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
}

/* Messages */
.wp-ai-message-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}
.wp-ai-message-alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.wp-ai-message-alert.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Right Preview Area */
.wp-ai-studio-preview {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #fafafa;
    position: relative;
}
.wp-ai-preview-placeholder {
    text-align: center;
    max-width: 380px;
    color: #64748b;
}
.wp-ai-placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.wp-ai-preview-placeholder h3 {
    margin: 0 0 8px 0;
    color: #0f172a;
    font-size: 18px;
}

/* Loading status */
.wp-ai-preview-loading {
    text-align: center;
    max-width: 400px;
    width: 100%;
}
.wp-ai-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    margin: 0 auto 16px auto;
    animation: wpAiSpin 1s linear infinite;
}
@keyframes wpAiSpin {
    to { transform: rotate(360deg); }
}
.wp-ai-progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 14px;
}
.wp-ai-progress-bar {
    width: 30%;
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
    transition: width 0.4s ease;
    animation: wpAiPulse 1.5s ease-in-out infinite;
}
@keyframes wpAiPulse {
    0% { width: 10%; }
    50% { width: 75%; }
    100% { width: 90%; }
}

/* Result display */
.wp-ai-preview-result {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.wp-ai-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.wp-ai-action-btn {
    background: #10b981;
    color: #ffffff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}
.wp-ai-action-btn:hover {
    background: #059669;
}

/* Compare Before/After slider */
.wp-ai-compare-slider {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.wp-ai-compare-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.wp-ai-compare-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}
.wp-ai-compare-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    border-right: 2px solid #ffffff;
}
.wp-ai-compare-overlay .wp-ai-before {
    width: 600px; /* same as container width */
    max-width: none;
}
.wp-ai-slider-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
}
.wp-ai-compare-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.wp-ai-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    width: 100%;
    margin-top: 12px;
}

.wp-ai-result-card {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.wp-ai-result-card:hover {
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wp-ai-result-card.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.wp-ai-result-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}

.wp-ai-result-card-actions {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.wp-ai-btn-select-compare {
    flex: 1;
    padding: 6px 8px;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wp-ai-btn-select-compare:hover {
    background: #2563eb;
    color: #ffffff;
}

.wp-ai-btn-dl-item {
    padding: 6px 10px;
    background: #10b981;
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.wp-ai-btn-dl-item:hover {
    background: #059669;
}

/* Notice box for non-logged-in visitors */
.wp-ai-studio-login-notice {
    max-width: 600px;
    margin: 40px auto;
    padding: 30px 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    font-size: 15px;
    color: #334155;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wp-ai-studio-login-notice a {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    background: #2563eb;
    color: #ffffff !important;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}
.wp-ai-studio-login-notice a:hover {
    background: #1d4ed8;
}

/* ==========================================================================
   BATCH IMAGE PROCESSING UI
   ========================================================================== */
.wp-ai-batch-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.wp-ai-textarea-batch-urls {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s ease;
}

.wp-ai-textarea-batch-urls:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wp-ai-batch-preview-wrapper {
    margin-top: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
}

.wp-ai-batch-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #cbd5e1;
}

.wp-ai-batch-count-text {
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.wp-ai-batch-count-text strong {
    color: #2563eb;
    font-size: 15px;
}

.wp-ai-batch-clear-all {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.wp-ai-batch-clear-all:hover {
    background: #fee2e2;
}

.wp-ai-batch-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.wp-ai-batch-thumb-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wp-ai-batch-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wp-ai-batch-thumb-idx {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

.wp-ai-batch-thumb-del {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: transform 0.15s, background 0.15s;
}

.wp-ai-batch-thumb-del:hover {
    background: #dc2626;
    transform: scale(1.15);
}

