/* assets/frontend.css */

/* استایل‌های قبلی */
.bpa-form-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.bpa-form-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.bpa-form-group {
    margin-bottom: 25px;
}

.bpa-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 15px;
}

.bpa-form-group label.required::after {
    content: " *";
    color: #e74c3c;
}

.bpa-form-group input[type="text"],
.bpa-form-group input[type="number"],
.bpa-form-group select,
.bpa-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bpa-form-group input:focus,
.bpa-form-group select:focus,
.bpa-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.bpa-form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.bpa-submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.bpa-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.bpa-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.bpa-error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
}

/* استایل صفحه تولید مرحله‌ای */
.bpa-step-generation {
    margin-top: 30px;
}

.bpa-progress-header {
    text-align: center;
    margin-bottom: 40px;
}

.bpa-progress-header h3 {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 20px;
}

.bpa-progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
}

.bpa-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s ease;
}

.bpa-progress-text {
    color: #7f8c8d;
    font-size: 16px;
    margin-top: 10px;
}

.bpa-steps-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.bpa-step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.bpa-step-item.active {
    border-color: #667eea;
    background: #f0f3ff;
}

.bpa-step-item.completed {
    border-color: #2ecc71;
    background: #e8f8f0;
}

.bpa-step-item.error {
    border-color: #e74c3c;
    background: #ffe8e8;
}

.bpa-step-icon {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.bpa-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #95a5a6;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    transition: all 0.3s ease;
}

.bpa-step-item.active .bpa-step-number {
    background: #667eea;
}

.bpa-step-item.completed .bpa-step-number {
    display: none;
}

.bpa-step-check {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    background: #2ecc71;
    color: white;
    border-radius: 50%;
    display: none; /* اصلاح: تیک به صورت پیش‌فرض مخفی است */
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bpa-step-item.completed .bpa-step-check {
    display: flex; /* تیک فقط در حالت تکمیل شده نمایش داده می‌شود */
}

/* اصلاح: انیمیشن برای لودر */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bpa-step-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite; /* اصلاح: اعمال انیمیشن چرخش */
    display: none;
}

.bpa-step-item.loading .bpa-step-number {
    display: none; /* شماره هنگام لودینگ مخفی می‌شود */
}

.bpa-step-item.loading .bpa-step-loader {
    display: block;
}

.bpa-step-title {
    font-size: 16px;
    color: #555;
    line-height: 1.4;
}

.bpa-step-item.active .bpa-step-title,
.bpa-step-item.completed .bpa-step-title {
    font-weight: 600;
    color: #2c3e50;
}

.bpa-generating-text {
    color: #667eea;
    font-size: 12px;
}

.bpa-step-content {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.bpa-step-preview {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2ecc71;
}

.bpa-step-preview h4 {
    color: #2ecc71;
    margin-bottom: 15px;
    font-size: 18px;
}

.bpa-preview-content {
    color: #555;
    line-height: 1.8;
}

.bpa-preview-content h1,
.bpa-preview-content h2,
.bpa-preview-content h3 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.bpa-preview-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bpa-preview-content table th,
.bpa-preview-content table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: center;
}

.bpa-preview-content table th {
    background: #34495e;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bpa-preview-content table tr:nth-child(even) {
    background: #f8f9fa;
}

.bpa-preview-content table tr:hover {
    background: #f1f1f1;
    transition: background 0.2s ease;
}

.bpa-step-actions {
    text-align: center;
    padding: 30px;
    background: #fff9e6;
    border-radius: 8px;
    border: 2px dashed #f39c12;
}

.bpa-question {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 20px;
    font-weight: 600;
}

.bpa-action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.bpa-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bpa-btn-success {
    background: #2ecc71;
    color: white;
}

.bpa-btn-success:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.bpa-btn-secondary {
    background: #95a5a6;
    color: white;
}

.bpa-btn-secondary:hover {
    background: #7f8c8d;
}

.bpa-step-error {
    background: #ffe8e8;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 20px;
}

.error-message {
    color: #e74c3c;
    margin-bottom: 15px;
}

.bpa-retry-btn {
    background: #e74c3c;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.bpa-retry-btn:hover {
    background: #c0392b;
}

.bpa-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}