/* AI Smart Excerpt Admin Styles */

.ai-smart-excerpt-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.ai-smart-excerpt-actions .button {
    margin-right: 10px;
}

.ai-smart-excerpt-info {
    margin-top: 30px;
}

.ai-smart-excerpt-info .postbox {
    max-width: 800px;
}

.ai-smart-excerpt-info h3 {
    color: #2271b1;
    margin-top: 20px;
    margin-bottom: 10px;
}

.ai-smart-excerpt-info h3:first-child {
    margin-top: 0;
}

.ai-smart-excerpt-info p {
    margin: 5px 0;
}

.ai-smart-excerpt-info a {
    color: #2271b1;
    text-decoration: none;
}

.ai-smart-excerpt-info a:hover {
    text-decoration: underline;
}

#api-test-result {
    margin-top: 10px;
}

#api-test-result .notice {
    margin: 10px 0 0 0;
    padding: 10px;
}

/* Form styling improvements */
.form-table th {
    width: 200px;
    padding-left: 0;
}

.form-table td {
    padding-left: 20px;
}

.form-table input[type="text"],
.form-table input[type="password"],
.form-table input[type="number"],
.form-table select {
    font-size: 14px;
}

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

/* Section headers */
.form-table tr:first-child th,
.form-table tr:first-child td {
    border-top: none;
}

h2.title {
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 20px;
    color: #1d2327;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: text-top;
}

.status-indicator.active {
    background-color: #00a32a;
}

.status-indicator.inactive {
    background-color: #ddd;
}

.status-indicator.error {
    background-color: #d63638;
}

/* Button improvements */
.button.testing {
    opacity: 0.6;
    pointer-events: none;
}

/* Notice improvements */
.notice {
    border-left: 4px solid;
}

.notice-info {
    border-left-color: #72aee6;
    background-color: #f0f6fc;
}

.notice-success {
    border-left-color: #00a32a;
    background-color: #f0f9f0;
}

.notice-warning {
    border-left-color: #dba617;
    background-color: #fcf9e8;
}

