/**
 * AI Book Generator Enhanced Styles
 * Modern, responsive design with improved UX
 */

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

/* Main Container */
.tpt-ai-generator-frontend-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--tpt-text);
    background: linear-gradient(135deg, var(--tpt-surface) 0%, #ffffff 100%);
    min-height: 100vh;
}

.tpt-ai-generator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.tpt-ai-generator-container h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tpt-text);
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(135deg, var(--tpt-primary), var(--tpt-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tpt-generator-description {
    text-align: center;
    color: var(--tpt-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Form Container */
.tpt-generation-form {
    background: var(--tpt-background);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius-lg);
    padding: 2rem;
    box-shadow: var(--tpt-shadow);
    transition: var(--tpt-transition);
}

.tpt-generation-form:hover {
    box-shadow: var(--tpt-shadow-lg);
    transform: translateY(-2px);
}

.tpt-generation-form .form-table {
    margin: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 1rem;
}

.tpt-generation-form .form-table th,
.tpt-generation-form .form-table td {
    border: none;
    padding: 1.5rem 1rem;
    vertical-align: top;
    background: transparent;
}

.tpt-generation-form .form-table th {
    font-weight: 600;
    color: var(--tpt-text);
    font-size: 1rem;
    text-align: left;
    width: 200px;
    padding-right: 2rem;
}

.tpt-generation-form .form-table td {
    padding-left: 0;
}

/* Form Groups */
.tpt-form-group {
    background: var(--tpt-surface);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--tpt-transition);
}

.tpt-form-group:hover {
    border-color: var(--tpt-primary);
    background: rgba(37, 99, 235, 0.02);
}

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

.tpt-form-group .description {
    color: var(--tpt-text-muted);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Form Inputs */
.tpt-generation-form input[type="text"],
.tpt-generation-form input[type="number"],
.tpt-generation-form select,
.tpt-generation-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--tpt-border);
    border-radius: var(--tpt-radius);
    font-size: 1rem;
    line-height: 1.5;
    transition: var(--tpt-transition);
    background: var(--tpt-background);
    color: var(--tpt-text);
    box-sizing: border-box;
}

.tpt-generation-form input[type="text"]:focus,
.tpt-generation-form input[type="number"]:focus,
.tpt-generation-form select:focus,
.tpt-generation-form textarea:focus {
    outline: none;
    border-color: var(--tpt-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tpt-generation-form textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.tpt-generation-form select {
    cursor: pointer;
    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;
}

/* Submit Button */
.tpt-generation-form .button {
    background: linear-gradient(135deg, var(--tpt-primary), var(--tpt-primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--tpt-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tpt-transition);
    box-shadow: var(--tpt-shadow);
    width: 100%;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.tpt-generation-form .button:hover {
    transform: translateY(-2px);
    box-shadow: var(--tpt-shadow-lg);
    background: linear-gradient(135deg, var(--tpt-primary-dark), var(--tpt-primary));
}

.tpt-generation-form .button:active {
    transform: translateY(0);
}

.tpt-generation-form .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status Messages */
.tpt-generation-status {
    background: var(--tpt-background);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    text-align: center;
    box-shadow: var(--tpt-shadow);
}

.tpt-generation-status h3 {
    color: var(--tpt-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tpt-status-message {
    font-size: 1.1rem;
    color: var(--tpt-text);
    margin-bottom: 1.5rem;
}

.tpt-progress-container {
    background: var(--tpt-surface);
    border-radius: var(--tpt-radius);
    padding: 1rem;
    margin: 1rem 0;
}

.tpt-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--tpt-border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tpt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tpt-primary), var(--tpt-success));
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
}

.tpt-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite;
}

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

/* Success/Error Messages */
.tpt-notice {
    padding: 1rem 1.5rem;
    border-radius: var(--tpt-radius);
    margin: 1rem 0;
    font-weight: 500;
}

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

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

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

/* Generator History */
.tpt-generator-history-section {
    margin-top: 3rem;
}

.tpt-generator-history-section h2 {
    font-size: 2rem;
    color: var(--tpt-text);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tpt-generation-history {
    background: var(--tpt-background);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius-lg);
    overflow: hidden;
    box-shadow: var(--tpt-shadow);
}

.tpt-generation-history .wp-list-table {
    margin: 0;
}

.tpt-generation-history .wp-list-table thead th {
    background: var(--tpt-surface);
    border-bottom: 2px solid var(--tpt-border);
    font-weight: 600;
    color: var(--tpt-text);
    padding: 1rem;
    font-size: 0.95rem;
}

.tpt-generation-history .wp-list-table tbody tr {
    transition: var(--tpt-transition);
}

.tpt-generation-history .wp-list-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.02);
}

.tpt-generation-history .wp-list-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--tpt-border);
    color: var(--tpt-text);
}

