/**
 * Image to Spreadsheet Plugin Styles
 */

/* JSON Tree View Styles */
.json-explorer {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: #1a1a1a;
    border-radius: 5px;
    color: #f0f0f0;
    padding: 15px;
    overflow: auto;
    max-height: 400px;
}

.json-tree {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.json-tree .json-tree {
    padding-left: 20px;
    margin: 0;
    border-left: 1px dotted #555;
}

.json-tree-item, .json-tree-object {
    margin: 2px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.json-tree-key {
    color: #88ccff;
    margin-right: 5px;
}

.json-tree-value {
    color: #f0f0f0;
}

.json-tree-object-value {
    flex: 1 1 100%;
    margin-top: 5px;
}

.json-tree-expander {
    color: #f2c063;
    margin-right: 5px;
    cursor: pointer;
    font-size: 12px;
    width: 15px;
    text-align: center;
    user-select: none;
}

.json-tree-expander.collapsed + .json-tree-value {
    display: none;
}

.json-tree-value.json-tree-number {
    color: #f47676;
}

.json-tree-value.json-tree-string {
    color: #9ccc65;
}

.json-tree-value.json-tree-null {
    color: #999;
    font-style: italic;
}

.json-tree-value.json-tree-boolean {
    color: #ba68c8;
}

/* General table styles for JSON display */
.json-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 14px;
}

.json-table th, 
.json-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.json-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.json-table tr:nth-child(even) {
    background-color: #222;
}
.json-table tr:nth-child(odd) {
    background-color: #333;
}

.json-table tr:hover {
    background-color: #f1f1f1;
}

/* Styles for nested JSON objects */
.json-table tr.object-header {
    background-color: #e6f2ff;
    font-weight: bold;
}

.json-table tr.object-header td {
    border-bottom: 2px solid #cce5ff;
}

.json-table tr.object-header:hover {
    background-color: #d9edff;
}

/* Upload area highlight */
.upload-area.highlight {
    border-color: #0073aa;
    background-color: rgba(0, 115, 170, 0.05);
}

/* Support for non-Flexbox browsers */
.upload-instructions {
    text-align: center;
}

.upload-instructions i {
    display: inline-block;
    margin-bottom: 10px;
}

/* Better mobile experience */
@media (max-width: 480px) {
    .image-to-spreadsheet-container h2 {
        font-size: 20px;
        text-align: center;
    }
    
    .step h3 {
        font-size: 18px;
    }
    
    .data-preview h4 {
        font-size: 16px;
    }
    
    .json-table th, 
    .json-table td {
        padding: 6px;
        font-size: 12px;
    }
    
    .download-btn, 
    .start-over-btn {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
}

/* Dashicons fallback */
.no-dashicons .upload-instructions i.dashicons-camera:before {
    content: '📷';
    font-family: inherit;
}

.no-dashicons .download-btn i.dashicons-media-spreadsheet:before {
    content: '📊';
    font-family: inherit;
}

/* Accessibility improvements */
.process-image-btn:focus,
.retry-btn:focus,
.start-over-btn:focus,
.download-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

#image-upload:focus + .upload-area {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .image-to-spreadsheet-container {
        color: #f1f1f1;
    }
    
    .step {
        background-color: #2c2c2c;
        border-left-color: #0073aa;
    }
    
    .step h3, .data-preview h4 {
        color: #f1f1f1;
    }
    
    .upload-area {
        border-color: #555;
    }
    
    .upload-instructions .dashicons,
    .upload-instructions p {
        color: #aaa;
    }
    
    #json-preview, .data-preview {
        background-color: #333;
        color: #f1f1f1;
    }
    
    .json-table th {
        background-color: #444;
    }
    
    .json-table td, .json-table th {
        border-bottom-color: #555;
    }
    
    .json-table tr:nth-child(even) {
        background-color: #3a3a3a;
    }
    
    .json-table tr:hover {
        background-color: #444;
    }
    
    .json-table tr.object-header {
        background-color: #2d4052;
    }
    
    .json-table tr.object-header td {
        border-bottom-color: #3a526a;
    }
    
    .json-table tr.object-header:hover {
        background-color: #34495e;
    }
    
    .start-over-btn {
        background-color: #333;
        border-color: #555;
        color: #f1f1f1;
    }
    
    .start-over-btn:hover {
        background-color: #444;
    }
} 

