/**
 * AI Magic Theme Wizard Styles
 * Modern UI with progress tracking
 */

/* Container & Layout */
.ai-magic-wizard-wrap {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ai-magic-wizard-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.ai-magic-wizard-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #1d2327;
}

.ai-magic-wizard-header .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #7c3aed;
}

/* Cards */
.ai-magic-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 20px;
}

.ai-magic-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.ai-magic-card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.ai-magic-card-header .step-badge {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Form Elements */
.ai-magic-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-magic-textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.ai-magic-textarea::placeholder {
    color: #9ca3af;
}

/* Prompt Examples */
.ai-magic-prompt-examples {
    margin-bottom: 16px;
}

.ai-magic-prompt-examples label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.ai-magic-example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-magic-example-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-magic-example-chip:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.ai-magic-example-chip.active {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    border-color: #7c3aed;
    color: #fff;
}

/* More Examples Expandable Panel */
.ai-magic-more-examples {
    margin-top: 12px;
    display: none;
}

.ai-magic-more-examples[open] {
    display: block;
}

/* Inline toggle button (displays in the chip row) */
.ai-magic-more-examples-toggle {
    display: inline-block;
    vertical-align: top;
}

.ai-magic-more-examples-toggle>summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: #fff;
    border: 1px dashed #7c3aed;
    border-radius: 20px;
    font-size: 13px;
    color: #7c3aed;
    cursor: pointer;
    transition: all 0.2s;
    list-style: none;
}

.ai-magic-more-examples-toggle>summary::-webkit-details-marker {
    display: none;
}

.ai-magic-more-examples-toggle>summary:hover {
    background: #f5f3ff;
}

.ai-magic-more-examples-toggle>summary .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.ai-magic-more-examples-toggle[open]>summary .dashicons {
    transform: rotate(45deg);
}

/* Internal chips container in toggle */
.ai-magic-more-examples-toggle .ai-magic-example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    animation: fadeIn 0.2s ease;
}

.ai-magic-more-examples summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    list-style: none;
}

.ai-magic-more-examples summary::-webkit-details-marker {
    display: none;
}

.ai-magic-more-examples summary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.ai-magic-more-examples summary .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.ai-magic-more-examples[open] summary .dashicons {
    transform: rotate(45deg);
}

.ai-magic-more-examples summary .example-count {
    font-size: 11px;
    color: #9ca3af;
}

.ai-magic-more-examples .ai-magic-example-chips {
    margin-top: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Language Selector */
.ai-magic-language-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.ai-magic-language-selector label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.ai-magic-select {
    flex: 1;
    max-width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.ai-magic-select:hover {
    border-color: #a78bfa;
}

.ai-magic-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Provider/Model/Language Grid - Floating Labels */
.ai-magic-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ai-magic-field {
    position: relative;
}

.ai-magic-field .ai-magic-select {
    width: 100%;
    padding: 20px 36px 8px 14px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    color: #1d2327;
}

.ai-magic-field .ai-magic-select:hover {
    border-color: #a78bfa;
}

.ai-magic-field .ai-magic-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-magic-field label {
    position: absolute;
    top: 6px;
    left: 14px;
    font-size: 11px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 1;
}

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

/* Edit Link in Log */
.ai-magic-log-item .edit-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(124, 58, 237, 0.1);
    border-radius: 4px;
    font-size: 11px;
    color: #7c3aed;
    text-decoration: none;
    transition: background 0.2s;
}

.ai-magic-log-item .edit-link:hover {
    background: rgba(124, 58, 237, 0.2);
}

.ai-magic-log-item .edit-link .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

/* Scope Checkboxes */
.ai-magic-scopes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.ai-magic-scope-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-magic-scope-item:hover {
    background: #f3f4f6;
}

.ai-magic-scope-item.checked {
    background: #f5f3ff;
    border-color: #7c3aed;
}

.ai-magic-scope-item input {
    width: 18px;
    height: 18px;
    accent-color: #7c3aed;
}

.ai-magic-scope-item label {
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.ai-magic-scope-item .dashicons {
    color: #6b7280;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Buttons */
.ai-magic-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-magic-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}

.ai-magic-btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #9333ea);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.ai-magic-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-magic-btn-danger {
    background: #ef4444;
    color: #fff;
}

.ai-magic-btn-danger:hover {
    background: #dc2626;
}

.ai-magic-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.ai-magic-btn-secondary:hover {
    background: #e5e7eb;
}

/* Progress Section */
.ai-magic-progress-section {
    display: none;
}

.ai-magic-progress-section.active {
    display: block;
}

.ai-magic-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ai-magic-progress-stats {
    display: flex;
    gap: 24px;
}

.ai-magic-stat {
    text-align: center;
}

.ai-magic-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1d2327;
}