.tpt-generation-history .wp-list-table tbody td:last-child {
    border-bottom: none;
}

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

.tpt-status-planning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--tpt-warning);
}

.tpt-status-generating {
    background: rgba(37, 99, 235, 0.1);
    color: var(--tpt-primary);
}

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

.tpt-status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--tpt-error);
}

/* Pen Name Manager Link */
.tpt-pen-name-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--tpt-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--tpt-transition);
}

.tpt-pen-name-link:hover {
    color: var(--tpt-primary-dark);
    text-decoration: underline;
}

.tpt-pen-name-link::after {
    content: '→';
    font-size: 0.875rem;
    transition: var(--tpt-transition);
}

.tpt-pen-name-link:hover::after {
    transform: translateX(2px);
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    .tpt-ai-generator-frontend-wrapper {
        padding: 1rem;
    }

    .tpt-ai-generator-container {
        padding: 1rem;
        gap: 1.5rem;
    }

    .tpt-ai-generator-container h2 {
        font-size: 2rem;
    }

    .tpt-generator-description {
        font-size: 1rem;
    }

    .tpt-generation-form {
        padding: 1.5rem;
    }

    .tpt-generation-form .form-table th,
    .tpt-generation-form .form-table td {
        display: block;
        width: 100%;
        padding: 0.75rem 0;
    }

    .tpt-generation-form .form-table th {
        padding-bottom: 0.5rem;
        font-size: 1.1rem;
    }

    .tpt-generation-form .form-table td {
        padding-top: 0;
    }

    .tpt-form-group {
        padding: 1rem;
    }

    .tpt-generation-status {
        padding: 1.5rem;
    }

    .tpt-generation-history .wp-list-table {
        font-size: 0.875rem;
    }

    .tpt-generation-history .wp-list-table thead {
        display: none;
    }

    .tpt-generation-history .wp-list-table tbody tr {
        display: block;
        border: 1px solid var(--tpt-border);
        border-radius: var(--tpt-radius);
        margin-bottom: 1rem;
        padding: 1rem;
        background: var(--tpt-background);
    }

    .tpt-generation-history .wp-list-table tbody td {
        display: block;
        border: none;
        padding: 0.5rem 0;
        position: relative;
        padding-left: 120px;
    }

    .tpt-generation-history .wp-list-table tbody td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        top: 0.5rem;
        font-weight: 600;
        color: var(--tpt-text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
    }
}

@media (min-width: 769px) {
    .tpt-ai-generator-container {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .tpt-generator-form-section {
        grid-column: 1;
    }

    .tpt-generator-history-section {
        grid-column: 2;
    }
}

@media (min-width: 1024px) {
    .tpt-ai-generator-container {
        grid-template-columns: 2fr 1fr;
        gap: 3rem;
    }
}

.tpt-generation-form {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.tpt-generation-form .form-table th {
    padding: 15px 10px 15px 0;
    width: 140px;
}

.tpt-generation-form .form-table td {
    padding: 15px 10px 15px 0;
}

.tpt-generation-form textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}

.tpt-generation-form .description {
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

#generation-status {
    color: #007cba;
    font-weight: 500;
}

#generation-status .spinner {
    float: none;
    margin: 0 8px 0 0;
}

/* Generation History */
.tpt-generation-history {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    overflow: hidden;
}

.tpt-generation-history .wp-list-table {
    margin: 0;
}

.tpt-generation-history .wp-list-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e1e1e1;
    font-weight: 600;
    color: #23282d;
}

.tpt-generation-history .wp-list-table tbody tr:hover {
    background: #f8f9fa;
}

