/* ===============================================
   BUTTON COMPONENTS
   =============================================== */

.agenticwp-settings-section .button,
.agenticwp-modal-footer .button,
.agenticwp-jobs-controls .button,
.agenticwp-writing-directions-toolbar .button {
    display: inline-flex;
    align-items: center;
    gap: var(--agenticwp-space-xs);
    padding: var(--agenticwp-space-sm) var(--agenticwp-space-lg);
    border-radius: var(--agenticwp-radius);
    font-weight: 500;
    font-size: 14px;
    transition: var(--agenticwp-transition);
    position: relative;
    overflow: hidden;
}

.agenticwp-settings-section .button .dashicons,
.agenticwp-modal-footer .button .dashicons,
.agenticwp-jobs-controls .button .dashicons,
.agenticwp-writing-directions-toolbar .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.agenticwp-settings-section .button-primary,
.agenticwp-modal-footer .button-primary {
    background: linear-gradient(135deg, var(--agenticwp-primary) 0%, var(--agenticwp-primary-hover) 100%);
    border-color: var(--agenticwp-primary);
    color: var(--agenticwp-bg-white);
    box-shadow: var(--agenticwp-shadow-primary);
}

.agenticwp-settings-section .button-primary:hover,
.agenticwp-modal-footer .button-primary:hover {
    background: linear-gradient(135deg, var(--agenticwp-primary-hover) 0%, var(--agenticwp-primary-dark) 100%);
    border-color: var(--agenticwp-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
}

.agenticwp-settings-section .button-secondary,
.agenticwp-modal-footer .button-secondary,
.agenticwp-jobs-controls .button-secondary,
.agenticwp-writing-directions-toolbar .button-secondary {
    background: var(--agenticwp-bg-white);
    border-color: #c3c4c7;
    color: var(--agenticwp-text-primary);
    box-shadow: var(--agenticwp-shadow-sm);
}

.agenticwp-settings-section .button-secondary:hover,
.agenticwp-modal-footer .button-secondary:hover,
.agenticwp-jobs-controls .button-secondary:hover,
.agenticwp-writing-directions-toolbar .button-secondary:hover {
    background: var(--agenticwp-bg-gray);
    border-color: var(--agenticwp-text-muted);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.agenticwp-settings-section .button-danger {
    background: var(--agenticwp-bg-white);
    border-color: var(--agenticwp-danger);
    color: var(--agenticwp-danger);
    box-shadow: var(--agenticwp-shadow-danger);
}

.agenticwp-settings-section .button-danger:hover {
    background: var(--agenticwp-danger);
    border-color: var(--agenticwp-danger);
    color: var(--agenticwp-bg-white);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

.agenticwp-settings-section .button.button-pressed,
.agenticwp-modal-footer .button.button-pressed,
.agenticwp-jobs-controls .button.button-pressed,
.agenticwp-writing-directions-toolbar .button.button-pressed {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.agenticwp-settings-section .button.button-focused,
.agenticwp-modal-footer .button.button-focused,
.agenticwp-jobs-controls .button.button-focused,
.agenticwp-writing-directions-toolbar .button.button-focused {
    outline: 2px solid var(--agenticwp-primary);
    outline-offset: 2px;
}

.agenticwp-settings-section .button.loading,
.agenticwp-modal-footer .button.loading,
.agenticwp-jobs-controls .button.loading,
.agenticwp-writing-directions-toolbar .button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.agenticwp-settings-section .button.loading .spin,
.agenticwp-modal-footer .button.loading .spin,
.agenticwp-jobs-controls .button.loading .spin,
.agenticwp-writing-directions-toolbar .button.loading .spin {
    animation: spin 1s linear infinite;
}

.button-link-delete.agenticwp-remove-sample-prompt {
    display: inline-flex;
    align-items: center;
    gap: var(--agenticwp-space-xs);
    padding: var(--agenticwp-space-xs) var(--agenticwp-space-md);
    border: 1px solid var(--agenticwp-danger);
    border-radius: var(--agenticwp-radius-sm);
    background: var(--agenticwp-bg-white);
    color: var(--agenticwp-danger);
    font-weight: 500;
    font-size: 12px;
    text-decoration: none;
    transition: var(--agenticwp-transition);
    box-shadow: var(--agenticwp-shadow-danger);
    cursor: pointer;
}

.button-link-delete.agenticwp-remove-sample-prompt:hover {
    background: var(--agenticwp-danger);
    border-color: var(--agenticwp-danger);
    color: var(--agenticwp-bg-white);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

.button-link-delete.agenticwp-remove-sample-prompt:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.button-link-delete.agenticwp-remove-sample-prompt .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}

/* ===============================================
   FORM COMPONENTS
   =============================================== */

.agenticwp-settings-section input[type="text"],
.agenticwp-settings-section input[type="password"],
.agenticwp-settings-section input[type="number"],
.agenticwp-settings-section select,
.agenticwp-settings-section textarea {
    padding: 10px var(--agenticwp-space-md);
    border: 2px solid var(--agenticwp-border);
    border-radius: var(--agenticwp-radius);
    font-size: 14px;
    transition: var(--agenticwp-transition);
    box-sizing: border-box;
}

.agenticwp-settings-section input[type="text"]:focus,
.agenticwp-settings-section input[type="password"]:focus,
.agenticwp-settings-section input[type="number"]:focus,
.agenticwp-settings-section select:focus,
.agenticwp-settings-section textarea:focus {
    border-color: var(--agenticwp-primary);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
    outline: none;
}

.agenticwp-checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}

.agenticwp-section-dark .agenticwp-checkbox-field {
    background: rgba(255, 255, 255, 0.8);
}

.agenticwp-checkbox-field input[type="checkbox"] {
    margin: 2px 0 0 0;
    width: 18px;
    height: 18px;
}

.agenticwp-checkbox-field-content {
    flex: 1;
}

.agenticwp-checkbox-field-content .description {
    margin-top: 4px;
}

.agenticwp-checkbox-field.agenticwp-disabled {
    opacity: 0.6;
    background: rgba(240, 240, 240, 0.8);
    border-color: #ddd;
    pointer-events: none;
}

.agenticwp-section-dark .agenticwp-checkbox-field.agenticwp-disabled {
    background: rgba(240, 240, 240, 0.9);
}

.agenticwp-checkbox-field.agenticwp-disabled:hover {
    background: rgba(240, 240, 240, 0.8);
    border-color: #ddd;
    box-shadow: none;
    transform: none;
}

.agenticwp-section-dark .agenticwp-checkbox-field.agenticwp-disabled:hover {
    background: rgba(240, 240, 240, 0.9);
}

.agenticwp-checkbox-field.agenticwp-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.agenticwp-checkbox-field.agenticwp-disabled label {
    color: #999;
    cursor: not-allowed;
}

.agenticwp-checkbox-field.agenticwp-disabled .description {
    color: #999;
    font-style: italic;
}

/* ===============================================
   IMAGE SELECTOR COMPONENT
   =============================================== */

.agenticwp-default-image-field {
    background: none;
    border: none;
    padding: 0;
}

.agenticwp-image-selector-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.agenticwp-image-selector-card:hover {
    border-color: #007cba;
    box-shadow: 0 4px 16px rgba(0, 124, 186, 0.15);
    transform: translateY(-2px);
}

.agenticwp-section-dark .agenticwp-image-selector-card {
    background: #fafafa;
    border-color: #d1d5db;
}

.agenticwp-section-dark .agenticwp-image-selector-card:hover {
    background: #ffffff;
    border-color: #007cba;
}

.agenticwp-image-selector-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    position: relative;
}

.agenticwp-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.agenticwp-image-selector-card:hover .agenticwp-preview-img {
    transform: scale(1.05);
}

.agenticwp-image-selector-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.agenticwp-image-selector-info {
    flex: 1;
}

.agenticwp-image-selector-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.3;
}

.agenticwp-image-selector-desc {
    margin: 0;
    font-size: 14px;
    color: #646970;
    line-height: 1.4;
}

.agenticwp-image-selector-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.agenticwp-image-selector-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.agenticwp-image-selector-actions .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.agenticwp-image-selector-actions .button-primary {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    border-color: #007cba;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.3);
}

.agenticwp-image-selector-actions .button-primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004065 100%);
    border-color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
}

