/**
 * CSV Post Manager Frontend Styles
 * 
 * Modern, responsive styling for the bulk post management interface
 */

/* Container and Layout */
.csv-post-manager {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.csv-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.csv-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.csv-description {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

/* Sections */
.csv-section {
    padding: 30px;
}

.csv-section-header {
    margin-bottom: 30px;
    text-align: center;
}

.csv-section-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.section-description {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Upload Area */
.csv-upload-area {
    margin-bottom: 30px;
}

.file-upload-wrapper {
    margin-bottom: 20px;
}

.file-upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f7fafc;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: #667eea;
    background: #edf2f7;
}

.file-upload-icon {
    font-size: 48px;
    color: #a0aec0;
    margin-bottom: 15px;
}

.file-upload-text p {
    margin: 5px 0;
    color: #4a5568;
}

.file-upload-note {
    font-size: 14px;
    color: #718096;
}

.file-upload-area .button {
    margin-top: 15px;
}

/* File Info */
.csv-file-info {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-icon {
    font-size: 24px;
    color: #667eea;
}

.file-meta {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 16px;
}

.file-size {
    font-size: 14px;
    color: #718096;
}

#remove-file-btn {
    color: #e53e3e;
    font-size: 18px;
    padding: 5px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#remove-file-btn:hover {
    background-color: #fed7d7;
}

/* Actions */
.csv-actions {
    text-align: center;
    margin-top: 20px;
}

.preview-actions,
.results-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Stats */
.preview-stats,
.results-stats {
    margin-bottom: 30px;
}

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

.stat-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-item.new {
    border-color: #38a169;
    background: #f0fff4;
}

.stat-item.update {
    border-color: #3182ce;
    background: #ebf8ff;
}

.stat-item.error {
    border-color: #e53e3e;
    background: #fef5e7;
}

.stat-item.success {
    border-color: #38a169;
    background: #f0fff4;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabs */
.preview-tabs,
.results-tabs {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-nav {
    display: flex;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.2s ease;
    position: relative;
}

.tab-button:hover {
    background: #edf2f7;
    color: #2d3748;
}

.tab-button.active {
    background: #fff;
    color: #667eea;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.tab-count {
    font-size: 12px;
    color: #718096;
}

.tab-button.active .tab-count {
    color: #667eea;
}

.tab-content {
    min-height: 300px;
}

.tab-pane {
    display: none;
    padding: 20px;
}

.tab-pane.active {
    display: block;
}

/* Lists */
.posts-list,
.errors-list,
.results-list {
    max-height: 600px;
    overflow-y: auto;
}

.no-items {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 40px 20px;
}

/* Preview Items */
.preview-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.preview-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.item-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.item-title strong {
    color: #2d3748;
    font-size: 16px;
}

.row-indicator {
    background: #e2e8f0;
    color: #4a5568;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.item-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-new {
    background: #c6f6d5;
    color: #22543d;
}

.status-update {
    background: #bee3f8;
    color: #1a365d;
}

.item-details {
    padding: 20px;
}

.item-details > div {
    margin-bottom: 15px;
}

.item-details > div:last-child {
    margin-bottom: 0;
}

.label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
    margin-right: 10px;
}

.value {
    color: #2d3748;
}

/* Categories and Tags */
.categories-list,
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.category-tag,
.tag {
    background: #edf2f7;
    color: #4a5568;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.category-tag.new,
.tag.new {
    background: #fef5e7;
    color: #744210;
    border: 1px solid #f6e05e;
}

/* Custom Fields */
.custom-fields-list {
    margin-top: 8px;
}

.custom-field {
    margin-bottom: 8px;
    font-size: 14px;
}

.custom-field strong {
    color: #4a5568;
    margin-right: 8px;
}

/* Changes */
.changes-list {
    margin-top: 8px;
}

.change-item {
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 10px;
    background: #f7fafc;
}

.change-comparison {
    margin-top: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.old-value {
    color: #e53e3e;
    background: #fed7d7;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.new-value {
    color: #38a169;
    background: #c6f6d5;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Error Items */
.error-item {
    border: 1px solid #fed7d7;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #fef5e7;
}

.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fed7d7;
    border-bottom: 1px solid #f56565;
}

.error-title {
    font-weight: 600;
    color: #742a2a;
}

.error-details {
    padding: 15px 20px;
}

.error-message {
    color: #742a2a;
    margin-bottom: 8px;
    font-size: 14px;
}

/* Result Items */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f7fafc;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.result-title {
    font-weight: 600;
    color: #2d3748;
}

.result-actions .button {
    margin: 0;
}

/* Featured Image */
.featured-image-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* Help Section */
.csv-help-section {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 25px;
    margin-top: 30px;
}

.csv-help-section h3 {
    margin: 0 0 20px 0;
    color: #2d3748;
    font-size: 20px;
}

.csv-help-section h4 {
    margin: 20px 0 10px 0;
    color: #4a5568;
    font-size: 16px;
}

.csv-help-section ul {
    margin: 0 0 20px 20px;
    color: #4a5568;
}

.csv-help-section li {
    margin-bottom: 8px;
}

.csv-help-section code {
    background: #edf2f7;
    color: #2d3748;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.csv-example pre {
    background: #1a202c;
    color: #a0aec0;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 13px;
    margin: 10px 0 0 0;
}

/* Messages */
.csv-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.csv-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

.csv-message.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.csv-message.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #f56565;
}

.csv-message p {
    margin: 0;
    flex: 1;
}

.message-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.message-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Button Enhancements */
.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.button .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .csv-post-manager {
        margin: 10px;
        border-radius: 0;
    }
    
    .csv-header {
        padding: 20px 15px;
    }
    
    .csv-section {
        padding: 20px 15px;
    }
    
    .file-upload-area {
        padding: 30px 15px;
    }
    
    .stat-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .tab-nav {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: 1px solid #e2e8f0;
    }
    
    .tab-button:last-child {
        border-bottom: none;
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .preview-actions,
    .results-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .categories-list,
    .tags-list {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .csv-messages {
        left: 10px;
        right: 10px;
        max-width: none;
    }
} 