.results-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.image-display-container {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 16px;
  text-align: center;
}
#result-image-preview {
  max-width: 100%;
  max-height: 500px;
  border: 2px solid #eee;
  border-radius: 8px;
  margin: 0 auto;
  display: block;
}
.data-preview-container {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 16px;
}
#extracted-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
#extracted-data-table th, #extracted-data-table td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
}
#extracted-data-table th {
  background: #f5f5f5;
} 

.table-section-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 5px;
}

#results-tables-container .extracted-data-table:first-of-type {
    margin-top: 0;
}

.extracted-data-table th, .extracted-data-table td {
    padding: 12px;
    text-align: left;
}

.email-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.email-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.send-email-btn {
    padding: 10px 15px;
    background-color: #ff9800; /* Orange */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.send-email-btn:hover:not(.disabled) {
    background-color: #fb8c00;
}

.send-email-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.start-over-container {
    text-align: center;
    width: 100%;
}

.start-over-btn {
    width: auto;
    padding: 10px 20px;
}

/* Batch processing styles */
.image-queue {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    position: relative;
}

.queue-item.pending {
    border-color: #ccc;
}

.queue-item.processing {
    border-color: #0073aa;
    background: #f0f8ff;
}

.queue-item.done {
    border-color: #4CAF50;
    background: #f1f8f4;
}

.queue-item.error {
    border-color: #f44336;
    background: #fff5f5;
}

.queue-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    display: block;
    background: #f5f5f5;
}

.queue-thumb-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 24px;
    flex-shrink: 0;
}

.queue-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.queue-name {
    font-weight: 500;
    color: #333;
}

.queue-status {
    font-size: 14px;
    color: #333;
}

.queue-error {
    font-size: 12px;
    color: #f44336;
    margin-top: 5px;
}

.queue-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.queue-remove:hover {
    background: rgba(0, 0, 0, 0.8);
}

.queue-empty {
    text-align: center;
    color: #333;
    padding: 20px;
}

/* Job result cards */
.job-result-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.job-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.result-thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: block;
    background: #f5f5f5;
}

.result-thumb-placeholder {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 40px;
}

.job-title {
    flex: 1;
}

.job-title h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.job-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.job-status.pending {
    background: #f5f5f5;
    color: #666;
}

.job-status.processing {
    background: #e3f2fd;
    color: #1976d2;
}

.job-status.done {
    background: #e8f5e9;
    color: #388e3c;
}

.job-status.error {
    background: #ffebee;
    color: #d32f2f;
}

.job-tables {
    margin-bottom: 20px;
}

.job-error-message {
    padding: 20px;
    background: #f8d7da;
    border-radius: 5px;
    color: #721c24;
    margin-bottom: 20px;
}

.job-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.job-actions .btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.job-actions .download-xlsx {
    background: #4CAF50;
    color: white;
}

.job-actions .download-xlsx:hover:not(:disabled) {
    background: #45a049;
}

.job-actions .download-pdf {
    background: #f44336;
    color: white;
}

.job-actions .download-pdf:hover:not(:disabled) {
    background: #da190b;
}

.job-actions .btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.email-row {
    display: flex;
    gap: 10px;
}

.job-email-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.job-actions .send-email {
    background: #ff9800;
    color: white;
}

.job-actions .send-email:hover:not(:disabled) {
    background: #fb8c00;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .queue-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .queue-thumb {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .job-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .result-thumb {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
.email-row {
    flex-direction: column;
}

/* Global email settings */
.global-email-settings {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.global-email-settings label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.global-email-settings input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.global-email-settings input[type="email"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}
} 