.tpt-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tpt-status-planning {
    background: #e1f5fe;
    color: #0277bd;
}

.tpt-status-generating {
    background: #fff3e0;
    color: #f57c00;
}

.tpt-status-completed {
    background: #e8f5e8;
    color: #2e7d32;
}

.tpt-status-failed {
    background: #ffebee;
    color: #c62828;
}

/* Mobile-First Responsive Design */

/* Base mobile styles */
.tpt-ai-generator-container {
    display: block;
    gap: 20px;
    margin-top: 20px;
}

.tpt-generator-form-section,
.tpt-generator-history-section {
    width: 100%;
    margin-bottom: 30px;
}

/* Form enhancements for mobile */
.tpt-generation-form .form-table {
    width: 100%;
}

.tpt-generation-form .form-table th {
    display: block;
    width: 100%;
    padding: 15px 0 8px 0;
    text-align: left;
    font-weight: 600;
    font-size: 16px;
    border-bottom: none;
}

.tpt-generation-form .form-table td {
    display: block;
    padding: 0 0 20px 0;
    border-bottom: none;
}

.tpt-generation-form .form-table tr {
    display: block;
    border: none;
    margin-bottom: 15px;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
}

.tpt-generation-form textarea {
    width: 100%;
    min-height: 120px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
}

