/* Amazon BD Manager - Web Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #232f3e 0%, #37475a 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.header .version {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Controls Panel */
.controls-panel {
    background: #fafbfc;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e4e8;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #24292e;
    font-size: 0.9rem;
}

.filter-group input[type="number"],
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group input[type="number"] {
    width: 90px;
}

.filter-group input[type="text"] {
    width: 200px;
}

.filter-group input:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.separator {
    width: 1px;
    height: 32px;
    background: #d1d5da;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #ff9900;
    color: #111;
}

.btn-primary:hover {
    background: #e68a00;
}

.btn-secondary {
    background: #232f3e;
    color: white;
}

.btn-secondary:hover {
    background: #37475a;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
    font-size: 0.9rem;
}

#status-text {
    color: #586069;
}

.sort-indicator {
    color: #0366d6;
    font-weight: 500;
}

/* Table Container */
.table-container {
    overflow: auto;
    max-height: calc(100vh - 350px);
    min-height: 400px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* Table Header */
thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    background: #232f3e;
    color: white;
    padding: 14px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    border-right: 1px solid #37475a;
    transition: background 0.2s;
    white-space: nowrap;
}

th:hover {
    background: #37475a;
}

th:last-child {
    border-right: none;
}

th::after {
    content: '';
    margin-left: 6px;
    opacity: 0.5;
}

/* Table Body */
td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #e1e4e8;
    font-size: 0.9rem;
    color: #24292e;
}

/* Alternating rows */
.even-row {
    background: white;
}

.odd-row {
    background: #f6f8fa;
}

tbody tr:hover {
    background: #fff8e1 !important;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px !important;
    color: #6a737d;
    font-size: 1rem;
    background: #fafbfc;
}

/* Footer */
.footer {
    padding: 15px 30px;
    text-align: center;
    color: #6a737d;
    font-size: 0.85rem;
    border-top: 1px solid #e1e4e8;
    background: #fafbfc;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e1e4e8;
    border-top-color: #ff9900;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay span {
    color: #586069;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .filter-group {
        gap: 10px;
    }

    .filter-group input[type="text"] {
        width: 150px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .controls-panel {
        padding: 15px 20px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group label {
        justify-content: space-between;
    }

    .filter-group input[type="number"],
    .filter-group input[type="text"] {
        flex: 1;
        width: 100%;
    }

    .separator {
        display: none;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .status-bar {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
}

/* Column widths */
th:nth-child(1), td:nth-child(1) { min-width: 180px; } /* SKU */
th:nth-child(2), td:nth-child(2) { min-width: 150px; } /* SKU PAI */
th:nth-child(3), td:nth-child(3) { min-width: 120px; } /* ASIN */
th:nth-child(4), td:nth-child(4) { min-width: 120px; } /* ASIN PAI */
th:nth-child(5), td:nth-child(5) { min-width: 80px; }  /* LOJA */
th:nth-child(6), td:nth-child(6) { min-width: 90px; }  /* QT FILHO */
th:nth-child(7), td:nth-child(7) { min-width: 80px; }  /* QT PAI */
th:nth-child(8), td:nth-child(8) { min-width: 100px; } /* QT PAI SEM */
th:nth-child(9), td:nth-child(9) { min-width: 60px; }  /* IMG */

/* Thumbnail Images */
.img-col {
    width: 60px !important;
    min-width: 60px !important;
    cursor: default;
}

.img-cell {
    padding: 4px !important;
    width: 60px;
    text-align: center;
}

.thumbnail {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #e1e4e8;
    background: white;
}

.no-img {
    color: #ccc;
    font-size: 1.2rem;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #f6f8fa;
    border-top: 1px solid #e1e4e8;
}

.pagination-info {
    color: #586069;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-page {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: #f6f8fa;
    border-color: #0366d6;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-size {
    padding: 8px 12px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* Adjust column widths for thumbnail */
th:nth-child(1), td:nth-child(1) { width: 60px; min-width: 60px; } /* IMG */
th:nth-child(2), td:nth-child(2) { min-width: 180px; } /* SKU */
th:nth-child(3), td:nth-child(3) { min-width: 150px; } /* SKU PAI */
th:nth-child(4), td:nth-child(4) { min-width: 120px; } /* ASIN */
th:nth-child(5), td:nth-child(5) { min-width: 120px; } /* ASIN PAI */
th:nth-child(6), td:nth-child(6) { min-width: 80px; }  /* LOJA */
th:nth-child(7), td:nth-child(7) { min-width: 90px; }  /* QT FILHO */
th:nth-child(8), td:nth-child(8) { min-width: 80px; }  /* QT PAI */
th:nth-child(9), td:nth-child(9) { min-width: 100px; } /* QT PAI SEM */
th:nth-child(10), td:nth-child(10) { min-width: 60px; }  /* IMG count */
