/**
 * AI Book Generator Wizard Styles
 * Modern, responsive wizard interface with Alpine.js
 */

:root {
    --wizard-primary: #4f46e5;
    --wizard-primary-dark: #3730a3;
    --wizard-secondary: #64748b;
    --wizard-success: #10b981;
    --wizard-warning: #f59e0b;
    --wizard-error: #ef4444;
    --wizard-background: #ffffff;
    --wizard-surface: #f8fafc;
    --wizard-border: #e2e8f0;
    --wizard-text: #1e293b;
    --wizard-text-muted: #64748b;
    --wizard-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --wizard-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --wizard-radius: 8px;
    --wizard-radius-lg: 12px;
    --wizard-transition: all 0.2s ease-in-out;
}

/* Wizard Container */
.tpt-book-wizard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--wizard-background);
    border-radius: var(--wizard-radius-lg);
    box-shadow: var(--wizard-shadow-lg);
    overflow: hidden;
}

/* Header */
.wizard-header {
    background: linear-gradient(135deg, var(--wizard-primary), var(--wizard-primary-dark));
    color: white;
    padding: 2rem;
    text-align: center;
}

.wizard-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.wizard-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Progress Bar */
.wizard-progress {
    background: var(--wizard-surface);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--wizard-border);
}

.progress-container {
    position: relative;
    height: 8px;
    background: var(--wizard-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--wizard-primary), var(--wizard-success));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-indicator:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--wizard-border);
    z-index: 1;
}

.step-indicator.completed:not(:last-child)::after {
    background: var(--wizard-success);
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
    transition: var(--wizard-transition);
}

.step-indicator.pending .step-icon {
    background: var(--wizard-border);
    color: var(--wizard-text-muted);
}

.step-indicator.active .step-icon {
    background: var(--wizard-primary);
    color: white;
    transform: scale(1.1);
}

.step-indicator.completed .step-icon {
    background: var(--wizard-success);
    color: white;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    color: var(--wizard-text-muted);
    transition: var(--wizard-transition);
}

.step-indicator.active .step-label {
    color: var(--wizard-primary);
    font-weight: 600;
}

.step-indicator.completed .step-label {
    color: var(--wizard-success);
}

/* Content Area */
.wizard-content {
    padding: 2rem;
    min-height: 500px;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Styles */
.wizard-form-group {
    margin-bottom: 1.5rem;
}

.wizard-form-group label {
    display: block;
    font-weight: 600;
    color: var(--wizard-text);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.wizard-input,
.wizard-select,
.wizard-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--wizard-border);
    border-radius: var(--wizard-radius);
    font-size: 1rem;
    transition: var(--wizard-transition);
    background: var(--wizard-background);
}

.wizard-input:focus,
.wizard-select:focus,
.wizard-textarea:focus {
    outline: none;
    border-color: var(--wizard-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.wizard-textarea {
    min-height: 120px;
    resize: vertical;
}

.wizard-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Concept Cards */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.concept-card {
    border: 2px solid var(--wizard-border);
    border-radius: var(--wizard-radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--wizard-transition);
    background: var(--wizard-background);
}

.concept-card:hover {
    border-color: var(--wizard-primary);
    transform: translateY(-2px);
    box-shadow: var(--wizard-shadow);
}

.concept-card.selected {
    border-color: var(--wizard-primary);
    background: rgba(79, 70, 229, 0.02);
}

.concept-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--wizard-text);
    margin-bottom: 0.5rem;
}

.concept-description {
    color: var(--wizard-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.concept-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--wizard-text-muted);
}

.concept-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.concept-badge.standalone {
    background: rgba(100, 116, 139, 0.1);
    color: var(--wizard-secondary);
}

.concept-badge.series {
    background: rgba(245, 158, 11, 0.1);
    color: var(--wizard-warning);
}

/* Plan Display */
.plan-overview {
    background: var(--wizard-surface);
    border: 1px solid var(--wizard-border);
    border-radius: var(--wizard-radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.plan-section {
    margin-bottom: 1.5rem;
}

.plan-section h4 {
    margin: 0 0 0.5rem 0;
    color: var(--wizard-text);
    font-size: 1.1rem;
}

.plan-section p {
    margin: 0;
    color: var(--wizard-text-muted);
    line-height: 1.6;
}

.book-outline {
    background: var(--wizard-background);
    border: 1px solid var(--wizard-border);
    border-radius: var(--wizard-radius);
    padding: 1rem;
    margin: 1rem 0;
}

.book-outline h5 {
    margin: 0 0 0.5rem 0;
    color: var(--wizard-primary);
    font-size: 1rem;
}

/* Chapter Management */
.chapter-list {
    margin: 2rem 0;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--wizard-surface);
    border: 1px solid var(--wizard-border);
    border-radius: var(--wizard-radius);
    margin-bottom: 0.5rem;
}

.chapter-info {
    flex: 1;
}

.chapter-title {
    font-weight: 600;
    color: var(--wizard-text);
    margin-bottom: 0.25rem;
}

.chapter-meta {
    font-size: 0.875rem;
    color: var(--wizard-text-muted);
}

.chapter-actions {
    display: flex;
    gap: 0.5rem;
}

.chapter-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.chapter-status.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--wizard-success);
}

.chapter-status.regenerating {
    background: rgba(245, 158, 11, 0.1);
    color: var(--wizard-warning);
}

/* Navigation */
.wizard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--wizard-surface);
    border-top: 1px solid var(--wizard-border);
}

.nav-button {
    padding: 0.75rem 1.5rem;
    border-radius: var(--wizard-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--wizard-transition);
    border: none;
    background: var(--wizard-secondary);
    color: white;
}

.nav-button:hover:not(:disabled) {
    background: #475569;
    transform: translateY(-1px);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.nav-button.primary {
    background: var(--wizard-primary);
}

.nav-button.primary:hover:not(:disabled) {
    background: var(--wizard-primary-dark);
}

.nav-button.success {
    background: var(--wizard-success);
}

.nav-button.success:hover:not(:disabled) {
    background: #059669;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--wizard-border);
    border-top: 4px solid var(--wizard-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 1rem;
    color: var(--wizard-text);
    font-weight: 500;
}

/* Notifications */
.wizard-notification {
    padding: 1rem 1.5rem;
    border-radius: var(--wizard-radius);
    margin: 1rem 0;
    font-weight: 500;
}

.wizard-notification.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--wizard-success);
}

.wizard-notification.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--wizard-error);
}

.wizard-notification.warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--wizard-warning);
}

/* Responsive Design */
@media (max-width: 768px) {
    .wizard-header {
        padding: 1.5rem;
    }

    .wizard-header h1 {
        font-size: 2rem;
    }

    .wizard-content {
        padding: 1.5rem;
    }

    .concept-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .step-indicators {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .step-indicator {
        flex: none;
        min-width: 80px;
    }

    .wizard-navigation {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.5rem;
    }

    .nav-button {
        width: 100%;
        padding: 1rem;
    }

    .chapter-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chapter-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --wizard-background: #1e293b;
        --wizard-surface: #334155;
        --wizard-border: #475569;
        --wizard-text: #f1f5f9;
        --wizard-text-muted: #94a3b8;
    }
}

/* Print styles */
@media print {
    .wizard-navigation,
    .nav-button {
        display: none !important;
    }

    .concept-card,
    .chapter-item {
        break-inside: avoid;
    }
}
