/* Global Styles */
:root {
    --primary-color: #4a6cf7;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --border-color: #dee2e6;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7ff;
    padding: 20px;
}

.container {
    margin: 0 auto;
    padding: 8px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, .3);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    margin-top: 15px;
    max-height: 80px;
    margin-bottom: 15px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Upload Container */
.upload-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.drop-zone {
    flex: 1;
    min-width: 300px;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background-color: #f8f9ff;
}

.drop-zone:hover {
    background-color: #f0f4ff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(74, 108, 247, 0.2);
}

.drop-zone.highlight {
    background-color: #e8f0fe;
    border-color: #1a73e8;
}

.drop-zone i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.drop-zone h3 {
    margin-bottom: 10px;
    color: var(--dark-gray);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn i {
    font-size: 16px;
}

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

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover:not(:disabled) {
    background-color: #3a5bd9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn.secondary {
    background-color: #6c757d;
    color: white;
}

.btn.secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn.export {
    background-color: #28a745;
    color: white;
}

.btn.export:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn.export:active {
    background-color: #1e7e34;
    transform: translateY(0);
}

.action-buttons {
    text-align: center;
    margin: 30px 0;
}

/* Summary Cards */
.summary-cards {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.card {
    flex: 1;
    min-width: 200px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: var(--dark-gray);
    margin-bottom: 10px;
    font-size: 16px;
}

.card .count {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Search and Export */
.search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
}

#searchInput {
    flex: 1;
    max-width: 400px;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Nunito', sans-serif;
    transition: var(--transition);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background: white;
    font-size: 14px;
}

/* Main table styling */
#resultsTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0;
    padding: 0;
}

/* Table header and cells */
#resultsTable thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    font-weight: 700;
    color: var(--dark-gray);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    z-index: 10;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

/* Table cells */
#resultsTable td {
    padding: 10px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column widths */
#resultsTable th:nth-child(1),
#resultsTable td:nth-child(1) {
    width: 12%;  /* SKU */
    min-width: 100px;
}

#resultsTable th:nth-child(2),
#resultsTable td:nth-child(2) {
    width: 31%;  /* Name */
    min-width: 150px;
}

#resultsTable th:nth-child(3),
#resultsTable td:nth-child(3) {
    width: 9%;  /* ISN */
    min-width: 120px;
}

#resultsTable th:nth-child(4),
#resultsTable td:nth-child(4) {
    width: 18%;  /* EPC */
    min-width: 200px;
    font-family: monospace;
}

#resultsTable th:nth-child(5),
#resultsTable td:nth-child(5),
#resultsTable th:nth-child(6),
#resultsTable td:nth-child(6) {
    width: 12%;   /* Transferred & Verified */
    min-width: 80px;
    text-align: center;
}

#resultsTable th:nth-child(7),
#resultsTable td:nth-child(7) {
    width: 12%;  /* Status */
    min-width: 120px;
    text-align: center;
}

th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    font-weight: 700;
    color: var(--dark-gray);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Nested items container */
.nested-items {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #f9faff;
}

/* Nested item row */
.nested-item {
    display: grid;
    grid-template-columns: 
    minmax(100px, 10%) 
    minmax(310px, 31%) 
    minmax(8px, 17%) 
    minmax(200px, 25%) 
    minmax(68px, 12%) 
    minmax(53px, 4%) 
    minmax(124px, 14%);
    width: 100%;
    min-width: 0;
    padding: 8px 0;
    border-bottom: 1px solid #e8f0fe;
    box-sizing: border-box;
}

/* Nested item cells - match the parent table's cell structure */
.nested-item > div {
    padding: 4px 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

/* Style the SKU group header */
.collapsible {
    background-color: #f0f4ff !important;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.collapsible:hover {
    background-color: #e6ecff !important;
}

/* Verified group styling */
.collapsible.verified {
    background-color: #f0f9f0 !important;
}

.collapsible.verified:hover {
    background-color: #e0f0e0 !important;
}

/* Toggle icon */
.toggle-icon {
    transition: transform 0.2s ease;
    margin-right: 8px;
    font-size: 0.8em;
    color: #6c757d;
}

.collapsible.active .toggle-icon {
    transform: rotate(180deg);
}

/* Status indicators */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.status-verified {
    background-color: #d4edda;
    color: #155724;
}

.status-unverified {
    background-color: #f8d7da;
    color: #721c24;
}

/* Status icons */
.fa-check-circle {
    color: #28a745;
    margin-left: 75px;
}

.fa-times-circle {
    color: #dc3545;
    margin-left: 75px;
}

/* Text alignment helpers */
.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

/* Padding helpers */
.p-0 {
    padding: 0 !important;
}

.pl-3 {
    padding-left: 1rem !important;
}

/* Hover effects */
#resultsTable tbody tr:not(.collapsible):hover {
    background-color: #f8f9fa;
}

/* Ensure text doesn't wrap and shows ellipsis */
#resultsTable td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make sure the table is scrollable on small screens */
@media (max-width: 1200px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #resultsTable {
        min-width: 1000px;
    }
}

/* Fix for sticky header */
.table-container {
    max-height: 70vh;
    overflow-y: auto;
}

#resultsTable thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Status Icons */
.status-icon {
    font-size: 18px;
}

.status-verified {
    color: var(--success-color);
}

.status-unverified {
    color: var(--danger-color);
}

/* Collapsible Rows */
.collapsible {
    cursor: pointer;
    font-weight: 600;
    background-color: #f0f4ff !important;
}

.collapsible:hover {
    background-color: #e6ecff !important;
}

.collapsible:after {
    content: '\002B';
    font-weight: bold;
    float: right;
    margin-left: 5px;
}

.collapsible.active:after {
    content: "\2212";
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    background-color: #f9faff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .upload-container {
        flex-direction: column;
    }
    
    .drop-zone {
        width: 100%;
    }
    
    .summary-cards {
        flex-direction: column;
    }
    
    .card {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .search-container {
        flex-direction: column;
        gap: 15px;
    }
    
    #searchInput {
        width: 100%;
        max-width: 100%;
    }
}
