/**
 * TalkGenAI Admin Styles
 * WordPress admin interface styling - Modern UI
 */

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    /* Color Palette */
    --tgai-primary: #667eea;
    --tgai-primary-dark: #5a6fd6;
    --tgai-secondary: #764ba2;
    --tgai-accent: #f093fb;
    --tgai-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --tgai-gradient-hover: linear-gradient(135deg, #5a6fd6 0%, #6a3f96 100%);
    --tgai-gradient-green: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --tgai-gradient-green-hover: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);

    /* Neutrals */
    --tgai-neutral-50: #fafbff;
    --tgai-neutral-100: #f1f3f9;
    --tgai-neutral-200: #e4e8f1;
    --tgai-neutral-300: #d1d5e4;
    --tgai-neutral-400: #9ca3bf;
    --tgai-neutral-500: #6b7280;
    --tgai-neutral-600: #4b5563;
    --tgai-neutral-700: #374151;
    --tgai-neutral-800: #1f2937;
    --tgai-neutral-900: #111827;

    /* Status Colors */
    --tgai-success: #28a745;
    --tgai-error: #dc3545;
    --tgai-warning: #f59e0b;
    --tgai-info: #17a2b8;

    /* Spacing */
    --tgai-space-1: 4px;
    --tgai-space-2: 8px;
    --tgai-space-3: 12px;
    --tgai-space-4: 16px;
    --tgai-space-5: 20px;
    --tgai-space-6: 24px;
    --tgai-space-8: 32px;
    --tgai-space-10: 40px;
    --tgai-space-12: 48px;

    /* Border Radius */
    --tgai-radius-sm: 6px;
    --tgai-radius-md: 10px;
    --tgai-radius-lg: 14px;
    --tgai-radius-xl: 20px;
    --tgai-radius-full: 9999px;

    /* Box Shadows */
    --tgai-shadow-sm: 0 1px 3px rgba(102, 126, 234, 0.08);
    --tgai-shadow-md: 0 4px 12px rgba(102, 126, 234, 0.12);
    --tgai-shadow-lg: 0 8px 24px rgba(102, 126, 234, 0.16);
    --tgai-shadow-xl: 0 12px 36px rgba(102, 126, 234, 0.2);
    --tgai-shadow-glow: 0 0 20px rgba(102, 126, 234, 0.25);

    /* Typography */
    --tgai-font-xs: 11px;
    --tgai-font-sm: 13px;
    --tgai-font-base: 14px;
    --tgai-font-md: 15px;
    --tgai-font-lg: 18px;
    --tgai-font-xl: 22px;
    --tgai-font-2xl: 28px;
    --tgai-font-3xl: 36px;

    /* Transitions */
    --tgai-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --tgai-transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --tgai-transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Glassmorphism */
    --tgai-glass-bg: rgba(255, 255, 255, 0.85);
    --tgai-glass-border: rgba(255, 255, 255, 0.6);
    --tgai-glass-blur: blur(12px);
}

/* ==========================================================================
   Success Notice for API Key Saved
   ========================================================================== */
.notice.notice-success.talkgenai-notice {
    border-left-color: var(--tgai-success);
    background: #ecf7ed;
    padding: 15px 20px;
}

.notice.notice-success.talkgenai-notice p {
    font-size: var(--tgai-font-md);
    line-height: 1.6;
    margin: 0;
}

.notice.notice-success.talkgenai-notice .button-primary {
    vertical-align: middle;
    margin-left: 10px;
    background: var(--tgai-success);
    border-color: var(--tgai-success);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    transition: all var(--tgai-transition-base);
    border-radius: var(--tgai-radius-sm);
}

.notice.notice-success.talkgenai-notice .button-primary:hover {
    background: #3ca143;
    border-color: #3ca143;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

/* ==========================================================================
   Premium Feature Upgrade Prompt
   ========================================================================== */
.talkgenai-premium-prompt {
    background: var(--tgai-gradient);
    color: #fff;
    padding: 30px;
    border-radius: var(--tgai-radius-lg);
    margin: 20px 0;
    text-align: center;
    box-shadow: var(--tgai-shadow-lg);
}

.talkgenai-premium-prompt .premium-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.talkgenai-premium-prompt h3 {
    font-size: 24px;
    margin: 0 0 10px 0;
    color: #fff;
    font-weight: 600;
}

.talkgenai-premium-prompt p {
    font-size: 16px;
    margin: 10px 0;
    opacity: 0.95;
}

.talkgenai-premium-prompt .premium-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.talkgenai-premium-prompt .feature-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: var(--tgai-radius-sm);
    font-size: 14px;
    font-weight: 500;
}

.talkgenai-premium-prompt .premium-pricing {
    background: rgba(255, 255, 255, 0.25);
    padding: 15px;
    border-radius: var(--tgai-radius-sm);
    margin: 20px auto;
    max-width: 400px;
}

.talkgenai-premium-prompt .premium-pricing strong {
    font-size: 20px;
    display: block;
    margin-bottom: 5px;
}

.talkgenai-premium-prompt .premium-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.talkgenai-premium-prompt .premium-actions .button {
    padding: 12px 24px !important;
    height: auto !important;
    font-size: 16px !important;
}

.talkgenai-premium-prompt .premium-actions .button-primary {
    background: #fff !important;
    color: var(--tgai-primary) !important;
    border: none !important;
    font-weight: 600 !important;
}

.talkgenai-premium-prompt .premium-actions .button-primary:hover {
    background: #f0f0f0 !important;
    color: var(--tgai-primary-dark) !important;
}

