* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px;
}

header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
}

header h1 {
    color: #333;
    font-size: 28px;
}

.subtitle {
    color: #666;
    margin-top: 5px;
}

/* ==================================================
   HEADER ROW - Tabs + Loại hình trên 1 dòng
   ================================================== */

.header-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 10px;
    flex: 1;
}

.tab-btn {
    padding: 10px 24px;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #f5f5f5;
}

.tab-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.header-loai {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-loai label {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    white-space: nowrap;
}

.header-loai select {
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 140px;
}

.header-loai select:focus {
    outline: none;
    border-color: #667eea;
}

/* ==================================================
   TAB CONTENT
   ================================================== */

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================================================
   SEARCH ROW - 1 DÒNG
   ================================================== */

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 1;
    min-width: 250px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
}

.search-row .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ==================================================
   BUTTONS
   ================================================== */

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* ==================================================
   UPLOAD AREA
   ================================================== */

.upload-area {
    border: 3px dashed #e0e0e0;
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f3ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-hint {
    color: #999;
    font-size: 14px;
    margin-top: 10px;
}

/* ==================================================
   RESULT CONTAINER
   ================================================== */

.result-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.result-container h3 {
    margin-bottom: 15px;
    color: #333;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.result-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
}

.result-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.result-table tr:hover {
    background: #f8f9ff;
}

.result-success {
    color: #28a745;
    font-weight: 600;
}

.result-error {
    color: #dc3545;
    font-weight: 600;
}

/* ==================================================
   PROGRESS BAR
   ================================================== */

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s;
    border-radius: 10px;
}

#progress-text {
    text-align: center;
    color: #666;
}

/* ==================================================
   MODAL
   ================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* ==================================================
   RESPONSIVE
   ================================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .header-loai {
        justify-content: space-between;
    }
    
    .header-loai select {
        flex: 1;
        min-width: unset;
    }
    
    .search-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input-wrapper {
        min-width: unset;
    }
    
    .search-row .btn {
        width: 100%;
    }
    
    .result-table {
        font-size: 12px;
    }
    
    .result-table th,
    .result-table td {
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .tab-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}