/**
 * MAI Smart Assistant - Automation Page Styles
 *
 * @package MAI_SMART_ASSISTANT
 * @since 1.0.0
 */

/* ========================================
   Page Layout
   ======================================== */
.mai-smart-assistant-automation-page {
    max-width: 1400px;
}

.automation-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.automation-loading .spinner {
    float: none;
    margin: 0;
}

/* ========================================
   Tasks List
   ======================================== */
.tasks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.no-tasks {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 2px dashed #ddd;
    border-radius: 4px;
}

.no-tasks p {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

/* ========================================
   Task Card
   ======================================== */
.task-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.task-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #2271b1;
}

.task-card.disabled {
    opacity: 0.7;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.task-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.task-status {
    flex-shrink: 0;
    margin-left: 10px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.enabled {
    background: #d4edda;
    color: #155724;
}

.status-badge.disabled {
    background: #f8d7da;
    color: #721c24;
}

.task-description {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f1;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.meta-item .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: #8c8f94;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 13px;
}

.task-actions .button .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* ========================================
   Task Modal
   ======================================== */
.mai-smart-assistant-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 160000;
}

.mai-smart-assistant-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.mai-smart-assistant-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.mai-smart-assistant-modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mai-smart-assistant-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.mai-smart-assistant-modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.mai-smart-assistant-modal-close:hover {
    color: #000;
}

.mai-smart-assistant-modal-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.mai-smart-assistant-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.mai-smart-assistant-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ========================================
   Form Fields
   ======================================== */
.mai-smart-assistant-field {
    margin-bottom: 20px;
}

.mai-smart-assistant-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.mai-smart-assistant-field .required {
    color: #d63638;
}

.mai-smart-assistant-field textarea {
    resize: vertical;
}

/* ========================================
   Content Source Tabs
   ======================================== */
.content-source-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #e5e5e5;
}

.tab-btn.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   Test Result Modal
   ======================================== */
.test-result-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.test-result-stats p {
    margin: 5px 0;
}

.test-result-content {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
}

.test-result-text pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 10px 0 0 0;
    max-height: 400px;
    overflow-y: auto;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1200px) {
    .tasks-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 782px) {
    .tasks-list {
        grid-template-columns: 1fr;
    }

    .mai-smart-assistant-modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .mai-smart-assistant-modal-header,
    .mai-smart-assistant-modal-body,
    .mai-smart-assistant-modal-footer {
        padding: 15px;
    }

    .mai-smart-assistant-modal-footer {
        flex-direction: column;
    }

    .mai-smart-assistant-modal-footer .button {
        width: 100%;
    }

    .task-meta {
        flex-direction: column;
        gap: 10px;
    }

    .task-actions {
        flex-direction: column;
    }

    .task-actions .button {
        width: 100%;
        justify-content: center;
    }

    .content-source-tabs {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .mai-smart-assistant-automation-page {
        margin-right: -10px;
        margin-left: -10px;
    }

    .task-card,
    .automation-loading {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .page-title-action,
    .task-actions,
    .mai-smart-assistant-modal {
        display: none;
    }

    .task-card {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