.tpt-generation-form input[type="text"],
.tpt-generation-form input[type="number"],
.tpt-generation-form select {
    width: 100%;
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

/* Button improvements for mobile */
.tpt-generation-form .button {
    min-height: 48px;
    padding: 0 24px;
    font-size: 16px;
    width: 100%;
    margin-top: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tpt-generation-form .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Status messages for mobile */
#generation-status {
    color: #007cba;
    font-weight: 500;
    padding: 15px;
    background: #e7f5ff;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 16px;
    text-align: center;
}

/* History table mobile optimization */
.tpt-generation-history .wp-list-table {
    font-size: 14px;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.tpt-generation-history .wp-list-table th,
.tpt-generation-history .wp-list-table td {
    padding: 12px 8px;
    display: block;
    text-align: left;
    border: none;
    background: transparent;
}

.tpt-generation-history .wp-list-table thead {
    display: none;
}

.tpt-generation-history .wp-list-table tbody tr {
    border: 1px solid #e1e1e1;
    margin-bottom: 15px;
    display: block;
    padding: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.tpt-generation-history .wp-list-table tbody tr:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tpt-generation-history .wp-list-table tbody td {
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding: 12px 15px;
}

.tpt-generation-history .wp-list-table tbody td:last-child {
    border-bottom: none;
}

.tpt-generation-history .wp-list-table tbody td:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #666;
    display: inline-block;
    min-width: 120px;
    font-size: 14px;
}

/* Status badges for mobile */
.tpt-status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

/* Progress bar mobile optimization */
.tpt-progress-bar {
    width: 100%;
    height: 12px;
    background: #e1e1e1;
    border-radius: 6px;
    overflow: hidden;
    margin: 15px 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.tpt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #00a0d2);
    transition: width 0.3s ease;
    border-radius: 6px;
}

/* Frontend wrapper mobile optimization */
.tpt-ai-generator-frontend-wrapper {
    max-width: 100%;
    margin: 20px auto;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tpt-ai-generator-frontend-wrapper h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
    text-align: center;
}

/* Form sections for mobile */
.tpt-ai-generator-container {
    padding: 0;
}

.tpt-generation-form {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Touch-friendly interactions */
@media (hover: hover) and (pointer: fine) {
    .tpt-generation-form .button:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    .tpt-generation-history .wp-list-table tbody tr:hover {
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
}

/* Large mobile screens (tablets) */
@media (min-width: 768px) {
    .tpt-ai-generator-container {
        display: flex;
        flex-direction: row;
        gap: 30px;
    }

    .tpt-generator-form-section,
    .tpt-generator-history-section {
        flex: 1;
        min-width: 300px;
    }

    .tpt-ai-generator-frontend-wrapper {
        max-width: 900px;
        padding: 30px;
    }

    .tpt-generation-form .form-table tr {
        display: table-row;
        border: none;
        margin-bottom: 0;
        padding: 0;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    .tpt-generation-form .form-table th {
        display: table-cell;
        width: 140px;
        padding: 15px 10px 15px 0;
        border-bottom: 1px solid #f0f0f0;
        vertical-align: top;
    }

    .tpt-generation-form .form-table td {
        display: table-cell;
        padding: 15px 10px 15px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .tpt-generation-history .wp-list-table {
        font-size: 14px;
    }

    .tpt-generation-history .wp-list-table th,
    .tpt-generation-history .wp-list-table td {
        display: table-cell;
        padding: 12px 8px;
        border: 1px solid #e1e1e1;
    }

    .tpt-generation-history .wp-list-table thead {
        display: table-header-group;
    }

    .tpt-generation-history .wp-list-table tbody tr {
        display: table-row;
        border: 1px solid #e1e1e1;
        margin-bottom: 0;
        padding: 0;
        box-shadow: none;
    }

    .tpt-generation-history .wp-list-table tbody td:before {
        display: none;
    }
}

/* Extra large screens */
@media (min-width: 1024px) {
    .tpt-ai-generator-frontend-wrapper {
        max-width: 1000px;
    }

    .tpt-generator-form-section,
    .tpt-generator-history-section {
        min-width: 400px;
    }
}

/* Loading States */
.tpt-generation-form.generating {
    opacity: 0.7;
    pointer-events: none;
}

.tpt-generation-form.generating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* Progress Indicators */
.tpt-progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e1e1;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.tpt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #00a0d2);
    transition: width 0.3s ease;
}

/* Button Styles */
.tpt-generation-form .button {
    min-height: 36px;
    padding: 0 24px;
}

.tpt-generation-form .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Admin Notices */
.notice-tpt-ai-generator {
    border-left: 4px solid #007cba;
}

.notice-tpt-ai-generator.notice-success {
    border-left-color: #46b450;
}

.notice-tpt-ai-generator.notice-error {
    border-left-color: #dc3232;
}

/* Modal Styles (for future detailed views) */
.tpt-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: none;
}

.tpt-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpt-modal {
    background: #fff;
    border-radius: 6px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.tpt-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tpt-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.tpt-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpt-modal-body {
    padding: 24px;
}

.tpt-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e1e1e1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.tpt-ai-generator-container > div {
    animation: fadeIn 0.3s ease-out;
}

/* Mobile-Specific Enhancements */
.field-error {
    border-color: #dc3232 !important;
    background-color: #ffeaea !important;
}

.field-updated {
    animation: fieldUpdate 0.3s ease-out;
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.touch-active {
    transform: scale(0.98) !important;
    opacity: 0.9 !important;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes fieldUpdate {
    0% { background-color: transparent; }
    50% { background-color: #e7f5ff; }
    100% { background-color: transparent; }
}

/* Modern Hero Section */
.tpt-hero-section {
    background: linear-gradient(135deg, var(--tpt-primary) 0%, var(--tpt-primary-dark) 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--tpt-radius-lg) var(--tpt-radius-lg);
    margin-bottom: 3rem;
}

.tpt-hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.1;
}

.tpt-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.tpt-hero-icon {
    margin-bottom: 2rem;
    animation: float 3s ease-in-out infinite;
}

.tpt-hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tpt-hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.9;
    line-height: 1.6;
}

.tpt-hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.tpt-stat {
    text-align: center;
}

.tpt-stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tpt-stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tpt-hero-decoration {
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    opacity: 0.1;
    animation: float 4s ease-in-out infinite;
}

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

/* Main Container */
.tpt-main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Progress Steps */
.tpt-progress-steps {
    margin-bottom: 3rem;
}

.tpt-steps-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.tpt-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.4;
    transition: var(--tpt-transition);
}

.tpt-step.active {
    opacity: 1;
}

.tpt-step.completed {
    opacity: 1;
}

.tpt-step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tpt-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tpt-text);
    transition: var(--tpt-transition);
}

.tpt-step.active .tpt-step-icon {
    background: var(--tpt-primary);
    color: white;
}

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

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

.tpt-step-connector {
    flex: 1;
    height: 2px;
    background: var(--tpt-border);
    position: relative;
}

.tpt-step-connector::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--tpt-primary);
    transition: width 0.3s ease;
    width: 0;
}

.tpt-step.completed + .tpt-step-connector::after {
    width: 100%;
}

/* Content Grid */
.tpt-content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 3rem;
    align-items: start;
}