.notice-error {
    border-left-color: #d63638;
    background-color: #fcf0f1;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .form-table th,
    .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .form-table th {
        border-bottom: none;
    }
    
    .ai-smart-excerpt-actions .button {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
        text-align: center;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    float: none;
    margin: 0 5px;
    vertical-align: text-top;
}

/* Field grouping */
.field-group {
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.field-group h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

/* Highlight important settings */
.highlight-setting {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.highlight-setting .dashicons {
    color: #856404;
    margin-right: 5px;
}

/* API key security indicator */
.api-key-security {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.api-key-security .dashicons {
    font-size: 14px;
    vertical-align: text-top;
    margin-right: 3px;
}

.api-key-security.secure {
    color: #00a32a;
}

.api-key-security.insecure {
    color: #d63638;
}

/* Excerpt Status Display */
.ai-smart-excerpt-status {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
}

.excerpt-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.status-item {
    padding: 10px;
    background: #f7f7f7;
    border-radius: 4px;
    border-left: 4px solid #ddd;
}

.status-item.status-active {
    border-left-color: #00a32a;
    background: #f0f9f0;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e1e1e1;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00a32a, #2271b1);
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* Bulk generate button styling */
#bulk-generate {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

#bulk-generate:hover {
    background: #135e96;
    border-color: #135e96;
}

#bulk-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status indicators in forms */
.excerpt-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
}

.excerpt-status-indicator.pending {
    background-color: #f0b849;
}

.excerpt-status-indicator.processing {
    background-color: #2271b1;
    animation: pulse 1.5s infinite;
}

.excerpt-status-indicator.complete {
    background-color: #00a32a;
}

.excerpt-status-indicator.error {
    background-color: #d63638;
}

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

/* Post list integration */
.post-excerpt-status {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.regenerate-excerpt-btn {
    font-size: 11px;
    padding: 2px 6px;
    margin-left: 5px;
}

/* Admin notices improvements */
.notice.ai-excerpt-notice {
    position: relative;
}

.notice.ai-excerpt-notice .notice-dismiss {
    text-decoration: none;
}

/* Loading states */
.excerpt-status-loading {
    opacity: 0.6;
}

.excerpt-status-loading::after {
    content: " ...";
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: " ."; }
    40% { content: " .."; }
    60%, 100% { content: " ..."; }
}

/* Tabbed Interface Styles */
.ai-smart-excerpt-admin .nav-tab-wrapper {
    margin-bottom: 20px;
    border-bottom: 1px solid #ccd0d4;
}

.ai-smart-excerpt-admin .nav-tab {
    font-size: 14px;
    padding: 12px 16px;
    margin-right: 6px;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    background: #f7f7f7;
    color: #555;
    transition: all 0.2s ease;
}

.ai-smart-excerpt-admin .nav-tab:hover {
    background: #fff;
    color: #2271b1;
}

.ai-smart-excerpt-admin .nav-tab-active {
    background: #fff;
    color: #2271b1;
    border-color: #ccd0d4;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    font-weight: 600;
}

/* Tab Content */
.ai-excerpt-tab-content {
    background: #fff;
    min-height: 400px;
}

/* Hero Section for Each Tab */
.ai-excerpt-hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    margin: -20px -20px 30px -20px;
    border-bottom: 1px solid #e1e5e9;
}

.ai-excerpt-hero h2 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 28px;
    font-weight: 300;
}

.ai-excerpt-hero .description {
    font-size: 16px;
    color: #5a6c7d;
    line-height: 1.6;
    margin: 0;
    max-width: 800px;
}

/* Card Layout for Settings */
.ai-excerpt-card {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ai-excerpt-card h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 500;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.ai-excerpt-card .description {
    color: #5a6c7d;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

/* Workflow Steps */
.ai-excerpt-workflow {
    margin: 30px 0;
}

.ai-excerpt-workflow h3 {
    color: #2c3e50;
    font-size: 22px;
    margin-bottom: 25px;
    font-weight: 500;
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.workflow-step {
    display: flex;
    align-items: flex-start;
    padding: 20px;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.workflow-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2271b1, #1e5a8b);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-right: 15px;
}

.step-content h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.step-content p {
    margin: 0;
    color: #5a6c7d;
    font-size: 14px;
    line-height: 1.5;
}

/* Settings Form Styling */
.ai-excerpt-settings-form {
    background: transparent;
}

.ai-excerpt-settings-form .form-table {
    margin-top: 0;
}

.ai-excerpt-settings-form .form-table th {
    padding-left: 0;
    font-weight: 600;
    color: #2c3e50;
}

.ai-excerpt-settings-form .form-table td {
    padding-left: 20px;
}

.ai-excerpt-settings-form .submit {
    padding: 0;
    margin-top: 20px;
}

/* Provider Instructions */
.provider-instructions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.provider-instruction {
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
}

.provider-instruction h4 {
    margin: 0 0 10px 0;
    color: #2271b1;
    font-size: 16px;
    font-weight: 600;
}

.provider-instruction p {
    margin: 0 0 15px 0;
    color: #5a6c7d;
    font-size: 14px;
    line-height: 1.5;
}

.provider-instruction ol {
    margin: 0;
    padding-left: 20px;
}

.provider-instruction li {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.5;
}

.provider-instruction a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.provider-instruction a:hover {
    text-decoration: underline;
}

/* Excerpt Types Info */
.excerpt-types-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.excerpt-type-info {
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.excerpt-type-info h4 {
    margin: 0 0 10px 0;
    color: #28a745;
    font-size: 16px;
    font-weight: 600;
}

.excerpt-type-info p {
    margin: 0;
    color: #5a6c7d;
    font-size: 14px;
    line-height: 1.5;
}

/* Advanced Notes */
.advanced-notes {
    margin-top: 20px;
}

.advanced-note {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    border-left: 4px solid #f0ad4e;
    margin-bottom: 15px;
}

.advanced-note h4 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 16px;
    font-weight: 600;
}

.advanced-note p {
    margin: 0;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
}

/* Management Tools */
.management-tools {
    margin-top: 20px;
}

.management-tools .button {
    margin-bottom: 10px;
}

.tool-description {
    color: #5a6c7d;
    font-size: 14px;
    line-height: 1.5;
    margin: 5px 0 20px 0;
}

/* Enhanced Status Display */
.ai-excerpt-card #excerpt-status-info {
    min-height: 60px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

/* Responsive Design for Tabs */
@media screen and (max-width: 782px) {
    .ai-excerpt-hero {
        padding: 20px;
        margin: -10px -10px 20px -10px;
    }
    
    .ai-excerpt-hero h2 {
        font-size: 24px;
    }
    
    .workflow-steps {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .provider-instructions,
    .excerpt-types-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ai-excerpt-card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .nav-tab-wrapper .nav-tab {
        display: block;
        margin-right: 0;
        margin-bottom: 5px;
        text-align: center;
    }
}

/* Focus and Accessibility */
.nav-tab:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

.workflow-step:focus-within {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Bulk Progress Styles */
#bulk-progress-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
}

.bulk-progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.progress-stat {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.stat-label {
    font-size: 12px;
    color: #5a6c7d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.stat-value.status-idle {
    color: #6c757d;
}

.stat-value.status-running {
    color: #2271b1;
    animation: pulse 1.5s infinite;
}

.stat-value.status-completed {
    color: #28a745;
}

.stat-value.status-unknown {
    color: #dc3545;
}

.bulk-progress-bar {
    position: relative;
}

.progress-bar-container {
    width: 100%;
    height: 25px;
    background: #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 12px;
    transition: width 0.5s ease-in-out;
    position: relative;
}

.progress-bar-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: shine 2s infinite;
}

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

.progress-percentage {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    text-shadow: 0 0 3px rgba(255,255,255,0.8);
}

/* Enhanced status indicators */
.status-running::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2271b1;
    border-radius: 50%;
    margin-left: 8px;
    animation: pulse 1s infinite;
}

/* Responsive bulk progress */
@media screen and (max-width: 782px) {
    .bulk-progress-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .progress-stat {
        padding: 8px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .stat-value {
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .bulk-progress-stats {
        grid-template-columns: 1fr;
    }
}

/* Error highlighting */
.stat-value:not(:empty) + .stat-label:contains("Errors") ~ .stat-value {
    color: #dc3545;
    font-weight: 700;
}

/* Completion celebration effect */
.status-completed {
    position: relative;
}

.status-completed::before {
    content: '✓';
    margin-right: 5px;
    color: #28a745;
    font-weight: bold;
}

/* Loading shimmer effect for initializing state */
.stat-value:empty::before {
    content: 'Loading...';
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Keywords Styles */
.ai-keywords-section {
    margin-top: 25px;
    border-top: 1px solid #e1e5e9;
    padding-top: 20px;
}

.ai-keywords-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.keywords-type-selector,
.keywords-count-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.keywords-type-selector label,
.keywords-count-selector label {
    font-weight: 600;
    color: #6f42c1;
    margin: 0;
}

.keywords-actions {
    margin-left: auto;
}

.keywords-actions .button {
    margin-left: 8px;
}

.keywords-actions .dashicons {
    color: #6f42c1;
}

.ai-keywords-editor textarea {
    min-height: 60px;
    border-color: #6f42c1;
}

.ai-keywords-editor textarea:focus {
    border-color: #6f42c1;
    box-shadow: 0 0 0 1px #6f42c1;
}

.keywords-meta {
    color: #666;
    font-style: italic;
}

.keywords-count {
    font-weight: 600;
    color: #6f42c1;
}

.ai-keywords-status .generation-success {
    color: #6f42c1;
    font-weight: 600;
}

.keyword-type-info {
    border-left-color: #6f42c1;
}

.keyword-type-info h4 {
    color: #6f42c1;
}

/* Keyword Tag Display */
.keywords-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.keyword-tag {
    background: #6f42c1;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.keyword-tag:hover {
    background: #5a2d91;
}

/* Responsive adjustments for keywords */
@media screen and (max-width: 782px) {
    .ai-keywords-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .keywords-actions {
        margin-left: 0;
        width: 100%;
    }
    
    .keywords-actions .button {
        display: block;
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    .nav-tab-wrapper,
    .management-tools,
    .ai-excerpt-settings-form .submit,
    #bulk-progress-container,
    .ai-keywords-controls {
        display: none;
    }
    
    .ai-excerpt-hero {
        background: none !important;
        border: 1px solid #ccc;
    }
}