.ai-magic-stat-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-magic-stat-value.cost {
    color: #059669;
}

/* Progress Bar */
.ai-magic-progress-bar-container {
    background: #e5e7eb;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.ai-magic-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.ai-magic-progress-bar.animated {
    background: linear-gradient(90deg, #7c3aed, #a855f7, #7c3aed);
    background-size: 200% 100%;
    animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
    0% {
        background-position: 100% 0;
    }

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

/* Current Item Display */
.ai-magic-current-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f5f3ff;
    border-radius: 8px;
    margin-bottom: 16px;
}

.ai-magic-current-item .spinner {
    float: none;
    margin: 0;
}

.ai-magic-current-item-text {
    flex: 1;
}

.ai-magic-current-item-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-magic-current-item-name {
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

/* Log Container */
.ai-magic-log {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.ai-magic-log-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
}

.ai-magic-log-item:last-child {
    border-bottom: none;
}

.ai-magic-log-item.success {
    background: #f0fdf4;
}

.ai-magic-log-item.error {
    background: #fef2f2;
}

.ai-magic-log-item.skipped {
    background: #fffbeb;
}

.ai-magic-log-icon {
    flex-shrink: 0;
}

.ai-magic-log-icon .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.ai-magic-log-item.success .ai-magic-log-icon .dashicons {
    color: #10b981;
}

.ai-magic-log-item.error .ai-magic-log-icon .dashicons {
    color: #ef4444;
}

.ai-magic-log-item.skipped .ai-magic-log-icon .dashicons {
    color: #f59e0b;
}

.ai-magic-log-content {
    flex: 1;
    min-width: 0;
}

.ai-magic-log-title {
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.ai-magic-log-details {
    color: #6b7280;
    font-size: 12px;
}

.ai-magic-log-cost {
    flex-shrink: 0;
    font-weight: 600;
    color: #059669;
    font-size: 12px;
}

/* Complete Section */
.ai-magic-complete {
    text-align: center;
    padding: 40px 20px;
}

.ai-magic-complete-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981, #34d399);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.ai-magic-complete-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #fff;
}

.ai-magic-complete h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #1d2327;
}

.ai-magic-complete p {
    margin: 0;
    color: #6b7280;
}

/* Stopped State */
.ai-magic-stopped .ai-magic-complete-icon {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

/* Summary Stats */
.ai-magic-summary-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.ai-magic-summary-stat {
    text-align: center;
}

.ai-magic-summary-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
}

.ai-magic-summary-stat-value.cost {
    color: #059669;
}

.ai-magic-summary-stat-label {
    font-size: 13px;
    color: #6b7280;
}

/* Responsive */
@media (max-width: 782px) {
    .ai-magic-wizard-wrap {
        margin: 10px;
    }

    .ai-magic-scopes {
        grid-template-columns: 1fr;
    }

    .ai-magic-progress-header {
        flex-direction: column;
        gap: 16px;
    }

    .ai-magic-summary-stats {
        flex-wrap: wrap;
        gap: 20px;
    }
}

/* Page Selection List */
.ai-magic-page-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.ai-magic-page-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ai-magic-page-list-actions {
    display: flex;
    gap: 8px;
}

.ai-magic-page-list-actions button {
    padding: 4px 12px;
    font-size: 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
}

.ai-magic-page-list-actions button:hover {
    background: #e5e7eb;
}

#ai-magic-toggle-groups {
    padding: 4px 8px;
}

