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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.upload-section {
    margin-bottom: 8px;
}

.upload-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    width: 100%;
}

.upload-button:hover {
    background: #2980b9;
}

.upload-info {
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.upload-status {
    font-size: 14px;
    color: #2ecc71;
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.stats-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #2ecc71;
}

.stat-value.missing {
    color: #e74c3c;
}

.missing-section {
    margin-top: 8px;
}

.missing-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.missing-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.missing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.2);
    border-radius: 4px;
    font-size: 12px;
}

.remove-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
}

.remove-btn:hover {
    color: white;
}

.missing-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.view-missing-button,
.export-missing-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.view-missing-button:hover,
.export-missing-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.view-missing-button svg,
.export-missing-button svg {
    flex-shrink: 0;
}

.export-section {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.export-button {
    width: 100%;
    padding: 12px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.export-button:hover:not(:disabled) {
    background: #229954;
}

.export-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
}

.table-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px 120px 32px;
}

.counting-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.counting-table thead {
    background: #34495e;
    color: white;
}

.counting-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.counting-table td {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.counting-table tbody tr:hover {
    background: #f8f9fa;
}

.counting-table tbody tr:last-child td {
    border-bottom: none;
}

.quantity-input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.quantity-input:focus {
    outline: none;
    border-color: #3498db;
}

.remove-button {
    padding: 6px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.remove-button:hover {
    background: #c0392b;
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.empty-state p {
    color: #7f8c8d;
    font-size: 16px;
}

/* Barcode Input */
.barcode-input-container {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    padding: 24px 32px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.barcode-input-wrapper {
    width: 100%;
    max-width: 600px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.barcode-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 18px;
    border: 2px solid #3498db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.barcode-input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.enter-button {
    padding: 16px 32px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.enter-button:hover {
    background: #2980b9;
}

.enter-button:active {
    transform: scale(0.98);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.close-button {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.close-button:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    font-size: 16px;
    color: #555;
    margin-bottom: 12px;
}

.modal-question {
    font-weight: 600;
    color: #2c3e50;
    margin-top: 8px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-primary {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    padding: 10px 20px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* Large Modal */
.large-modal .modal {
    max-width: 90vw;
    width: 90vw;
    max-height: 90vh;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.large-modal .modal.large-modal-content {
    max-width: 90vw;
    width: 90vw;
    max-height: 90vh;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.large-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.articles-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.articles-table thead {
    background: #34495e;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.articles-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.articles-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.articles-table tbody tr:hover {
    background: #f8f9fa;
}

.articles-table tbody tr:last-child td {
    border-bottom: none;
}

