/* CWP Blog Agent Admin Styles */
.cwp-blog-agent-admin {
    max-width: 1200px;
}

.cwp-admin-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.cwp-admin-main {
    flex: 1;
}

.cwp-admin-sidebar {
    width: 400px;
    flex-shrink: 0;
}

.cwp-admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cwp-generation-full-width {
    margin-bottom: 20px;
}

.cwp-admin-card {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cwp-admin-card h2 {
    margin-top: 0;
    margin-left: -20px;
    margin-right: -20px;
    color: #2c3e50;
    font-size: 1.3rem;
    border-bottom: 2px solid #7f31ff;
    padding: 0 20px 10px 20px;
}

/* Form Styles */
.cwp-admin-card textarea {
    width: 100%;
    min-height: 100px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    transition: border-color 0.3s ease;
}

/* Context textarea - większy rozmiar */
.cwp-admin-card textarea[name="context"] {
    min-height: 200px;
    font-size: 15px;
    line-height: 1.5;
    padding: 12px 15px;
}

/* Token Slider Styles */
.cwp-token-slider-container {
    margin: 10px 0;
}

.cwp-token-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 10px 0;
}

.cwp-token-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #7f31ff 0%, #4279f1 100%);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.cwp-token-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(127, 49, 255, 0.4);
}

.cwp-token-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #7f31ff 0%, #4279f1 100%);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.cwp-token-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(127, 49, 255, 0.4);
}

.cwp-token-display {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #7f31ff;
    margin: 10px 0;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(127, 49, 255, 0.1) 0%, rgba(66, 121, 241, 0.1) 100%);
    border-radius: 20px;
    border: 1px solid rgba(127, 49, 255, 0.2);
    display: inline-block;
}

.cwp-token-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
}

.cwp-admin-card textarea:focus {
    border-color: #7f31ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(127, 49, 255, 0.1);
}

.cwp-generate-btn {
    background: linear-gradient(135deg, #7f31ff 0%, #4279f1 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cwp-generate-btn:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #3b82f6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(127, 49, 255, 0.3);
}

.cwp-generate-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cwp-generate-btn .dashicons {
    font-size: 16px;
}

/* Result Area */
.cwp-result-area {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #7f31ff;
}

.cwp-result-area.success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.cwp-result-area.error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.cwp-result-area.loading {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.cwp-result-links {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.cwp-result-links a {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cwp-result-links .edit-link {
    background: #7f31ff;
    color: white;
}

.cwp-result-links .edit-link:hover {
    background: #6d28d9;
    color: white;
}

.cwp-result-links .view-link {
    background: #e9ecef;
    color: #495057;
}

.cwp-result-links .view-link:hover {
    background: #dee2e6;
    color: #495057;
}

/* Statistics */
.cwp-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.cwp-stat-item {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(127, 49, 255, 0.1) 0%, rgba(66, 121, 241, 0.1) 100%);
    border-radius: 8px;
    border: 1px solid rgba(127, 49, 255, 0.2);
}

.cwp-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #7f31ff;
    margin-bottom: 5px;
}

.cwp-stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Recent Posts */
.cwp-recent-posts {
    grid-column: 1 / -1;
}

/* Post Preview */
.cwp-post-preview {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.cwp-no-preview {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 20px;
}

.cwp-preview-content {
    max-height: 600px;
    overflow-y: auto;
}

.cwp-preview-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.3;
}

.cwp-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.cwp-preview-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.cwp-preview-meta-item i {
    color: #7f31ff;
    font-size: 0.8rem;
}

.cwp-preview-status {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.cwp-preview-status.status-publish {
    background: #d4edda;
    color: #155724;
}

.cwp-preview-status.status-draft {
    background: #fff3cd;
    color: #856404;
}

.cwp-preview-status.status-private {
    background: #f8d7da;
    color: #721c24;
}

.cwp-preview-excerpt {
    color: #7f8c8d;
    font-style: italic;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #7f31ff;
}

.cwp-preview-content-text {
    line-height: 1.6;
    color: #2c3e50;
}

.cwp-preview-content-text h2,
.cwp-preview-content-text h3 {
    color: #7f31ff;
    margin-top: 20px;
    margin-bottom: 10px;
}

.cwp-preview-content-text h2 {
    font-size: 1.3rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 5px;
}

.cwp-preview-content-text h3 {
    font-size: 1.1rem;
}

.cwp-preview-content-text p {
    margin-bottom: 15px;
}

.cwp-preview-content-text ul,
.cwp-preview-content-text ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

.cwp-preview-content-text li {
    margin-bottom: 5px;
}

.cwp-preview-content-text strong {
    color: #7f31ff;
    font-weight: 600;
}

.cwp-preview-content-text img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 15px 0;
}

.cwp-preview-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.cwp-preview-actions a {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cwp-preview-edit-link {
    background: #7f31ff;
    color: white;
}

.cwp-preview-edit-link:hover {
    background: #6d28d9;
    color: white;
}

.cwp-preview-view-link {
    background: #e9ecef;
    color: #495057;
}

.cwp-preview-view-link:hover {
    background: #dee2e6;
    color: #495057;
}

.cwp-preview-tags {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.cwp-preview-tags-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 8px;
    font-weight: 600;
}

.cwp-preview-tag {
    display: inline-block;
    background: linear-gradient(135deg, rgba(127, 49, 255, 0.1) 0%, rgba(66, 121, 241, 0.1) 100%);
    color: #7f31ff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-right: 5px;
    margin-bottom: 5px;
    border: 1px solid rgba(127, 49, 255, 0.2);
}

.cwp-posts-list {
    margin-top: 15px;
}

.cwp-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.cwp-post-item:hover {
    background: #f8f9fa;
    border-color: #7f31ff;
}

.cwp-post-item.selected {
    background: linear-gradient(135deg, rgba(127, 49, 255, 0.1) 0%, rgba(66, 121, 241, 0.1) 100%);
    border-color: #7f31ff;
    border-width: 2px;
}

.cwp-post-item.selected .cwp-post-title a {
    color: #7f31ff;
    font-weight: 700;
}

.cwp-post-title a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
}

.cwp-post-title a:hover {
    color: #7f31ff;
}

.cwp-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #7f31ff 0%, #4279f1 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.cwp-ai-badge i {
    font-size: 0.6rem;
}

.cwp-post-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.cwp-post-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.cwp-post-status.status-publish {
    background: #d4edda;
    color: #155724;
}

.cwp-post-status.status-draft {
    background: #fff3cd;
    color: #856404;
}

.cwp-post-status.status-private {
    background: #f8d7da;
    color: #721c24;
}

.cwp-post-date {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Loading Animation */
.cwp-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7f31ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .cwp-admin-layout {
        flex-direction: column;
    }
    
    .cwp-admin-sidebar {
        width: 100%;
        order: -1;
    }
    
    .cwp-post-preview {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .cwp-admin-grid {
        grid-template-columns: 1fr;
    }
    
    .cwp-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .cwp-post-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cwp-post-meta {
        width: 100%;
        justify-content: space-between;
    }
    
    .cwp-preview-actions {
        flex-direction: column;
    }
    
    .cwp-preview-actions a {
        justify-content: center;
    }
}

/* Form Table Improvements */
.form-table th {
    width: 150px;
    padding: 15px 10px 15px 0;
}

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

.form-table input[type="text"],
.form-table input[type="password"],
.form-table select {
    width: 100%;
    max-width: 400px;
}

/* Success/Error Messages */
.notice {
    margin: 15px 0;
    padding: 12px;
    border-radius: 4px;
}

.notice-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.notice-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

/* Progress Bar */
.cwp-progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 0;
}

.cwp-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #7f31ff 0%, #4279f1 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* Tooltips */
.cwp-tooltip {
    position: relative;
    cursor: help;
}

.cwp-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.cwp-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Image Generation Styles */
.cwp-image-test-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cwp-image-test-section h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 18px;
}