.talkgenai-premium-prompt .premium-actions .button-secondary {
    background: transparent !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

.talkgenai-premium-prompt .premium-actions .button-secondary:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

@media (max-width: 768px) {
    .talkgenai-premium-prompt .premium-features {
        grid-template-columns: 1fr;
    }

    .talkgenai-premium-prompt .premium-actions {
        flex-direction: column;
    }

    .talkgenai-premium-prompt .premium-actions .button {
        width: 100%;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes tgai-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes tgai-slide-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tgai-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes tgai-gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes tgai-pulse {
    0% { box-shadow: 0 0 0 0 rgba(32, 201, 151, 0.6); transform: translateZ(0); }
    70% { box-shadow: 0 0 0 12px rgba(32, 201, 151, 0); }
    100% { box-shadow: 0 0 0 0 rgba(32, 201, 151, 0); }
}

@keyframes tgai-progress-pulse {
    0%, 100% {
        box-shadow: var(--tgai-shadow-lg);
        transform: scale(1);
    }
    50% {
        box-shadow: var(--tgai-shadow-xl);
        transform: scale(1.01);
    }
}

@keyframes tgai-message-fade {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes tgai-bounce-dot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes tgai-notification-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes tgai-rainbow-border {
    0% { border-color: var(--tgai-primary); }
    25% { border-color: var(--tgai-secondary); }
    50% { border-color: var(--tgai-accent); }
    75% { border-color: #20c997; }
    100% { border-color: var(--tgai-primary); }
}

@keyframes tgai-pulse-border {
    0% {
        border-color: rgba(102, 126, 234, 0.3);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        border-color: rgba(102, 126, 234, 0.8);
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0.1);
    }
    100% {
        border-color: rgba(102, 126, 234, 0.3);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.dashicons.spin {
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   Header Bar - Sticky Glassmorphism
   ========================================================================== */
.talkgenai-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -10px -20px 20px -20px;
    padding: var(--tgai-space-4) var(--tgai-space-5);
    background: var(--tgai-glass-bg);
    backdrop-filter: var(--tgai-glass-blur);
    -webkit-backdrop-filter: var(--tgai-glass-blur);
    border-bottom: 1px solid var(--tgai-neutral-200);
    position: sticky;
    top: 32px; /* WordPress admin bar height */
    z-index: 100;
    transition: box-shadow var(--tgai-transition-base);
}

.talkgenai-header-bar.scrolled {
    box-shadow: var(--tgai-shadow-md);
}

.talkgenai-header-bar h1 {
    margin: 0;
    font-size: var(--tgai-font-xl);
    font-weight: 700;
    background: var(--tgai-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.talkgenai-header-actions {
    display: flex;
    align-items: center;
    gap: var(--tgai-space-4);
}

.talkgenai-all-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--tgai-space-2);
    direction: ltr;
}

/* Ensure correct button order */
.talkgenai-all-buttons a:first-child { order: 1; }
.talkgenai-all-buttons a:nth-child(2) { order: 2; }
.talkgenai-all-buttons button { order: 3; }

.talkgenai-all-buttons .button {
    font-size: var(--tgai-font-sm);
    padding: var(--tgai-space-2) var(--tgai-space-4);
    height: 34px;
    line-height: 1.4;
    background: var(--tgai-neutral-50);
    color: var(--tgai-neutral-700);
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-full);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--tgai-transition-base);
    box-shadow: var(--tgai-shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    gap: var(--tgai-space-1);
}

.talkgenai-all-buttons .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

.talkgenai-all-buttons .button:hover {
    background: var(--tgai-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: var(--tgai-shadow-md);
}

.talkgenai-all-buttons .button:active {
    transform: translateY(0);
    box-shadow: var(--tgai-shadow-sm);
}

.talkgenai-server-status-compact {
    display: flex;
    align-items: center;
    gap: var(--tgai-space-2);
    font-size: var(--tgai-font-sm);
    color: var(--tgai-neutral-500);
    background: var(--tgai-neutral-50);
    padding: var(--tgai-space-1) var(--tgai-space-3);
    border-radius: var(--tgai-radius-full);
    border: 1px solid var(--tgai-neutral-200);
}

.talkgenai-server-status-compact .talkgenai-server-mode {
    font-weight: 500;
}

.talkgenai-bonus-credits {
    margin-right: 10px;
    padding: var(--tgai-space-1) var(--tgai-space-2);
    background: rgba(102, 126, 234, 0.08);
    border-radius: var(--tgai-radius-sm);
    font-size: var(--tgai-font-xs);
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.talkgenai-admin-container {
    display: flex;
    gap: var(--tgai-space-5);
    margin-top: var(--tgai-space-5);
}

.talkgenai-main-content {
    flex: 1;
    max-width: calc(100% - 300px);
}

.talkgenai-sidebar {
    width: 280px;
    flex-shrink: 0;
}

/* Side-by-side layout for generation form and preview */
.talkgenai-app-workspace {
    display: flex !important;
    flex-direction: row !important;
    direction: ltr;
    gap: var(--tgai-space-5);
    width: 100%;
    align-items: flex-start;
    clear: both;
}

.talkgenai-generation-section {
    order: 1;
    width: 35% !important;
    max-width: 420px;
    flex-shrink: 0;
    flex-basis: 35%;
    box-sizing: border-box;
}

.talkgenai-preview-section {
    order: 2;
    width: 65% !important;
    flex: 1;
    flex-basis: 65%;
    min-width: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   Server Status (old - hidden)
   ========================================================================== */
.talkgenai-server-status {
    display: none;
}

.talkgenai-server-status h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.talkgenai-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--tgai-radius-full);
    font-size: var(--tgai-font-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.talkgenai-status-excellent {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.talkgenai-status-good {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.talkgenai-status-fair {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.talkgenai-status-slow {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.talkgenai-status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.talkgenai-server-mode {
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-500);
    margin-left: 10px;
}

/* ==========================================================================
   Generation Form - Modern Card
   ========================================================================== */
.talkgenai-generation-form {
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: var(--tgai-space-4);
    margin-bottom: var(--tgai-space-5);
    display: block;
    box-shadow: var(--tgai-shadow-sm);
    transition: box-shadow var(--tgai-transition-base), transform var(--tgai-transition-base);
}

.talkgenai-generation-form:hover {
    box-shadow: var(--tgai-shadow-md);
}

.talkgenai-generation-form h3 {
    margin-top: 0;
    margin-bottom: var(--tgai-space-2);
    font-size: var(--tgai-font-lg);
    font-weight: 600;
    color: var(--tgai-neutral-800);
}

.talkgenai-generation-form .tgai-form-field {
    margin-bottom: var(--tgai-space-3);
}

.talkgenai-generation-form .tgai-form-label {
    display: block;
    font-size: var(--tgai-font-base);
    font-weight: 500;
    color: var(--tgai-neutral-600);
    margin-bottom: var(--tgai-space-2);
}

.talkgenai-generation-form textarea {
    resize: vertical;
    min-height: 120px;
    width: 100%;
    border: 2px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    padding: var(--tgai-space-3) var(--tgai-space-4);
    font-size: var(--tgai-font-base);
    line-height: 1.5;
    background: var(--tgai-neutral-50);
    transition: border-color var(--tgai-transition-base), box-shadow var(--tgai-transition-base), background var(--tgai-transition-base);
    box-sizing: border-box;
}

.talkgenai-generation-form textarea:focus {
    border-color: var(--tgai-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: #fff;
    outline: none;
}

.talkgenai-generation-form .description {
    font-size: var(--tgai-font-sm);
    color: var(--tgai-neutral-400);
    margin-top: var(--tgai-space-2);
}

/* Generate button - full width gradient */
.talkgenai-generation-form .submit {
    margin-top: var(--tgai-space-4);
}

#generate-app-btn {
    width: 100%;
    padding: var(--tgai-space-3) var(--tgai-space-5);
    font-size: var(--tgai-font-md);
    font-weight: 600;
    background: var(--tgai-gradient) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--tgai-radius-md);
    box-shadow: var(--tgai-shadow-md);
    transition: all var(--tgai-transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tgai-space-2);
    cursor: pointer;
}

#generate-app-btn:hover {
    background: var(--tgai-gradient-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--tgai-shadow-lg);
}

#generate-app-btn:active {
    transform: translateY(0);
}

#generate-app-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Compact form styling for generation section */
.talkgenai-generation-section .form-table {
    margin: 0;
}

.talkgenai-generation-section .form-table th {
    display: none;
}

.talkgenai-generation-section .form-table td {
    padding: 0;
}

.talkgenai-generation-section .large-text {
    width: 100%;
}

.talkgenai-generation-section .regular-text {
    width: 100%;
}

/* ==========================================================================
   Chat Interface - Modern Messaging
   ========================================================================== */
#tgai-chat-container {
    margin: var(--tgai-space-5) 0;
    background: white;
    border-radius: var(--tgai-radius-lg);
    box-shadow: var(--tgai-shadow-md);
    overflow: hidden;
    max-width: 800px;
    border: 1px solid var(--tgai-neutral-200);
}

#tgai-chat-transcript {
    height: 400px;
    overflow-y: auto;
    padding: var(--tgai-space-5);
    background: var(--tgai-neutral-50);
    border-bottom: 1px solid var(--tgai-neutral-200);
    display: flex;
    flex-direction: column;
}

/* Custom scrollbar */
#tgai-chat-transcript::-webkit-scrollbar {
    width: 5px;
}

#tgai-chat-transcript::-webkit-scrollbar-track {
    background: transparent;
}

#tgai-chat-transcript::-webkit-scrollbar-thumb {
    background: var(--tgai-neutral-300);
    border-radius: var(--tgai-radius-full);
}

#tgai-chat-transcript::-webkit-scrollbar-thumb:hover {
    background: var(--tgai-neutral-400);
}

.tgai-chat-message {
    margin-bottom: var(--tgai-space-4);
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: tgai-slide-in 0.3s ease-out;
}

.tgai-chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.tgai-chat-message.ai,
.tgai-chat-message.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.tgai-chat-message .message-content {
    padding: var(--tgai-space-3) var(--tgai-space-4);
    border-radius: var(--tgai-radius-lg);
    font-size: var(--tgai-font-base);
    line-height: 1.5;
    word-wrap: break-word;
}

.tgai-chat-message.user .message-content {
    background: var(--tgai-gradient);
    color: white;
    border-bottom-right-radius: var(--tgai-space-1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.tgai-chat-message.ai .message-content,
.tgai-chat-message.assistant .message-content {
    background: white;
    color: var(--tgai-neutral-700);
    border: 1px solid var(--tgai-neutral-200);
    border-bottom-left-radius: var(--tgai-space-1);
}

.tgai-chat-message .message-time {
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-400);
    margin-top: var(--tgai-space-1);
    padding: 0 var(--tgai-space-1);
}

/* Typing Indicator */
.tgai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--tgai-space-3) var(--tgai-space-4);
    background: white;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    border-bottom-left-radius: var(--tgai-space-1);
    align-self: flex-start;
    animation: tgai-slide-in 0.3s ease-out;
    margin-bottom: var(--tgai-space-4);
}

.tgai-typing-indicator .dot {
    width: 7px;
    height: 7px;
    background: var(--tgai-neutral-400);
    border-radius: 50%;
    animation: tgai-bounce-dot 1.4s infinite ease-in-out both;
}

.tgai-typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.tgai-typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
.tgai-typing-indicator .dot:nth-child(3) { animation-delay: 0s; }

/* Chat Composer */
#tgai-chat-composer {
    padding: var(--tgai-space-4) var(--tgai-space-5);
    background: white;
    display: flex;
    align-items: flex-end;
    gap: var(--tgai-space-3);
}