#ai-magic-toggle-groups .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

.ai-magic-page-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.ai-magic-page-item:last-child {
    border-bottom: none;
}

.ai-magic-page-item:hover {
    background: #fff;
}

.ai-magic-page-item.selected {
    background: #f5f3ff;
}

.ai-magic-page-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #7c3aed;
    flex-shrink: 0;
}

.ai-magic-page-item-content {
    flex: 1;
    min-width: 0;
}

.ai-magic-page-item-title {
    font-weight: 600;
    color: #1d2327;
    font-size: 14px;
    margin-bottom: 4px;
}

.ai-magic-page-item-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    gap: 12px;
}

.ai-magic-page-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-magic-page-item-meta .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Custom Name Input */
.ai-magic-custom-name {
    margin-top: 8px;
    display: none;
}

.ai-magic-page-item.selected .ai-magic-custom-name {
    display: block;
}

.ai-magic-custom-name input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.ai-magic-custom-name input:focus {
    outline: none;
    border-color: #7c3aed;
}

.ai-magic-custom-name input::placeholder {
    color: #9ca3af;
}

.ai-magic-custom-name-label {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
    display: block;
}

/* Before/After Diff Display - Expandable */
.ai-magic-log-diff-details {
    margin-top: 8px;
}

.ai-magic-log-diff-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f3f4f6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #6366f1;
    transition: background 0.2s;
    list-style: none;
}

.ai-magic-log-diff-summary::-webkit-details-marker {
    display: none;
}

.ai-magic-log-diff-summary:hover {
    background: #e5e7eb;
}

.ai-magic-log-diff-summary .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.ai-magic-log-diff-details[open] .ai-magic-log-diff-summary .dashicons {
    transform: rotate(90deg);
}

.ai-magic-log-diff {
    margin-top: 8px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid #e5e7eb;
}

.ai-magic-log-diff.error {
    margin-top: 8px;
}

/* Expandable diff rows */
details.ai-magic-log-diff-row {
    margin-bottom: 8px;
}

details.ai-magic-log-diff-row:last-child {
    margin-bottom: 0;
}

details.ai-magic-log-diff-row>summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 4px;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s;
}

details.ai-magic-log-diff-row>summary::-webkit-details-marker {
    display: none;
}

details.ai-magic-log-diff-row>summary:hover {
    background: #f3f4f6;
}

details.ai-magic-log-diff-row.before>summary {
    border-left: 3px solid #ef4444;
}

details.ai-magic-log-diff-row.after>summary {
    border-left: 3px solid #10b981;
}

