body { font-family: Arial, sans-serif; margin: 0; padding: 20px; background: #f4f7f6; }
.container { width: 100%; margin: auto; }
.box { background: rgb(248, 241, 241); padding: 20px; border-radius: 8px; box-shadow: 0 5px 10px rgba(0,0,0,0.1); margin-bottom: 25px; }
.header-bar { display: flex; justify-content: space-between; align-items: center; background: #2c3e50; color: white; padding: 10px 20px; border-radius: 8px; margin-bottom: 20px; }
input, textarea, select { width: 100%; padding: 10px; margin: 8px 0; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
button { background: #27ae60; color: white; border: none; padding: 12px; border-radius: 4px; cursor: pointer; width: 100%; font-size: 16px; font-weight: bold; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { border: 1px solid #eee; padding: 12px; text-align: left; font-size: 13px; }
th { background: #f8f9fa; }
.badge { padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: bold; color: white; display: inline-block; }
.bg-success { background-color: #28a745; }
.bg-danger { background-color: #dc3545;}
.bg-warning { background-color: #ffc107; color: #212529 !important; }
.bg-secondary { background-color: #6c757d; }
.btn-action { text-decoration: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; color: white !important; font-weight: bold; display: inline-block; }
.btn-edit { background-color: #f1c40f; color: #212529 !important; }
.btn-danger { background-color: #f79999;}
.btn-print { background-color: #3498db; }
.lock-icon { color: #a5b1c2; font-size: 11px; display: inline-block; margin-top: 4px; }
/* Upload zone */
.upload-zone { border: 2px dashed #74b9ff; border-radius: 8px; padding: 20px; text-align: center; background: #f0f8ff; cursor: pointer; transition: background 0.2s; margin-top: 10px; }
.upload-zone:hover, .upload-zone.drag-over { background: #dbeafe; }
.upload-zone input[type=file] { display: none; }
.upload-zone .icon { font-size: 32px; }
.file-list { margin-top: 10px; }
.file-item { display: flex; align-items: center; justify-content: space-between; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
.file-item .file-icon { margin-right: 8px; }
.file-item .del-btn { background: none; border: none; color: #e17055; cursor: pointer; font-size: 16px; padding: 0 4px; }
.file-item .del-btn:hover { color: #d63031; }
.att-link { color: #0984e3; text-decoration: none; font-size: 13px; }
.att-link:hover { text-decoration: underline; }
.tabs { display: flex; gap: 0; margin-bottom: 0; }
.tab-btn { padding: 10px 28px; border: none; cursor: pointer; font-size: 15px; font-weight: bold; background: #dfe6e9; color: #636e72; border-radius: 8px 8px 0 0; margin-right: 4px; transition: background 0.2s; }
.tab-btn.active { background: #e67e22; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Styles cho tìm kiếm nhà cung cấp */
.search-container {
    position: relative;
    margin-bottom: 10px;
}
.search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.search-input:focus {
    outline: none;
    border-color: #e67e22;
}
.ncc-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: white;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ncc-list.show {
    display: block;
}
.ncc-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}
.ncc-item:hover {
    background: #f8f9fa;
}
.ncc-item.selected {
    background: #e67e22;
    color: white;
}
.ncc-name {
    font-weight: bold;
    font-size: 14px;
}
.ncc-details {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}
.ncc-item.selected .ncc-details {
    color: #fff3cd;
}
.selected-ncc-info {
    margin-top: 10px;
    padding: 10px;
    background: #e8f8f5;
    border-radius: 4px;
    border-left: 3px solid #27ae60;
    display: none;
}
.selected-ncc-info.show {
    display: block;
}
.clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 18px;
}
.clear-search:hover {
    color: #e74c3c;
}

/* ========== RESPONSIVE CHO DI ĐỘNG ========== */

/* Tablet & Mobile */
@media (max-width: 768px) {
body {
padding: 10px;
}

.header-bar {
flex-direction: column;
text-align: center;
gap: 10px;
padding: 12px 15px;
}

.header-bar div {
font-size: 12px;
}

.tabs {
flex-wrap: wrap;
}

.tab-btn {
flex: 1;
padding: 10px 12px;
font-size: 13px;
text-align: center;
}

.box {
padding: 15px;
margin-bottom: 15px;
}

/* Table responsive - cuộn ngang */
table {
display: block;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}

th, td {
padding: 8px 10px;
font-size: 12px;
}

/* Form elements */
input, textarea, select {
padding: 10px;
font-size: 14px;
}

button {
padding: 12px;
font-size: 14px;
}

/* Badge */
.badge {
padding: 2px 6px;
font-size: 10px;
}

/* Buttons action */
.btn-action {
padding: 4px 8px;
font-size: 11px;
margin: 2px;
}

/* Upload zone */
.upload-zone {
padding: 15px;
}

.upload-zone div {
font-size: 11px;
}

.file-item {
padding: 6px 10px;
font-size: 12px;
flex-wrap: wrap;
}

.att-link {
font-size: 12px;
word-break: break-word;
}
}

/* Điện thoại nhỏ */
@media (max-width: 480px) {
body {
padding: 5px;
}

.header-bar div {
font-size: 11px;
}

.header-bar a {
font-size: 11px;
}

.tab-btn {
padding: 8px 10px;
font-size: 12px;
}

.box {
padding: 12px;
border-radius: 6px;
}

h2 {
font-size: 18px;
}

h3 {
font-size: 16px;
}

th, td {
padding: 6px 8px;
font-size: 11px;
}

/* Stack buttons trên mobile */
td .btn-action {
display: inline-block;
margin: 2px;
}

input, textarea, select {
padding: 8px;
font-size: 13px;
}

button {
padding: 10px;
font-size: 13px;
}

.ncc-item {
padding: 8px;
}

.ncc-name {
font-size: 13px;
}

.ncc-details {
font-size: 11px;
}

.selected-ncc-info {
font-size: 12px;
padding: 8px;
}
}

/* Ipad ngang */
@media (min-width: 769px) and (max-width: 1024px) {
.container {
max-width: 95%;
}

th, td {
padding: 10px;
font-size: 12px;
}

.tab-btn {
padding: 10px 20px;
font-size: 14px;
}
}

/* Desktop lớn */
@media (min-width: 1200px) {
.container {
max-width: 1200px;
margin: 0 auto;
}
}

/* Fix cho màn hình rất nhỏ (dưới 360px) */
@media (max-width: 360px) {
.tab-btn {
padding: 6px 8px;
font-size: 11px;
}

.btn-action {
padding: 3px 6px;
font-size: 10px;
}

th, td {
padding: 5px;
font-size: 10px;
}

.badge {
padding: 2px 5px;
font-size: 9px;
}
}

/* Animation cho tab khi chuyển */
.tab-content.active {
animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

/* Style cho hover trên desktop */
@media (min-width: 769px) {
.btn-action:hover {
opacity: 0.8;
transform: translateY(-1px);
transition: all 0.2s;
}

button:hover {
background: #219a52;
transform: translateY(-1px);
transition: all 0.2s;
}

.box:hover {
box-shadow: 0 4px 15px rgba(0,0,0,0.15);
transition: all 0.3s;
}
}

/* In ấn */
@media print {
body {
background: white;
padding: 0;
margin: 0;
}

.header-bar, 
.tabs, 
button, 
.upload-zone, 
.del-btn, 
.btn-action,
.search-container,
.no-print {
display: none !important;
}

.box {
box-shadow: none;
padding: 10px;
margin: 0;
}

table {
page-break-inside: avoid;
}
}

/* Tối ưu touch target cho mobile */
@media (max-width: 768px) {
button, 
.btn-action, 
.tab-btn,
.del-btn,
.clear-search,
.ncc-item {
min-height: 44px; /* Apple's recommended touch target size */
}

.btn-action, .del-btn {
display: inline-flex;
align-items: center;
justify-content: center;
}

input, select, textarea {
font-size: 16px; /* Prevent zoom on focus in iOS */
}
}

/* Loading spinner */
.loading {
opacity: 0.6;
pointer-events: none;
position: relative;
}

.loading::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 20px;
border: 2px solid #ddd;
border-top-color: #27ae60;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}

@keyframes spin {
to { transform: rotate(360deg); }
}

/* Scrollbar đẹp cho mobile khi cuộn ngang table */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}

::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}

::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}