#tgai-chat-input {
    flex: 1;
    padding: var(--tgai-space-3) var(--tgai-space-4);
    border: 2px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-xl);
    resize: none;
    min-height: 48px;
    max-height: 120px;
    font-size: var(--tgai-font-md);
    line-height: 1.4;
    outline: none;
    transition: border-color var(--tgai-transition-base), box-shadow var(--tgai-transition-base);
    background: var(--tgai-neutral-50);
}

#tgai-chat-input:focus {
    border-color: var(--tgai-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

#tgai-chat-input.tgai-initial-animation {
    animation: tgai-rainbow-border 2s linear;
    border-width: 2px;
}

#tgai-chat-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--tgai-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--tgai-transition-base);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#tgai-chat-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#tgai-chat-send:active {
    transform: scale(0.95);
}

#tgai-chat-send.processing {
    background: var(--tgai-primary);
    cursor: wait;
    animation: tgai-pulse-border 1.5s ease-in-out infinite;
}

#tgai-chat-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ==========================================================================
   Progress Indicator - Modern
   ========================================================================== */
#tgai-chat-progress {
    display: none;
    padding: var(--tgai-space-4) var(--tgai-space-5);
    background: var(--tgai-gradient);
    border: none;
    border-radius: var(--tgai-radius-lg);
    margin: var(--tgai-space-4) 0;
    color: white;
    font-size: var(--tgai-font-base);
    text-align: center;
    box-shadow: var(--tgai-shadow-lg);
    position: relative;
    overflow: hidden;
    animation: tgai-progress-pulse 3s ease-in-out infinite;
}

#tgai-progress-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: tgai-spin 0.8s ease-in-out infinite;
    margin-right: var(--tgai-space-2);
    vertical-align: middle;
}

#tgai-progress-message {
    vertical-align: middle;
    font-weight: 500;
    animation: tgai-message-fade 0.5s ease-out;
}

#tgai-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.8);
    width: 10%;
    transition: width 0.5s ease;
    border-radius: 0 2px 2px 0;
}

/* ==========================================================================
   Preview Area
   ========================================================================== */
#talkgenai-preview-area {
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: var(--tgai-space-5);
    margin-bottom: var(--tgai-space-5);
    box-shadow: var(--tgai-shadow-sm);
}

#talkgenai-preview-area h3 {
    margin-top: 0;
    margin-bottom: var(--tgai-space-4);
    font-size: var(--tgai-font-lg);
    color: var(--tgai-neutral-800);
}

#talkgenai-preview-container {
    border: 2px dashed var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    padding: var(--tgai-space-5);
    margin-bottom: var(--tgai-space-4);
    min-height: 300px;
    background: var(--tgai-neutral-50);
}

/* Preview section specific styling */
.talkgenai-preview-section .talkgenai-generation-form {
    height: auto;
}

.talkgenai-preview-section .talkgenai-generation-form h3 {
    font-size: var(--tgai-font-lg);
    color: var(--tgai-neutral-800);
}

/* Preview placeholder - modern with animated gradient */
#talkgenai-preview-placeholder {
    margin-bottom: 0;
}

#talkgenai-preview-placeholder .talkgenai-generation-form {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.tgai-placeholder-inner {
    text-align: center;
    padding: var(--tgai-space-10) var(--tgai-space-5);
    border: 2px dashed var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    background: linear-gradient(135deg, var(--tgai-neutral-50) 0%, #f5f0ff 50%, var(--tgai-neutral-50) 100%);
    background-size: 200% 200%;
    animation: tgai-gradient-shift 8s ease-in-out infinite;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tgai-placeholder-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--tgai-radius-lg);
    background: var(--tgai-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--tgai-space-5);
    box-shadow: var(--tgai-shadow-md);
}

.tgai-placeholder-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: white;
}

.tgai-placeholder-title {
    margin: 0 0 var(--tgai-space-2) 0;
    font-size: var(--tgai-font-lg);
    font-weight: 600;
    color: var(--tgai-neutral-800);
}

.tgai-placeholder-subtitle {
    margin: 0 0 var(--tgai-space-6) 0;
    font-size: var(--tgai-font-base);
    color: var(--tgai-neutral-500);
}

/* Example Cards - Modern */
.tgai-examples-container {
    text-align: left;
    background: #fff;
    padding: var(--tgai-space-6);
    border-radius: var(--tgai-radius-md);
    border: 1px solid var(--tgai-neutral-200);
    max-width: 600px;
    width: 100%;
    box-shadow: var(--tgai-shadow-sm);
}

.tgai-examples-title {
    margin: 0 0 var(--tgai-space-4) 0;
    font-size: var(--tgai-font-md);
    font-weight: 600;
    color: var(--tgai-neutral-700);
    text-align: center;
}

.tgai-examples-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--tgai-space-3);
    margin-bottom: var(--tgai-space-4);
}

.talkgenai-example-card {
    cursor: pointer;
    padding: var(--tgai-space-4) var(--tgai-space-3);
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    transition: all var(--tgai-transition-base);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.talkgenai-example-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tgai-gradient);
    opacity: 0;
    transition: opacity var(--tgai-transition-base);
    border-radius: inherit;
}

.talkgenai-example-card:hover {
    transform: translateY(-3px);
    border-color: var(--tgai-primary);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
}

.talkgenai-example-card:hover::before {
    opacity: 0.04;
}

.talkgenai-example-card:active {
    transform: translateY(-1px);
}

.talkgenai-example-card .card-icon {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    margin: 0 auto var(--tgai-space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tgai-neutral-100);
    border-radius: var(--tgai-radius-sm);
}

.talkgenai-example-card .card-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--tgai-primary);
}

.talkgenai-example-card .card-label {
    position: relative;
    z-index: 1;
    font-size: var(--tgai-font-sm);
    font-weight: 600;
    color: var(--tgai-neutral-600);
    margin-bottom: var(--tgai-space-1);
}

.talkgenai-example-card .card-text {
    position: relative;
    z-index: 1;
    font-size: var(--tgai-font-sm);
    color: var(--tgai-primary);
    font-weight: 600;
    line-height: 1.4;
}

.tgai-examples-hint {
    margin: var(--tgai-space-3) 0 0 0;
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-400);
    text-align: center;
    font-style: italic;
}

.talkgenai-preview-actions {
    text-align: center;
    padding-top: var(--tgai-space-4);
    border-top: 1px solid var(--tgai-neutral-100);
}

/* ==========================================================================
   Additional Action Buttons
   ========================================================================== */
.talkgenai-additional-actions {
    margin-top: var(--tgai-space-3);
    text-align: center;
}

#get-app-ideas-btn {
    background: transparent !important;
    color: var(--tgai-neutral-500) !important;
    border: 2px dashed var(--tgai-neutral-300) !important;
    border-radius: var(--tgai-radius-md) !important;
    font-size: var(--tgai-font-sm) !important;
    padding: var(--tgai-space-2) var(--tgai-space-4) !important;
    height: auto !important;
    transition: all var(--tgai-transition-base) !important;
    box-shadow: none !important;
    width: 100%;
}

#get-app-ideas-btn:hover {
    border-color: var(--tgai-primary) !important;
    color: var(--tgai-primary) !important;
    background: rgba(102, 126, 234, 0.04) !important;
}

/* ==========================================================================
   Article Content Styling
   ========================================================================== */
#article-content {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: var(--tgai-radius-sm);
    white-space: pre-wrap;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#article-content h2 {
    color: var(--tgai-neutral-800);
    font-size: 1.5em;
    font-weight: 600;
    margin: 1.2em 0 0.5em 0;
    padding-bottom: 0;
    border-bottom: none;
}

#article-content h3 {
    color: var(--tgai-neutral-700);
    font-size: 1.2em;
    font-weight: 500;
    margin: 1em 0 0.4em 0;
    padding-left: 0;
    border-left: none;
}

#article-content p {
    margin: 0.8em 0;
    color: var(--tgai-neutral-600);
    line-height: 1.7;
}

#article-content h2:first-child {
    margin-top: 0;
}

/* Article Result Area */
#article-result-area {
    margin-top: 30px;
}

#article-result-area h3 {
    color: var(--tgai-neutral-800);
    margin-bottom: 15px;
    font-size: 1.3em;
}

/* Tab Styling */
.talkgenai-tabs {
    display: flex;
    border-bottom: 1px solid var(--tgai-neutral-200);
    margin-bottom: 0;
    background: var(--tgai-neutral-100);
    border-radius: var(--tgai-radius-sm) var(--tgai-radius-sm) 0 0;
}

.talkgenai-tab-button {
    background: transparent;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: var(--tgai-font-base);
    font-weight: 500;
    color: var(--tgai-neutral-500);
    border-bottom: 3px solid transparent;
    transition: all var(--tgai-transition-base);
    flex: 1;
    text-align: center;
}