/* Cards */
.tpt-form-card,
.tpt-history-card,
.tpt-features-card,
.tpt-wizard-card,
.tpt-status-card,
.tpt-result-card {
    background: var(--tpt-background);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius-lg);
    box-shadow: var(--tpt-shadow);
    overflow: hidden;
    transition: var(--tpt-transition);
}

.tpt-form-card:hover,
.tpt-history-card:hover,
.tpt-features-card:hover,
.tpt-wizard-card:hover {
    box-shadow: var(--tpt-shadow-lg);
    transform: translateY(-2px);
}

.tpt-card-header {
    padding: 2rem;
    border-bottom: 1px solid var(--tpt-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tpt-card-icon {
    flex-shrink: 0;
}

.tpt-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--tpt-text);
    margin: 0;
}

.tpt-card-subtitle {
    color: var(--tpt-text-muted);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

/* Form Card Specific */
.tpt-form-card .tpt-card-header {
    background: linear-gradient(135deg, var(--tpt-surface), rgba(37, 99, 235, 0.02));
}

/* Status Card */
.tpt-status-card {
    border-color: var(--tpt-primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.02), rgba(37, 99, 235, 0.05));
}

.tpt-status-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--tpt-primary), var(--tpt-primary-dark));
    color: white;
}

.tpt-status-icon {
    animation: spin 2s linear infinite;
}

.tpt-status-icon.generating svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tpt-status-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.tpt-status-message {
    margin: 0;
    opacity: 0.9;
}

.tpt-progress-section {
    padding: 2rem;
}

.tpt-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tpt-progress-label {
    font-weight: 500;
    color: var(--tpt-text);
}

.tpt-progress-percentage {
    font-weight: 700;
    color: var(--tpt-primary);
    font-size: 1.1rem;
}

.tpt-progress-container {
    background: var(--tpt-surface);
    border-radius: var(--tpt-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.tpt-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--tpt-border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.tpt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tpt-primary), var(--tpt-success));
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tpt-progress-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.tpt-progress-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tpt-progress-step {
    font-size: 0.9rem;
    color: var(--tpt-text-muted);
    padding: 0.25rem 0;
    border-left: 3px solid transparent;
    padding-left: 0.75rem;
    transition: var(--tpt-transition);
    opacity: 0.6;
}

.tpt-progress-step.active {
    color: var(--tpt-primary);
    border-left-color: var(--tpt-primary);
    opacity: 1;
    font-weight: 500;
}

/* Result Card */
.tpt-result-card {
    border-color: var(--tpt-success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02), rgba(16, 185, 129, 0.05));
}

.tpt-result-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--tpt-success), #059669);
    color: white;
}

.tpt-result-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.tpt-result-message {
    margin: 0;
    opacity: 0.9;
}

.tpt-result-actions {
    padding: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tpt-result-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--tpt-radius);
    font-weight: 500;
    text-decoration: none;
    transition: var(--tpt-transition);
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
}

.tpt-result-button.primary {
    background: var(--tpt-primary);
    color: white;
}

.tpt-result-button.primary:hover {
    background: var(--tpt-primary-dark);
    transform: translateY(-1px);
}

.tpt-result-button.secondary {
    background: var(--tpt-surface);
    color: var(--tpt-text);
    border: 1px solid var(--tpt-border);
}

.tpt-result-button.secondary:hover {
    background: var(--tpt-border);
}

/* Sidebar Cards */
.tpt-history-card .tpt-card-header,
.tpt-features-card .tpt-card-header,
.tpt-wizard-card .tpt-card-header {
    padding: 1.5rem;
}

.tpt-history-card .tpt-generation-history,
.tpt-features-list,
.tpt-wizard-description {
    padding: 1.5rem;
}

.tpt-features-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tpt-feature-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.tpt-feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.tpt-feature-content h5 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--tpt-text);
}

.tpt-feature-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--tpt-text-muted);
    line-height: 1.4;
}