.ai-magic-log-diff-preview {
    color: #6b7280;
    font-size: 12px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

details.ai-magic-log-diff-row[open]>summary {
    border-radius: 4px 4px 0 0;
}

details.ai-magic-log-diff-row .ai-magic-log-diff-text {
    padding: 10px 12px;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 4px 4px;
    font-size: 12px;
    line-height: 1.5;
    color: #374151;
}

.ai-magic-log-diff-row.before .ai-magic-log-diff-text {
    background: #fef2f2;
    border-color: #fecaca;
}

.ai-magic-log-diff-row.after .ai-magic-log-diff-text {
    background: #ecfdf5;
    border-color: #a7f3d0;
}


.ai-magic-log-diff-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.ai-magic-log-diff-row.before .ai-magic-log-diff-label {
    background: #fef2f2;
    color: #dc2626;
}

.ai-magic-log-diff-row.after .ai-magic-log-diff-label {
    background: #f0fdf4;
    color: #059669;
}

.ai-magic-log-diff-label {
    display: inline-block;
    width: fit-content;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #6b7280;
}

.ai-magic-log-diff-text {
    color: #374151;
    word-break: break-word;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Loading state for page list */
.ai-magic-page-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.ai-magic-page-list-loading .spinner {
    float: none;
    margin: 0 10px 0 0;
}

/* Empty state */
.ai-magic-page-list-empty {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

/* Selected count badge */
.ai-magic-selected-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f3ff;
    border: 1px solid #7c3aed;
    border-radius: 20px;
    font-size: 13px;
    color: #7c3aed;
    font-weight: 600;
}

/* Next/Prev step buttons */
.ai-magic-step-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.ai-magic-btn-outline {
    background: transparent;
    color: #7c3aed;
    border: 2px solid #7c3aed;
}

.ai-magic-btn-outline:hover {
    background: #f5f3ff;
}

/* Hide steps */
.ai-magic-step {
    display: none;
}

.ai-magic-step.active {
    display: block !important;
}

.ai-magic-btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

/* Step indicator */
.ai-magic-steps-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.ai-magic-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s;
}

.ai-magic-step-dot.active {
    background: #7c3aed;
    transform: scale(1.2);
}

.ai-magic-step-dot.completed {
    background: #10b981;
}

/* Page Group Styles */
.ai-magic-page-group {
    border-bottom: 1px solid #e5e7eb;
}

.ai-magic-page-group:last-child {
    border-bottom: none;
}

.ai-magic-page-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.ai-magic-page-group-header:hover {
    background: #f9fafb;
}

.ai-magic-page-group-header .dashicons {
    color: #6b7280;
    font-size: 18px;
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
}

.ai-magic-group-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
    cursor: pointer;
}

.ai-magic-page-group-title {
    font-weight: 600;
    color: #1d2327;
    font-size: 14px;
    flex: 1;
}

.ai-magic-page-group-count {
    background: #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.ai-magic-group-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.ai-magic-group-actions button {
    padding: 4px 12px;
    font-size: 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-magic-group-actions button:hover {
    background: #e5e7eb;
}

.ai-magic-page-group-content {
    background: #f9fafb;
}

.ai-magic-page-group.collapsed .ai-magic-page-group-content {
    display: none;
}

.ai-magic-page-group.collapsed .ai-magic-page-group-header {
    border-bottom: none;
}

.ai-magic-page-group .ai-magic-page-item {
    padding-left: 44px;
}

/* ============================================
   Shared Styles: Analytics & History Pages
   ============================================ */

/* Analytics Stats Grid */
.ai-magic-analytics-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ai-magic-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px !important;
}

.ai-magic-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-magic-stat-icon.cost {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.ai-magic-stat-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #fff;
}

.ai-magic-stat-content {
    flex: 1;
}

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

.ai-magic-stat-value.cost {
    color: #10b981;
}

.ai-magic-stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

/* Modern Table */
.ai-magic-table-wrap {
    overflow-x: auto;
}

.ai-magic-table {
    width: 100%;
    border-collapse: collapse;
}

.ai-magic-table thead th {
    text-align: left;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.5px;
}

.ai-magic-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.ai-magic-table tbody tr:last-child td {
    border-bottom: none;
}

.ai-magic-table tbody tr:hover {
    background: #f9fafb;
}

.ai-magic-table .cost {
    color: #10b981;
    font-weight: 500;
}

/* Badge */
.ai-magic-badge {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty State */
.ai-magic-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.ai-magic-empty-state .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.ai-magic-empty-state p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
}

.ai-magic-empty-hint {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #9ca3af;
}

/* Search Box */
.ai-magic-search-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-magic-search-box .dashicons {
    color: #9ca3af;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.ai-magic-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-magic-search-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Action Buttons */
.ai-magic-action-buttons {
    display: flex;
    gap: 8px;
}

.ai-magic-btn-small {
    padding: 6px 10px !important;
    min-width: auto !important;
}

.ai-magic-btn-small .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Edit Post Link */
.ai-magic-edit-link {
    font-size: 11px;
    color: #7c3aed;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.ai-magic-edit-link:hover {
    color: #5b21b6;
    text-decoration: underline;
}

.ai-magic-edit-link .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

/* Modal Improvements */
.ai-magic-modal-section {
    margin-bottom: 20px;
}

.ai-magic-modal-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.ai-magic-modal-content-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}