.talkgenai-tab-button:hover {
    background: var(--tgai-neutral-200);
    color: var(--tgai-neutral-700);
}

.talkgenai-tab-button.active {
    color: var(--tgai-primary);
    border-bottom-color: var(--tgai-primary);
    background: #fff;
}

.talkgenai-tab-content {
    border: 1px solid var(--tgai-neutral-200);
    border-top: none;
    border-radius: 0 0 var(--tgai-radius-sm) var(--tgai-radius-sm);
    background: #fff;
}

.talkgenai-tab-panel {
    display: none;
    padding: 0;
}

.talkgenai-tab-panel.active {
    display: block;
}

/* Article Content Styling */
.article-visual-content {
    background: #f9f9f9;
    padding: 20px;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 200px;
}

.article-code-content {
    background: #f8f9fa;
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    min-height: 200px;
    border: none;
    color: var(--tgai-neutral-700);
}

.article-visual-content h2 {
    color: var(--tgai-neutral-800) !important;
    font-size: 1.5em !important;
    font-weight: 600 !important;
    margin: 0.3em 0 0.1em 0 !important;
}

.article-visual-content h3 {
    color: var(--tgai-neutral-700) !important;
    font-size: 1.2em !important;
    font-weight: 500 !important;
    margin: 0.2em 0 0.05em 0 !important;
}

.article-visual-content p {
    margin: 0.1em 0 !important;
    color: var(--tgai-neutral-600) !important;
    line-height: 1.5 !important;
}

.article-visual-content h2:first-child {
    margin-top: 0;
}

/* Article Header Right Column (buttons + FAQ badge stacked) */
.talkgenai-article-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

/* Article Actions - Top Bar */
.talkgenai-article-actions-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* More Options Trigger Button */
.talkgenai-more-options-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    line-height: 1;
    padding: 4px 10px !important;
    height: auto !important;
    min-height: 30px !important;
    color: var(--tgai-neutral-600) !important;
    border-color: var(--tgai-neutral-300) !important;
    font-size: var(--tgai-font-sm) !important;
    background: #fff !important;
    transition: all var(--tgai-transition-fast);
}

.talkgenai-more-options-btn:hover {
    border-color: var(--tgai-neutral-400) !important;
    background: var(--tgai-neutral-100) !important;
}

.talkgenai-more-options-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 2px;
}

.talkgenai-more-chevron {
    font-size: 10px;
    margin-left: 2px;
    opacity: 0.6;
    transition: transform var(--tgai-transition-fast);
}

.talkgenai-more-options-btn[aria-expanded="true"] .talkgenai-more-chevron {
    transform: rotate(180deg);
}

/* More Options Dropdown */
.talkgenai-more-options-wrapper {
    position: relative;
    display: inline-flex;
}

.talkgenai-more-options-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    z-index: 999;
    min-width: 170px;
    overflow: hidden;
}

.talkgenai-more-options-dropdown.open {
    display: block;
    animation: tgai-dropdown-in 0.15s ease;
}

@keyframes tgai-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.talkgenai-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: var(--tgai-neutral-700);
    font-size: var(--tgai-font-sm);
    cursor: pointer;
    text-align: left;
    transition: background var(--tgai-transition-fast);
    border-radius: 0;
    box-shadow: none;
    outline: none;
    line-height: 1.4;
}

.talkgenai-dropdown-item:hover {
    background: var(--tgai-neutral-100);
    color: var(--tgai-neutral-900);
}

.talkgenai-dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--tgai-neutral-100);
}

.talkgenai-dropdown-item .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
    color: var(--tgai-neutral-500);
    flex-shrink: 0;
}

/* Post / Page Type Toggle */
.talkgenai-post-type-toggle {
    display: inline-flex;
    border: 1px solid var(--tgai-neutral-300);
    border-radius: var(--tgai-radius-sm);
    overflow: hidden;
}

.talkgenai-toggle-btn {
    padding: 0 11px;
    height: 30px;
    min-height: 30px;
    border: none;
    background: #fff;
    color: var(--tgai-neutral-500);
    font-size: var(--tgai-font-sm);
    font-weight: 400;
    cursor: pointer;
    transition: all var(--tgai-transition-fast);
    line-height: 1;
}

.talkgenai-toggle-btn:not(:last-child) {
    border-right: 1px solid var(--tgai-neutral-300);
}

.talkgenai-toggle-btn:hover:not(.active) {
    background: var(--tgai-neutral-100);
    color: var(--tgai-neutral-700);
}

.talkgenai-toggle-btn.active {
    background: var(--tgai-primary);
    color: #fff;
    font-weight: 500;
}

/* Create Draft Group */

.talkgenai-create-draft-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.talkgenai-create-draft-group select {
    height: 30px;
    min-height: 30px;
    padding: 2px 8px;
    font-size: var(--tgai-font-sm);
    border: 1px solid var(--tgai-neutral-300);
    border-radius: var(--tgai-radius-sm);
    background: #fff;
    color: var(--tgai-neutral-700);
    cursor: pointer;
    line-height: 1;
}

#create-draft-btn {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    padding: 4px 12px;
    height: auto;
    min-height: 30px;
    background: var(--tgai-gradient-green) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--tgai-radius-sm);
    font-size: var(--tgai-font-sm);
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.2);
    transition: all var(--tgai-transition-base);
}

#create-draft-btn:hover {
    background: var(--tgai-gradient-green-hover) !important;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
    transform: translateY(-1px);
}

#create-draft-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

#create-draft-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 3px;
    vertical-align: middle;
}

/* Edit Draft Button (appears after draft created) */

/* Shine sweeps in fast, then waits ~2.5s before repeating */
@keyframes tgai-edit-btn-shine {
    0%   { transform: translateX(-100%) skewX(-15deg); }
    20%  { transform: translateX(350%)  skewX(-15deg); }
    100% { transform: translateX(350%)  skewX(-15deg); }
}

/* Slow breathing glow — hypnotic, not frantic */
@keyframes tgai-edit-btn-glow {
    0%, 100% {
        box-shadow: 0 1px 4px rgba(34, 113, 177, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 16px rgba(34, 113, 177, 0.8), 0 0 32px rgba(34, 113, 177, 0.3);
        transform: scale(1.03);
    }
}

.talkgenai-edit-draft-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    padding: 4px 12px !important;
    height: auto !important;
    min-height: 30px !important;
    line-height: 1 !important;
    margin-left: 8px !important;
    background: #2271b1 !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--tgai-radius-sm) !important;
    font-size: var(--tgai-font-sm) !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    animation: tgai-edit-btn-glow 1.8s ease-in-out infinite;
}

.talkgenai-edit-draft-btn::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -80%;
    width: 45%;
    height: 120%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: skewX(-15deg);
    animation: tgai-edit-btn-shine 3s ease-in-out 0.4s infinite;
}

/* Pause all magic on hover — let the click state be clean */
.talkgenai-edit-draft-btn:hover {
    background: #135e96 !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(34, 113, 177, 0.5) !important;
    animation-play-state: paused;
}

.talkgenai-edit-draft-btn:hover::before {
    animation-play-state: paused;
}

.talkgenai-edit-draft-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* FAQ Schema Validated Badge */
.talkgenai-faq-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #a8d5b3;
    border-radius: var(--tgai-radius-full);
    color: #155724;
    font-size: var(--tgai-font-sm);
    font-weight: 500;
    line-height: 1;
}

.talkgenai-faq-badge .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #28a745;
    flex-shrink: 0;
}

.talkgenai-faq-badge-link {
    color: #155724;
    text-decoration: underline;
    opacity: 0.75;
    font-weight: 400;
    font-size: var(--tgai-font-xs);
    margin-left: 2px;
}

.talkgenai-faq-badge-link:hover {
    opacity: 1;
    color: #0a3a12;
}

/* Article Actions - Bottom Bar */
.talkgenai-article-actions {
    margin-top: 15px;
    padding: 15px 20px;
    background: var(--tgai-neutral-100);
    border-top: 1px solid var(--tgai-neutral-200);
    border-radius: 0 0 var(--tgai-radius-sm) var(--tgai-radius-sm);
    text-align: center;
}

.talkgenai-article-actions .button {
    margin: 0 5px;
}

.talkgenai-secondary-btn {
    background: var(--tgai-neutral-100) !important;
    color: var(--tgai-neutral-500) !important;
    border: 1px solid var(--tgai-neutral-200) !important;
    font-size: var(--tgai-font-xs) !important;
    padding: 6px 12px !important;
    height: 32px !important;
    margin: 0 4px !important;
    box-shadow: none !important;
    transition: all var(--tgai-transition-base) !important;
    border-radius: var(--tgai-radius-sm) !important;
}