.cwp-image-test-section p {
    margin-bottom: 15px;
    color: #666;
}

#test-image-description {
    margin-right: 10px;
    margin-bottom: 10px;
}

#test-image-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

#test-image-result .cwp-success {
    color: #28a745;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 4px;
}

#test-image-result .cwp-error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
}

/* Generated Images */
.cwp-generated-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cwp-generated-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Image placeholder while generating */
.cwp-image-placeholder {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    margin: 20px 0;
    color: #666;
    font-style: italic;
}

.cwp-image-placeholder::before {
    content: "🖼️";
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

/* Bulk image generation styles */
.cwp-bulk-image-section {
    margin-top: 20px;
    padding: 20px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.cwp-bulk-image-section h3 {
    margin-top: 0;
    color: #856404;
    font-size: 18px;
}

.cwp-bulk-image-section p {
    margin-bottom: 15px;
    color: #856404;
}

/* Progress bar styles */
.cwp-progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.cwp-progress-fill {
    height: 100%;
    background-color: #007cba;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-animation 2s infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 50%; }
    100% { width: 100%; }
}

.cwp-progress-text {
    text-align: center;
    margin: 5px 0;
    font-style: italic;
    color: #666;
}

/* Preview image generation styles */
.cwp-preview-image-info {
    background: #f0f6fc;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.cwp-preview-image-info p {
    margin: 0 0 5px 0;
    font-size: 13px;
}

.cwp-preview-image-info .cwp-placeholder-info {
    color: #666;
    font-size: 12px;
}

.cwp-preview-image-actions {
    text-align: center;
}

.cwp-preview-image-actions .button {
    width: 100%;
    margin-bottom: 10px;
}

#cwp-preview-generation-result {
    font-size: 12px;
}

#cwp-preview-generation-result .cwp-success {
    color: #28a745;
    font-weight: bold;
}

#cwp-preview-generation-result .cwp-error {
    color: #dc3545;
    font-weight: bold;
}