.agenticwp-image-selector-actions .agenticwp-remove-default-image {
    background: #ffffff;
    border-color: #dc3545;
    color: #dc3545;
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.2);
}

.agenticwp-image-selector-actions .agenticwp-remove-default-image:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

.agenticwp-image-selector-actions .button.button-pressed {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.agenticwp-default-image-field .description {
    margin-top: 12px;
    font-size: 13px;
    color: #646970;
    font-style: italic;
}

.agenticwp-image-selector-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.agenticwp-image-selector-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===============================================
   MODAL COMPONENTS
   =============================================== */

.agenticwp-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.agenticwp-modal-backdrop.is-visible {
    display: flex !important;
    opacity: 1;
}

.agenticwp-modal-container {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.2s ease-out;
}

.agenticwp-modal-backdrop.is-visible .agenticwp-modal-container {
    transform: translateY(0) scale(1);
}

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

.agenticwp-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.agenticwp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #646970;
    cursor: pointer;
    padding: 4px;
    border-radius: 2px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agenticwp-modal-close:hover {
    color: #1d2327;
    background-color: #f6f7f7;
}

.agenticwp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.agenticwp-modal-body .description {
    margin-bottom: 20px;
    color: #646970;
}

.agenticwp-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #dcdcde;
    background-color: #f6f7f7;
}

.agenticwp-prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.agenticwp-prompt-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.agenticwp-prompt-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #8c8f94;
}

.agenticwp-prompt-card:has(.agenticwp-prompt-card-expanded:visible) {
    cursor: default;
}

.agenticwp-prompt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #f0f0f1;
}

.agenticwp-prompt-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    flex: 1;
    line-height: 1.4;
}