.talkgenai-secondary-btn:hover {
    background: var(--tgai-neutral-200) !important;
    color: var(--tgai-neutral-700) !important;
    border-color: var(--tgai-neutral-300) !important;
    transform: none !important;
    box-shadow: var(--tgai-shadow-sm) !important;
}

.talkgenai-secondary-btn:active {
    transform: none !important;
    box-shadow: none !important;
}

.talkgenai-secondary-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 4px;
}

/* ==========================================================================
   Form Actions (Save/Generate New)
   ========================================================================== */
.talkgenai-form-actions {
    margin-top: var(--tgai-space-5);
    padding: var(--tgai-space-4);
    background: var(--tgai-neutral-50);
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    text-align: center;
    display: flex;
    gap: var(--tgai-space-3);
    justify-content: center;
    align-items: center;
}

.talkgenai-form-actions .button {
    margin: 0;
}

/* Save button - green gradient */
#save-app-btn {
    background: var(--tgai-gradient-green) !important;
    color: white !important;
    border: none !important;
    border-radius: var(--tgai-radius-md);
    padding: var(--tgai-space-2) var(--tgai-space-5);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
    transition: all var(--tgai-transition-base);
}

#save-app-btn:hover {
    background: var(--tgai-gradient-green-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Save button attention state */
#save-app-btn.tgai-attention {
    position: relative;
    animation: tgai-pulse 1.6s ease-in-out infinite;
}

/* Generate New button - outlined */
#generate-new-btn {
    background: transparent !important;
    color: var(--tgai-neutral-600) !important;
    border: 2px solid var(--tgai-neutral-300) !important;
    border-radius: var(--tgai-radius-md);
    padding: var(--tgai-space-2) var(--tgai-space-5);
    font-weight: 500;
    box-shadow: none;
    transition: all var(--tgai-transition-base);
}

#generate-new-btn:hover {
    border-color: var(--tgai-primary) !important;
    color: var(--tgai-primary) !important;
    background: rgba(102, 126, 234, 0.04) !important;
}

.talkgenai-preview-actions .button {
    margin: 0 5px;
}

/* Enhanced button styling for TalkGenAI */
.talkgenai-admin-container .button,
.talkgenai-generation-form .button,
.talkgenai-form-actions .button,
.talkgenai-preview-actions .button {
    background: var(--tgai-gradient);
    color: white;
    border: none;
    border-radius: var(--tgai-radius-sm);
    font-weight: 500;
    padding: 8px 16px;
    transition: all var(--tgai-transition-base);
    box-shadow: var(--tgai-shadow-sm);
    text-decoration: none;
}

.talkgenai-admin-container .button:hover,
.talkgenai-generation-form .button:hover,
.talkgenai-form-actions .button:hover,
.talkgenai-preview-actions .button:hover {
    background: var(--tgai-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--tgai-shadow-md);
    color: white;
}

.talkgenai-admin-container .button:active,
.talkgenai-generation-form .button:active,
.talkgenai-form-actions .button:active,
.talkgenai-preview-actions .button:active {
    transform: translateY(0);
    box-shadow: var(--tgai-shadow-sm);
}

/* Primary button variant */
.talkgenai-admin-container .button-primary,
.talkgenai-generation-form .button-primary,
.talkgenai-form-actions .button-primary {
    background: var(--tgai-gradient-green);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.talkgenai-admin-container .button-primary:hover,
.talkgenai-generation-form .button-primary:hover,
.talkgenai-form-actions .button-primary:hover {
    background: var(--tgai-gradient-green-hover);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    color: white;
}

/* Modification Form */
#talkgenai-modify-area {
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: var(--tgai-space-5);
    margin-bottom: var(--tgai-space-5);
}

#talkgenai-modify-area h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* ==========================================================================
   Sidebar - Rounded Card
   ========================================================================== */
.talkgenai-sidebar-box {
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: var(--tgai-space-5);
    margin-bottom: var(--tgai-space-5);
    box-shadow: var(--tgai-shadow-sm);
}

.talkgenai-sidebar-box h3 {
    margin-top: 0;
    margin-bottom: var(--tgai-space-3);
    font-size: var(--tgai-font-base);
    font-weight: 600;
    color: var(--tgai-neutral-700);
}

.talkgenai-recent-apps {
    margin: 0;
    padding: 0;
    list-style: none;
}

.talkgenai-recent-apps li {
    padding: var(--tgai-space-2) var(--tgai-space-3);
    border-bottom: 1px solid var(--tgai-neutral-100);
    border-radius: var(--tgai-radius-sm);
    transition: all var(--tgai-transition-base);
}

.talkgenai-recent-apps li:last-child {
    border-bottom: none;
}

.talkgenai-recent-apps li:hover {
    background: var(--tgai-neutral-50);
    padding-left: var(--tgai-space-4);
}

.talkgenai-recent-apps a {
    text-decoration: none;
    font-weight: 500;
    color: var(--tgai-neutral-700);
    transition: color var(--tgai-transition-fast);
}

.talkgenai-recent-apps a:hover {
    color: var(--tgai-primary);
}

.talkgenai-recent-apps small {
    color: var(--tgai-neutral-400);
    font-size: var(--tgai-font-xs);
}

/* ==========================================================================
   Apps List Table
   ========================================================================== */
.talkgenai-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
}

.talkgenai-empty-state h2 {
    color: var(--tgai-neutral-500);
    margin-bottom: 10px;
}

.talkgenai-empty-state p {
    color: var(--tgai-neutral-400);
    margin-bottom: 20px;
}

.column-type .dashicons {
    margin-right: 5px;
    color: var(--tgai-neutral-500);
}

.talkgenai-shortcode {
    background: var(--tgai-neutral-100);
    padding: 4px 6px;
    border-radius: var(--tgai-radius-sm);
    font-family: Consolas, Monaco, monospace;
    font-size: var(--tgai-font-xs);
    display: inline-block;
    margin-right: 5px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.copy-shortcode {
    font-size: 11px;
    padding: 2px 6px;
    height: auto;
    line-height: 1.2;
    vertical-align: middle;
}

/* Settings Page */
.talkgenai-settings-actions {
    margin-top: 20px;
}

.talkgenai-settings-actions .button {
    margin-right: 10px;
}

#connection-test-result {
    padding: 10px;
    border-radius: var(--tgai-radius-sm);
    display: none;
}

#connection-test-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#connection-test-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Edit Page */
.talkgenai-edit-container {
    display: flex;
    gap: var(--tgai-space-5);
    margin-top: var(--tgai-space-5);
}

.talkgenai-edit-preview {
    flex: 1;
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: var(--tgai-space-5);
}

.talkgenai-edit-form {
    width: 400px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: var(--tgai-space-5);
}

#current-app-preview {
    border: 2px dashed var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-sm);
    padding: var(--tgai-space-5);
    background: var(--tgai-neutral-50);
    min-height: 300px;
}

/* Preview Page */
.talkgenai-preview-full {
    background: #fff;
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-lg);
    padding: 30px;
    margin: 20px 0;
}

.talkgenai-preview-actions {
    text-align: center;
    margin-top: 20px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.button .dashicons.dashicons-update {
    margin-right: 5px;
    animation: spin 1s linear infinite;
}

#generate-icon {
    animation: none;
    margin-right: 2px;
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.button.loading {
    opacity: 0.7;
    pointer-events: none;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
    cursor: wait;
}

/* Disabled button state */
.talkgenai-admin-container .button:disabled,
.talkgenai-generation-form .button:disabled,
.talkgenai-form-actions .button:disabled,
.talkgenai-preview-actions .button:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Notifications - Slide-in Animation
   ========================================================================== */
.talkgenai-notice {
    margin: 15px 0;
    padding: var(--tgai-space-3) var(--tgai-space-4);
    border-radius: var(--tgai-radius-md);
    border-left: 4px solid;
    animation: tgai-notification-in 0.3s ease-out;
    box-shadow: var(--tgai-shadow-sm);
}

.talkgenai-notice.success {
    background: #d4edda;
    color: #155724;
    border-left-color: var(--tgai-success);
}

.talkgenai-notice.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: var(--tgai-error);
}

.talkgenai-notice.warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: var(--tgai-warning);
}

.talkgenai-notice.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: var(--tgai-info);
}

/* ==========================================================================
   App Type Icons
   ========================================================================== */
.talkgenai-app-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

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

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.talkgenai-text-center {
    text-align: center;
}

.talkgenai-text-muted {
    color: var(--tgai-neutral-500);
}

.talkgenai-mb-0 {
    margin-bottom: 0;
}

.talkgenai-mt-20 {
    margin-top: 20px;
}

