/* AI JSON to Excel Transformer Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 16px;
}

.section {
    background: white;
    margin-bottom: 20px;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.upload-area:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

.upload-area.dragover {
    border-color: #3498db;
    background-color: #e3f2fd;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    font-size: 48px;
    color: #bdc3c7;
}

.upload-area p {
    color: #7f8c8d;
    margin: 0;
}

.file-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #e8f5e8;
    border-left: 4px solid #27ae60;
    border-radius: 4px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}

.btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Session Info */
.session-info {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.session-info p {
    margin-bottom: 5px;
}

.session-info span {
    font-weight: 500;
}

/* Transform Actions */
.transform-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

/* Modification Area */
.modification-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Status Info */
.status-info {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

.status-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.status-row:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 100px;
    margin-right: 15px;
}

.status-value {
    color: #7f8c8d;
    font-family: monospace;
    background-color: white;
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

#modification-input {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

#modification-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Tables Container - Scrollable */
#tables-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

/* Tables */
.table-container {
    margin-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.table-container:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.table-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    padding: 8px 12px 6px 12px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 0;
    font-size: 13px;
}

table th,
table td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid #f1f3f4;
    border-right: 1px solid #f1f3f4;
    line-height: 1.3;
}

table th:last-child,
table td:last-child {
    border-right: none;
}

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 12px;
    border-bottom: 1px solid #dee2e6;
}

table tr:nth-child(even) {
    background-color: #fafbfc;
}

table tr:hover {
    background-color: #e8f4f8;
}

/* Items column styling */
table th[data-items-column],
table td[data-items-column] {
    min-width: 200px;
    max-width: 300px;
}

/* Depth-based styling for hierarchy */
table td[data-depth="0"] {
    font-weight: 600;
    color: #2c3e50;
}

table td[data-depth="1"] {
    font-weight: 500;
    color: #34495e;
}

table td[data-depth="2"] {
    color: #5d6d7e;
}

table td[data-depth="3"] {
    color: #7b8794;
    font-style: italic;
}

/* Make cells more compact */
table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Items column can be wider and wrap if needed */
table td[data-items-column] {
    white-space: nowrap;
    max-width: 300px;
}

/* JSON Viewer */
.json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.json-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.json-viewer {
    max-height: 400px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.json-viewer pre {
    margin: 0;
    padding: 15px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #2c3e50;
    background: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* JSON syntax highlighting */
.json-key {
    color: #0066cc;
    font-weight: 600;
}

.json-string {
    color: #008000;
}

.json-number {
    color: #cc6600;
}

.json-boolean {
    color: #990099;
    font-weight: 600;
}

.json-null {
    color: #999999;
    font-style: italic;
}

/* Status Messages */
.status-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    z-index: 1000;
}

.status-message {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease;
}

.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.status-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.status-message.processing {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .section {
        padding: 15px;
    }
    
    .transform-actions {
        flex-direction: column;
    }
    
    .btn {
        margin-right: 0;
        width: 100%;
    }
    
    #tables-container {
        max-height: 300px;
    }
    
    table th,
    table td {
        padding: 3px 6px;
        font-size: 12px;
        max-width: 120px;
    }
    
    .table-title {
        font-size: 13px;
        padding: 6px 8px 4px 8px;
    }
}