.tpt-wizard-description {
    color: var(--tpt-text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.tpt-wizard-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--tpt-primary), var(--tpt-primary-dark));
    color: white;
    text-decoration: none;
    border-radius: var(--tpt-radius);
    font-weight: 500;
    transition: var(--tpt-transition);
}

.tpt-wizard-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--tpt-shadow);
}

/* Login/Permission Cards */
.tpt-login-prompt-card,
.tpt-permission-denied-card {
    max-width: 500px;
    margin: 4rem auto;
    text-align: center;
    background: var(--tpt-background);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius-lg);
    padding: 3rem 2rem;
    box-shadow: var(--tpt-shadow);
}

.tpt-login-icon,
.tpt-permission-icon {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.tpt-login-prompt-card h3,
.tpt-permission-denied-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--tpt-text);
    margin-bottom: 1rem;
}

.tpt-login-prompt-card p,
.tpt-permission-denied-card p {
    color: var(--tpt-text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.tpt-login-button,
.tpt-home-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--tpt-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--tpt-radius);
    font-weight: 500;
    transition: var(--tpt-transition);
}

.tpt-login-button:hover,
.tpt-home-button:hover {
    background: var(--tpt-primary-dark);
    transform: translateY(-1px);
}

/* Form Enhancements */
.tpt-generation-form {
    padding: 2rem;
}

.tpt-generation-form .form-table {
    margin: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 1rem;
}

.tpt-generation-form .form-table th,
.tpt-generation-form .form-table td {
    border: none;
    padding: 1rem 0;
    vertical-align: top;
}

.tpt-generation-form .form-table th {
    font-weight: 600;
    color: var(--tpt-text);
    font-size: 1rem;
    text-align: left;
    width: 200px;
    padding-right: 2rem;
}

.tpt-generation-form .form-table td {
    padding-left: 0;
}

/* Input Enhancements */
.tpt-generation-form input[type="text"],
.tpt-generation-form input[type="number"],
.tpt-generation-form select,
.tpt-generation-form textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--tpt-border);
    border-radius: var(--tpt-radius);
    font-size: 1rem;
    line-height: 1.5;
    transition: var(--tpt-transition);
    background: var(--tpt-background);
    color: var(--tpt-text);
    box-sizing: border-box;
}

.tpt-generation-form input[type="text"]:focus,
.tpt-generation-form input[type="number"]:focus,
.tpt-generation-form select:focus,
.tpt-generation-form textarea:focus {
    outline: none;
    border-color: var(--tpt-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tpt-generation-form textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.tpt-generation-form select {
    cursor: pointer;
    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;
}

/* Submit Button Enhancement */
.tpt-generation-form .button {
    background: linear-gradient(135deg, var(--tpt-primary), var(--tpt-primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--tpt-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tpt-transition);
    box-shadow: var(--tpt-shadow);
    width: 100%;
    text-align: center;
    display: inline-block;
    text-decoration: none;
    margin-top: 1rem;
}

.tpt-generation-form .button:hover {
    transform: translateY(-2px);
    box-shadow: var(--tpt-shadow-lg);
}

.tpt-generation-form .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* History Table Enhancement */
.tpt-generation-history {
    background: var(--tpt-background);
    border: 1px solid var(--tpt-border);
    border-radius: var(--tpt-radius-lg);
    overflow: hidden;
    box-shadow: var(--tpt-shadow);
}

.tpt-generation-history .wp-list-table {
    margin: 0;
}

.tpt-generation-history .wp-list-table thead th {
    background: var(--tpt-surface);
    border-bottom: 2px solid var(--tpt-border);
    font-weight: 600;
    color: var(--tpt-text);
    padding: 1rem;
    font-size: 0.95rem;
}

.tpt-generation-history .wp-list-table tbody tr {
    transition: var(--tpt-transition);
}

.tpt-generation-history .wp-list-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.02);
}

.tpt-generation-history .wp-list-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--tpt-border);
    color: var(--tpt-text);
}

.tpt-generation-history .wp-list-table tbody td:last-child {
    border-bottom: none;
}

/* Status Badges Enhancement */
.tpt-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.tpt-status-planning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--tpt-warning);
}

.tpt-status-generating {
    background: rgba(37, 99, 235, 0.1);
    color: var(--tpt-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

.tpt-status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--tpt-error);
}