.talkgenai-hidden {
    display: none;
}

/* Form Enhancements */
.talkgenai-form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.talkgenai-form-row .form-field {
    flex: 1;
}

.talkgenai-form-row .form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Tooltips */
.talkgenai-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.talkgenai-tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--tgai-neutral-800);
    color: #fff;
    text-align: center;
    border-radius: var(--tgai-radius-sm);
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    font-size: var(--tgai-font-xs);
    line-height: 1.4;
}

.talkgenai-tooltip:hover .tooltiptext {
    visibility: visible;
}

/* Progress Indicators */
.talkgenai-progress {
    width: 100%;
    height: 6px;
    background: var(--tgai-neutral-100);
    border-radius: var(--tgai-radius-full);
    overflow: hidden;
    margin: 10px 0;
}

.talkgenai-progress-bar {
    height: 100%;
    background: var(--tgai-gradient);
    border-radius: var(--tgai-radius-full);
    transition: width 0.3s ease;
    width: 0%;
}

.talkgenai-progress-bar.indeterminate {
    animation: indeterminate 2s linear infinite;
}

/* ==========================================================================
   Simple Table Layout for App List
   ========================================================================== */
.talkgenai-list-header-row,
.talkgenai-app-card {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--tgai-neutral-200);
    width: 100%;
    box-sizing: border-box;
}

.talkgenai-list-header-row {
    background: var(--tgai-neutral-100);
    font-weight: 600;
    border-bottom: 2px solid var(--tgai-neutral-300);
}

/* Simple Fixed Column Widths */
.talkgenai-header-select,
.talkgenai-app-card-select {
    width: 40px;
    min-width: 40px;
    text-align: center;
}

.talkgenai-header-app,
.talkgenai-app-card-body {
    flex: 1;
    min-width: 200px;
    padding: 0 8px;
}

.talkgenai-header-type,
.talkgenai-app-type-col {
    width: 100px;
    min-width: 100px;
    text-align: center;
}

.talkgenai-header-scope,
.talkgenai-app-scope-col {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.talkgenai-header-shortcode,
.talkgenai-app-shortcode-col {
    width: 180px;
    min-width: 180px;
    text-align: center;
}

.talkgenai-header-date,
.talkgenai-app-date-col {
    width: 120px;
    min-width: 120px;
    text-align: center;
}

.talkgenai-header-status,
.talkgenai-app-status-col {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.talkgenai-app-title {
    font-size: var(--tgai-font-base);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.talkgenai-app-description {
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-500);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Shortcode Column Styles */
.talkgenai-shortcode-container {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--tgai-neutral-50);
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-sm);
    padding: 3px 4px;
    font-size: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.talkgenai-shortcode-text {
    flex: 1;
    background: transparent;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: var(--tgai-neutral-500);
    padding: 0;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.talkgenai-copy-shortcode-btn {
    background: var(--tgai-primary);
    color: white;
    border: none;
    border-radius: var(--tgai-radius-sm);
    padding: 2px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    transition: background-color var(--tgai-transition-base);
    flex-shrink: 0;
}

.talkgenai-copy-shortcode-btn:hover {
    background: var(--tgai-primary-dark);
}

.talkgenai-copy-shortcode-btn .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

.talkgenai-copy-shortcode-btn.copied {
    background: var(--tgai-success);
}

.talkgenai-copy-shortcode-btn.copied::before {
    content: "\2713";
    font-family: sans-serif;
}

.talkgenai-copy-shortcode-btn.copied .dashicons {
    display: none;
}

/* Select2 Custom Styling */
.tgai-select2-app-selector {
    max-width: 500px !important;
}

.select2-container--default .select2-selection--single {
    height: 40px !important;
    border: 1px solid var(--tgai-neutral-200) !important;
    border-radius: var(--tgai-radius-sm) !important;
    padding: 4px 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px !important;
    color: var(--tgai-neutral-700) !important;
    padding-left: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--tgai-primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.select2-container--default .select2-results__option {
    padding: 10px 12px !important;
    transition: background-color var(--tgai-transition-base);
}

.select2-container--default .select2-results__option--highlighted {
    background-color: var(--tgai-primary) !important;
    color: white !important;
}

.select2-container--default .select2-results__option--selected {
    background-color: rgba(102, 126, 234, 0.08) !important;
    color: var(--tgai-primary) !important;
}

.tgai-select2-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tgai-app-icon {
    font-size: 16px;
    width: 20px;
    flex-shrink: 0;
}

.tgai-app-title {
    font-size: var(--tgai-font-base);
    font-weight: 500;
    color: inherit;
}

.select2-search--dropdown {
    padding: 8px !important;
    background: var(--tgai-neutral-100) !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--tgai-neutral-200) !important;
    border-radius: var(--tgai-radius-sm) !important;
    padding: 6px 10px !important;
    font-size: var(--tgai-font-base) !important;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--tgai-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1) !important;
}

.select2-dropdown {
    border: 1px solid var(--tgai-neutral-200) !important;
    border-radius: var(--tgai-radius-sm) !important;
    box-shadow: var(--tgai-shadow-lg) !important;
    margin-top: 4px !important;
}

.select2-container--default .select2-results__option[aria-selected] {
    font-size: var(--tgai-font-base);
}

.select2-results__message {
    color: var(--tgai-neutral-500) !important;
    font-style: italic;
}

/* ==========================================================================
   Empty State (No API Key) - Moved from inline
   ========================================================================== */
.talkgenai-empty-state-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.talkgenai-empty-state-container .talkgenai-empty-state {
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
    padding: var(--tgai-space-12) var(--tgai-space-10) var(--tgai-space-10);
    background: #fff;
    border-radius: var(--tgai-radius-xl);
    box-shadow: var(--tgai-shadow-lg);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--tgai-neutral-200);
}

.talkgenai-empty-state-container .talkgenai-empty-state::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--tgai-gradient);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--tgai-space-4);
    animation: tgai-float 3s ease-in-out infinite;
}

.talkgenai-empty-state-container .talkgenai-empty-state h2 {
    font-size: var(--tgai-font-3xl);
    margin: 0 0 var(--tgai-space-4) 0;
    color: var(--tgai-neutral-900);
    font-weight: 700;
    line-height: 1.2;
}

.empty-state-subtitle {
    font-size: 16px;
    color: var(--tgai-neutral-600);
    margin: 8px 0;
    line-height: 1.6;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.setup-steps {
    margin: 30px 0 25px 0;
    text-align: left;
}

.setup-steps h3 {
    font-size: 16px;
    margin-bottom: var(--tgai-space-4);
    text-align: center;
    color: var(--tgai-neutral-600);
    font-weight: 600;
}

.step-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--tgai-space-3);
    max-width: 500px;
}

.step-list li {
    display: flex;
    align-items: center;
    gap: var(--tgai-space-3);
    padding: var(--tgai-space-3) var(--tgai-space-4);
    background: var(--tgai-neutral-50);
    border-radius: var(--tgai-radius-md);
    border: 1px solid var(--tgai-neutral-200);
    transition: all var(--tgai-transition-base);
}

.step-list li:hover {
    border-color: var(--tgai-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
    transform: translateY(-1px);
}

.step-number {
    font-size: 20px;
    flex-shrink: 0;
}

.step-text {
    font-size: var(--tgai-font-base);
    color: var(--tgai-neutral-700);
    line-height: 1.5;
}

.step-text a {
    color: var(--tgai-primary);
    text-decoration: none;
    font-weight: 600;
}

.step-text a:hover {
    text-decoration: underline;
}

.step-text strong {
    color: var(--tgai-neutral-800);
    font-weight: 600;
}

.empty-state-actions {
    display: flex;
    gap: var(--tgai-space-4);
    justify-content: center;
    margin: 30px 0 0 0;
    flex-wrap: wrap;
}

.empty-state-actions .button-primary {
    font-size: 16px !important;
    padding: 14px 32px !important;
    height: auto !important;
    background: var(--tgai-gradient) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--tgai-radius-full) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    box-shadow: var(--tgai-shadow-md) !important;
    transition: all 0.3s ease !important;
    text-shadow: none !important;
}

.empty-state-actions .button-primary:hover {
    background: var(--tgai-gradient-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--tgai-shadow-lg) !important;
}

.empty-state-actions .button-secondary {
    font-size: 16px !important;
    padding: 14px 32px !important;
    height: auto !important;
    background: #ffffff !important;
    color: var(--tgai-neutral-600) !important;
    border: 2px solid var(--tgai-neutral-300) !important;
    border-radius: var(--tgai-radius-full) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    box-shadow: var(--tgai-shadow-sm) !important;
    transition: all 0.3s ease !important;
    text-shadow: none !important;
}