.agenticwp-prompt-card-expand {
    background: none;
    border: none;
    padding: 4px;
    color: #646970;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.agenticwp-prompt-card-expand:hover {
    color: #2271b1;
    background-color: #f0f6fc;
}

.agenticwp-prompt-card-expand .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.agenticwp-prompt-card-preview {
    padding: 12px 16px;
    color: #646970;
    font-size: 13px;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f1;
}

.agenticwp-prompt-card-expanded {
    padding: 16px;
}

.agenticwp-prompt-card-expanded .agenticwp-sample-prompt-field {
    margin-bottom: 16px;
}

.agenticwp-prompt-card-expanded .agenticwp-sample-prompt-field:last-of-type {
    margin-bottom: 12px;
}

.agenticwp-prompt-card-expanded .agenticwp-sample-prompt-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1d2327;
    font-size: 13px;
}

.agenticwp-prompt-card-expanded .agenticwp-sample-prompt-field input,
.agenticwp-prompt-card-expanded .agenticwp-sample-prompt-field textarea {
    width: 100%;
    box-sizing: border-box;
}

.agenticwp-prompt-card-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid #f0f0f1;
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

@media screen and (max-width: 782px) {
    .agenticwp-image-selector-card {
        flex-direction: column;
        text-align: center;
        gap: var(--agenticwp-space-lg);
        padding: var(--agenticwp-space-lg);
    }

    .agenticwp-image-selector-preview {
        width: 120px;
        height: 120px;
        align-self: center;
    }

    .agenticwp-image-selector-content {
        gap: var(--agenticwp-space-md);
    }

    .agenticwp-image-selector-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .agenticwp-image-selector-actions .button {
        min-width: 140px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .agenticwp-modal-container {
        width: 95%;
        max-height: 95vh;
        margin: var(--agenticwp-space-xl);
    }

    .agenticwp-prompts-grid {
        grid-template-columns: 1fr;
        gap: var(--agenticwp-space-md);
        padding: var(--agenticwp-space-lg) 0;
    }

    .agenticwp-modal-header,
    .agenticwp-modal-body,
    .agenticwp-modal-footer {
        padding-left: var(--agenticwp-space-lg);
        padding-right: var(--agenticwp-space-lg);
    }
}

@media (max-width: 480px) {
    .agenticwp-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .agenticwp-modal-footer .button {
        margin-bottom: var(--agenticwp-space-sm);
    }

    .agenticwp-modal-footer .button:last-child {
        margin-bottom: 0;
    }
}

/* ===============================================
   ACTION MANAGER MODAL STYLES
   =============================================== */

.agenticwp-add-action-modal .agenticwp-field-group {
    margin-bottom: var(--agenticwp-space-lg);
}

.agenticwp-add-action-modal .agenticwp-field-group:last-child {
    margin-bottom: 0;
}

.agenticwp-add-action-modal label {
    display: block;
    margin-bottom: var(--agenticwp-space-xs);
    font-weight: 600;
    color: var(--agenticwp-text-dark);
    font-size: 14px;
}

.agenticwp-add-action-modal label .required {
    color: var(--agenticwp-danger);
    font-weight: 700;
}

.agenticwp-add-action-modal .regular-text,
.agenticwp-add-action-modal .large-text {
    width: 100%;
    padding: var(--agenticwp-space-sm) var(--agenticwp-space-md);
    border: 2px solid var(--agenticwp-border);
    border-radius: var(--agenticwp-radius);
    font-size: 14px;
    transition: var(--agenticwp-transition);
    background-color: var(--agenticwp-bg-white);
}

.agenticwp-add-action-modal .regular-text:focus,
.agenticwp-add-action-modal .large-text:focus {
    border-color: var(--agenticwp-primary);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
    outline: none;
}

.agenticwp-add-action-modal .large-text {
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.agenticwp-add-action-modal .description {
    margin-top: var(--agenticwp-space-xs);
    margin-bottom: 0;
    font-size: 13px;
    color: var(--agenticwp-text-muted);
    line-height: 1.4;
}

.agenticwp-add-action-modal .agenticwp-modal-container {
    max-width: 600px;
    width: 95%;
}

.agenticwp-add-action-modal select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='m0,1l2,2l2-2'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.agenticwp-add-action-modal .agenticwp-save-action {
    display: inline-flex;
    align-items: center;
    gap: var(--agenticwp-space-xs);
}

.agenticwp-add-action-modal .agenticwp-save-action .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.agenticwp-add-action-modal .agenticwp-save-action.loading {
    pointer-events: none;
    opacity: 0.8;
}

.agenticwp-add-action-modal .agenticwp-save-action.loading .dashicons {
    animation: spin 1s linear infinite;
}

.agenticwp-add-action-modal .regular-text:invalid,
.agenticwp-add-action-modal .large-text:invalid {
    border-color: var(--agenticwp-danger);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.agenticwp-add-action-modal .field-error {
    display: block;
    margin-top: var(--agenticwp-space-xs);
    color: var(--agenticwp-danger);
    font-size: 12px;
    font-weight: 500;
}