.tpt-status-cancelled {
    background: rgba(156, 163, 175, 0.1);
    color: var(--tpt-secondary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tpt-content-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .tpt-sidebar {
        order: -1;
    }

    .tpt-hero-title {
        font-size: 2.5rem;
    }

    .tpt-hero-stats {
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .tpt-ai-generator-frontend-wrapper {
        padding: 1rem;
    }

    .tpt-hero-section {
        padding: 3rem 1rem;
        margin-bottom: 2rem;
    }

    .tpt-hero-title {
        font-size: 2rem;
    }

    .tpt-hero-subtitle {
        font-size: 1rem;
    }

    .tpt-hero-stats {
        gap: 1.5rem;
    }

    .tpt-stat-number {
        font-size: 2rem;
    }

    .tpt-main-container {
        padding: 0 1rem;
    }

    .tpt-steps-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tpt-step-connector {
        display: none;
    }

    .tpt-content-grid {
        gap: 1.5rem;
    }

    .tpt-form-card,
    .tpt-history-card,
    .tpt-features-card,
    .tpt-wizard-card,
    .tpt-status-card,
    .tpt-result-card {
        border-radius: var(--tpt-radius);
    }

    .tpt-card-header {
        padding: 1.5rem;
    }

    .tpt-card-title {
        font-size: 1.25rem;
    }

    .tpt-generation-form {
        padding: 1.5rem;
    }

    .tpt-status-header,
    .tpt-result-header {
        padding: 1.5rem;
    }

    .tpt-progress-section,
    .tpt-result-actions {
        padding: 1.5rem;
    }

    .tpt-history-card .tpt-generation-history,
    .tpt-features-list,
    .tpt-wizard-description {
        padding: 1rem;
    }

    .tpt-login-prompt-card,
    .tpt-permission-denied-card {
        margin: 2rem auto;
        padding: 2rem 1.5rem;
    }

    .tpt-generation-history .wp-list-table thead th,
    .tpt-generation-history .wp-list-table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .tpt-generation-history .wp-list-table tbody tr {
        display: block;
        border: 1px solid var(--tpt-border);
        border-radius: var(--tpt-radius);
        margin-bottom: 1rem;
        padding: 0;
        background: var(--tpt-background);
    }

    .tpt-generation-history .wp-list-table tbody td {
        display: block;
        border: none;
        padding: 0.5rem 1rem;
        position: relative;
        padding-left: 120px;
    }

    .tpt-generation-history .wp-list-table tbody td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 1rem;
        top: 0.5rem;
        font-weight: 600;
        color: var(--tpt-text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
    }

    .tpt-result-actions {
        flex-direction: column;
    }

    .tpt-result-button {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .tpt-hero-section {
        padding: 2rem 1rem;
    }

    .tpt-hero-title {
        font-size: 1.75rem;
    }

    .tpt-hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .tpt-stat-number {
        font-size: 1.75rem;
    }

    .tpt-form-card,
    .tpt-history-card,
    .tpt-features-card,
    .tpt-wizard-card,
    .tpt-status-card,
    .tpt-result-card {
        margin: 0 -0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .tpt-generation-form .form-table th,
    .tpt-generation-form .form-table td {
        display: block;
        width: 100%;
        padding: 0.5rem 0;
    }

    .tpt-generation-form .form-table th {
        padding-bottom: 0.25rem;
        font-size: 0.95rem;
    }

    .tpt-generation-form .form-table td {
        padding-top: 0;
    }

    .tpt-features-list {
        gap: 1rem;
    }

    .tpt-feature-item {
        gap: 0.75rem;
    }
}

/* Utility Classes */
.tpt-text-center { text-align: center; }
.tpt-text-left { text-align: left; }
.tpt-text-right { text-align: right; }
.tpt-mt-1 { margin-top: 0.25rem; }
.tpt-mt-2 { margin-top: 0.5rem; }
.tpt-mt-3 { margin-top: 1rem; }
.tpt-mb-1 { margin-bottom: 0.25rem; }
.tpt-mb-2 { margin-bottom: 0.5rem; }
.tpt-mb-3 { margin-bottom: 1rem; }