.empty-state-actions .button-secondary:hover {
    background: var(--tgai-neutral-50) !important;
    border-color: var(--tgai-primary) !important;
    color: var(--tgai-primary) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--tgai-shadow-md) !important;
}

.empty-state-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--tgai-neutral-200);
}

.social-proof {
    font-size: var(--tgai-font-base);
    color: var(--tgai-neutral-500);
    margin: 0;
    font-weight: 500;
}

/* ==========================================================================
   Insufficient Credits Error Notice
   ========================================================================== */
.talkgenai-error-notice {
    background: #fff3cd;
    border-left: 4px solid var(--tgai-warning);
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: var(--tgai-radius-sm);
    box-shadow: var(--tgai-shadow-sm);
}

.talkgenai-error-notice h3 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 16px;
    font-weight: 600;
}

.talkgenai-error-notice p {
    margin: 8px 0;
    color: #856404;
    line-height: 1.5;
}

.talkgenai-error-notice p strong {
    font-weight: 600;
    color: #664d03;
}

/* ==========================================================================
   Focus-visible for Accessibility
   ========================================================================== */
.talkgenai-admin-container *:focus-visible {
    outline: 2px solid var(--tgai-primary);
    outline-offset: 2px;
    border-radius: var(--tgai-radius-sm);
}

/* ==========================================================================
   Modern Article Form Components
   ========================================================================== */

/* --- Pill Toggle (Article Source) --- */
.tgai-pill-toggle {
    display: inline-flex;
    background: #fff;
    border-radius: var(--tgai-radius-full);
    padding: 4px;
    position: relative;
    border: 1px solid var(--tgai-neutral-200);
    gap: 0;
}

.tgai-pill-toggle__slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: transparent;
    border-radius: var(--tgai-radius-full);
    box-shadow: none;
    transition: transform var(--tgai-transition-base);
    z-index: 0;
    pointer-events: none;
}

.tgai-pill-toggle.tgai-pill--right .tgai-pill-toggle__slider {
    transform: translateX(100%);
}

.tgai-pill-toggle__option {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: var(--tgai-font-sm);
    font-weight: 500;
    color: #1e1e1e;
    cursor: pointer;
    border-radius: var(--tgai-radius-full);
    transition: color var(--tgai-transition-base);
    white-space: nowrap;
    user-select: none;
}

.tgai-pill-toggle__option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.tgai-pill-toggle__option--active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--tgai-radius-full);
}

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

/* --- Field Group --- */
.tgai-field-group {
    margin-bottom: var(--tgai-space-3);
}

.tgai-field-label {
    display: block;
    font-size: var(--tgai-font-sm);
    font-weight: 600;
    color: var(--tgai-neutral-700);
    margin-bottom: var(--tgai-space-2);
}

.tgai-field-label .required {
    color: var(--tgai-error);
}

.tgai-field-hint {
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-400);
    margin-top: var(--tgai-space-1);
    line-height: 1.4;
}

.tgai-input {
    width: 100%;
    padding: var(--tgai-space-2) var(--tgai-space-3);
    border: 2px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    font-size: var(--tgai-font-base);
    background: var(--tgai-neutral-50);
    transition: border-color var(--tgai-transition-base), box-shadow var(--tgai-transition-base), background var(--tgai-transition-base);
    box-sizing: border-box;
}

.tgai-input:focus {
    border-color: var(--tgai-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: #fff;
    outline: none;
}

.tgai-textarea {
    width: 100%;
    padding: var(--tgai-space-2) var(--tgai-space-3);
    border: 2px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    font-size: var(--tgai-font-base);
    line-height: 1.5;
    background: var(--tgai-neutral-50);
    transition: border-color var(--tgai-transition-base), box-shadow var(--tgai-transition-base), background var(--tgai-transition-base);
    box-sizing: border-box;
    resize: vertical;
    min-height: 54px;
}

.tgai-textarea:focus {
    border-color: var(--tgai-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: #fff;
    outline: none;
}

.tgai-textarea--short {
    min-height: 44px;
}

/* --- Article Length Pills --- */
.tgai-length-pills {
    display: flex;
    gap: var(--tgai-space-2);
}

.tgai-length-pill {
    flex: 1;
    padding: var(--tgai-space-2) var(--tgai-space-3);
    border: 2px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-md);
    background: var(--tgai-neutral-50);
    text-align: center;
    cursor: pointer;
    transition: all var(--tgai-transition-base);
    font-size: var(--tgai-font-sm);
    font-weight: 500;
    color: var(--tgai-neutral-600);
    user-select: none;
}

.tgai-length-pill:hover {
    border-color: var(--tgai-primary);
    color: var(--tgai-primary);
    background: rgba(102, 126, 234, 0.04);
}

.tgai-length-pill.active {
    border-color: var(--tgai-primary);
    background: rgba(102, 126, 234, 0.08);
    color: var(--tgai-primary);
    font-weight: 600;
}

.tgai-length-pill__label {
    display: block;
    font-weight: inherit;
}

.tgai-length-pill__hint {
    display: block;
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-400);
    margin-top: 2px;
}

.tgai-length-pill.active .tgai-length-pill__hint {
    color: var(--tgai-primary);
    opacity: 0.7;
}

/* --- Section Divider --- */
.tgai-section-divider {
    border: none;
    border-top: 1px solid var(--tgai-neutral-200);
    margin: var(--tgai-space-3) 0;
}

/* --- Collapsible Section --- */
.tgai-collapsible__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--tgai-space-1) 0;
    user-select: none;
}

.tgai-collapsible__title {
    display: flex;
    align-items: center;
    gap: var(--tgai-space-2);
    font-size: var(--tgai-font-md);
    font-weight: 600;
    color: var(--tgai-neutral-700);
    margin: 0;
}

.tgai-collapsible__title .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--tgai-primary);
}

.tgai-collapsible__arrow {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--tgai-neutral-400);
    transition: transform var(--tgai-transition-base);
}

.tgai-collapsible.collapsed .tgai-collapsible__arrow {
    transform: rotate(-90deg);
}

.tgai-collapsible__body {
    overflow: hidden;
}

/* --- Toggle Switch --- */
.tgai-toggle-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--tgai-space-3);
    padding: var(--tgai-space-2) 0;
    border-bottom: 1px solid var(--tgai-neutral-100);
}

.tgai-toggle-row:last-child {
    border-bottom: none;
}

.tgai-toggle-row__info {
    flex: 1;
    min-width: 0;
}

.tgai-toggle-row__label {
    font-size: var(--tgai-font-sm);
    font-weight: 600;
    color: var(--tgai-neutral-700);
    margin-bottom: 2px;
}

.tgai-toggle-row__desc {
    font-size: var(--tgai-font-xs);
    color: var(--tgai-neutral-400);
    line-height: 1.4;
}

.tgai-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.tgai-toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tgai-toggle-switch__track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tgai-neutral-300);
    border-radius: var(--tgai-radius-full);
    cursor: pointer;
    transition: background var(--tgai-transition-base);
}

.tgai-toggle-switch__track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform var(--tgai-transition-base);
}

.tgai-toggle-switch input:checked + .tgai-toggle-switch__track {
    background: var(--tgai-primary);
}

.tgai-toggle-switch input:checked + .tgai-toggle-switch__track::after {
    transform: translateX(20px);
}

/* RTL support for toggle switch */
[dir="rtl"] .tgai-toggle-switch__track::after {
    left: auto;
    right: 3px;
}

[dir="rtl"] .tgai-toggle-switch input:checked + .tgai-toggle-switch__track::after {
    transform: translateX(-20px);
}

/* --- Premium Badge (inline) --- */
.tgai-badge--premium {
    background: #ff6b00;
    color: #fff;
    padding: 1px 7px;
    border-radius: var(--tgai-radius-full);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 6px;
}

/* --- Premium Locked State --- */
.tgai-length-pill.tgai-premium-locked {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.tgai-free-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--tgai-neutral-400);
    line-height: 1.4;
}

.tgai-free-hint a {
    color: #f97316;
    text-decoration: none;
    font-weight: 500;
}

.tgai-free-hint a:hover {
    text-decoration: underline;
}

.tgai-length-premium-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 2;
    gap: 4px;
}

.tgai-length-premium-group__pills {
    display: flex;
    gap: var(--tgai-space-2);
    width: 100%;
}

.tgai-length-premium-group__pills .tgai-length-pill {
    flex: 1;
}

.tgai-premium-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--tgai-neutral-500);
    text-decoration: none;
}

.tgai-premium-link--centered {
    margin-top: 2px;
}

.tgai-premium-link:hover {
    color: #ff6b00;
}

.tgai-premium-link .tgai-badge--premium {
    margin-left: 0;
    margin-right: 4px;
}

/* --- Generate Article Button (full-width gradient) --- */
.tgai-generate-btn {
    width: 100%;
    padding: var(--tgai-space-3) var(--tgai-space-5);
    font-size: var(--tgai-font-md);
    font-weight: 600;
    background: var(--tgai-gradient) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--tgai-radius-md);
    box-shadow: var(--tgai-shadow-md);
    transition: all var(--tgai-transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tgai-space-2);
    cursor: pointer;
    margin-top: var(--tgai-space-3);
}

.tgai-generate-btn:hover {
    background: var(--tgai-gradient-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--tgai-shadow-lg);
}

.tgai-generate-btn:active {
    transform: translateY(0);
}

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

/* --- Nested field (manual URLs) --- */
.tgai-nested-field {
    margin-top: var(--tgai-space-2);
    padding-left: var(--tgai-space-3);
    border-left: 2px solid var(--tgai-neutral-200);
}

/* --- Two-column form row --- */
.tgai-form-2col {
    display: flex;
    gap: var(--tgai-space-3);
    margin-bottom: var(--tgai-space-3);
}

.tgai-form-2col > .tgai-field-group {
    margin-bottom: 0;
}

.tgai-form-2col > .tgai-col-grow {
    flex: 1;
    min-width: 0;
}

.tgai-form-2col > .tgai-col-auto {
    flex-shrink: 0;
}

/* --- Inline toggles row (3 toggles in one line) --- */
.tgai-toggles-inline {
    display: flex;
    gap: var(--tgai-space-4);
    flex-wrap: wrap;
    padding: var(--tgai-space-2) 0;
}

.tgai-toggle-compact {
    display: flex;
    align-items: center;
    gap: var(--tgai-space-2);
    white-space: nowrap;
}

.tgai-toggle-compact__label {
    font-size: var(--tgai-font-sm);
    font-weight: 500;
    color: var(--tgai-neutral-600);
}

/* Smaller toggle switch for inline layout */
.tgai-toggle-switch--sm {
    width: 36px;
    height: 20px;
}

.tgai-toggle-switch--sm .tgai-toggle-switch__track::after {
    width: 14px;
    height: 14px;
}

.tgai-toggle-switch--sm input:checked + .tgai-toggle-switch__track::after {
    transform: translateX(16px);
}

[dir="rtl"] .tgai-toggle-switch--sm input:checked + .tgai-toggle-switch__track::after {
    transform: translateX(-16px);
}

/* ==========================================================================
   Article Progress Bar - Modern Timer
   ========================================================================== */
.tgai-progress {
    display: none;
    background: var(--tgai-gradient);
    border-radius: var(--tgai-radius-lg);
    margin: var(--tgai-space-4) 0;
    color: #fff;
    box-shadow: var(--tgai-shadow-lg);
    position: relative;
    overflow: hidden;
    animation: tgai-progress-pulse 3s ease-in-out infinite;
}

.tgai-progress__inner {
    display: flex;
    align-items: center;
    padding: var(--tgai-space-3) var(--tgai-space-5);
    gap: var(--tgai-space-3);
    position: relative;
    z-index: 1;
}

.tgai-progress__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff !important;
    animation: tgai-spin 1s ease-in-out infinite;
    flex-shrink: 0;
}

.tgai-progress__message {
    flex: 1;
    font-size: var(--tgai-font-base);
    font-weight: 500;
    color: #fff !important;
    min-width: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tgai-progress__timer {
    font-size: var(--tgai-font-sm);
    font-weight: 600;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 10px;
    border-radius: var(--tgai-radius-full);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    direction: ltr; /* Always LTR for numbers, even in RTL pages */
    unicode-bidi: isolate;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tgai-progress__bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px !important;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.95)) !important;
    transition: width 0.5s ease;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
    z-index: 0;
}

/* RTL: flip bar direction */
[dir="rtl"] .tgai-progress__bar {
    left: auto;
    right: 0;
    border-radius: 2px 0 0 2px;
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.95)) !important;
}

/* ID-level overrides to beat WordPress admin specificity */
#talkgenai-job-progress {
    color: #fff !important;
}

#talkgenai-job-progress span,
#talkgenai-job-progress .tgai-progress__message,
#talkgenai-job-progress .tgai-progress__timer {
    color: #fff !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media screen and (max-width: 900px) {
    .talkgenai-admin-container {
        flex-direction: column;
    }

    .talkgenai-main-content {
        max-width: 100%;
    }

    .talkgenai-sidebar {
        width: 100%;
    }

    .talkgenai-edit-container {
        flex-direction: column;
    }

    .talkgenai-edit-form {
        width: 100%;
    }

    .talkgenai-app-workspace {
        flex-direction: column !important;
    }

    .talkgenai-generation-section,
    .talkgenai-preview-section {
        width: 100% !important;
        max-width: 100%;
        flex-basis: 100%;
    }

    .talkgenai-header-bar {
        flex-wrap: wrap;
        gap: var(--tgai-space-2);
    }

    /* Example cards: horizontal on mobile */
    .tgai-examples-grid {
        grid-template-columns: 1fr !important;
    }

    .talkgenai-example-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        gap: var(--tgai-space-3);
        padding: var(--tgai-space-3) var(--tgai-space-4) !important;
    }

    .talkgenai-example-card .card-icon {
        margin: 0 !important;
        flex-shrink: 0;
    }

    .talkgenai-example-card .card-content {
        flex: 1;
    }
}

@media screen and (max-width: 768px) {
    .talkgenai-shortcode {
        max-width: 150px;
    }

    .column-shortcode {
        min-width: 200px;
    }

    .talkgenai-empty-state-container .talkgenai-empty-state {
        padding: var(--tgai-space-10) var(--tgai-space-6) var(--tgai-space-8);
        border-radius: var(--tgai-radius-lg);
    }

    .talkgenai-empty-state-container .talkgenai-empty-state h2 {
        font-size: var(--tgai-font-2xl);
    }

    .empty-state-actions {
        flex-direction: column;
        gap: var(--tgai-space-3);
    }

    .empty-state-actions .button-primary,
    .empty-state-actions .button-secondary {
        width: 100%;
        text-align: center;
        font-size: var(--tgai-font-md) !important;
        padding: 12px 28px !important;
    }

    .talkgenai-header-bar h1 {
        font-size: var(--tgai-font-lg);
    }
}

@media screen and (max-width: 480px) {
    .talkgenai-all-buttons {
        flex-wrap: wrap;
        gap: var(--tgai-space-1);
    }

    .talkgenai-all-buttons .button {
        font-size: var(--tgai-font-xs);
        padding: var(--tgai-space-1) var(--tgai-space-2);
        height: 28px;
    }

    #tgai-chat-composer {
        padding: var(--tgai-space-3);
    }

    #tgai-chat-input {
        min-height: 40px;
        font-size: var(--tgai-font-base);
    }

    /* Article form responsive */
    .tgai-pill-toggle {
        width: 100%;
    }

    .tgai-pill-toggle__option {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: var(--tgai-font-xs);
    }

    .tgai-length-pills {
        flex-direction: column;
    }

    .tgai-form-2col {
        flex-direction: column;
    }

    .tgai-toggles-inline {
        flex-direction: column;
        gap: var(--tgai-space-2);
    }
}

/* Responsive for app list columns */
@media (max-width: 1200px) {
    .talkgenai-header-shortcode,
    .talkgenai-app-shortcode-col {
        width: 150px;
        min-width: 150px;
    }

    .talkgenai-header-date,
    .talkgenai-app-date-col {
        width: 100px;
        min-width: 100px;
    }

    .talkgenai-shortcode-container {
        max-width: 140px;
    }

    .talkgenai-shortcode-text {
        font-size: 9px;
    }

    .tgai-select2-app-selector {
        max-width: 100% !important;
    }
}

/* Lightweight chat UI compat (old selectors) */
#tgai-chat {
    border: 1px solid var(--tgai-neutral-200);
    border-radius: var(--tgai-radius-sm);
    background: #fff;
    margin-top: 10px;
}
.tgai-chat-transcript {
    max-height: 260px;
    overflow-y: auto;
    padding: 10px 12px;
}
.tgai-chat-msg {
    margin: 6px 0;
    line-height: 1.35;
}
.tgai-chat-msg.user {
    color: var(--tgai-neutral-800);
}
.tgai-chat-msg.assistant {
    color: #065f46;
}
.tgai-chat-composer {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--tgai-neutral-200);
    padding: 8px;
}
.tgai-chat-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--tgai-neutral-300);
    border-radius: var(--tgai-radius-sm);
}
.tgai-chat-send {
    min-width: 88px;
}
