/* =====================================================================
 * V2.CSS - Responsive Layout cho dự án xưởng may Hương Trang
 * Nguyên tắc:
 *   - KHÔNG ghi đè màu chữ / màu nền bảng / màu menu của V1
 *   - Chỉ thêm wrapper, khung responsive, hamburger menu, scroll ngang
 *     cho bảng rộng, font-size co giãn
 *   - Tương thích máy tính & mobile
 * ===================================================================== */

/* ----- Reset nhẹ + base ----- */
.v2-body{
    margin:0;
    padding:0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size:15px;
    line-height:1.5;
    background:#f4f6f9;
    color:#222;
    min-height:100vh;
    display:flex;
    flex-direction:column;
}
* { box-sizing: border-box; }

/* ----- HEADER (navbar) ----- */
/* Ép màu chữ trong header luôn là trắng.
   Lý do: mỗi trang V1 có rule riêng "a:link{color:#007700}" / "{#0099FF}" với
   độ ưu tiên (0,1,1) - BẰNG ".v2-header a" (0,1,1). Khi thẻ <link> nằm TRƯỚC
   thẻ <style> trong cùng file (vd edit-san-pham-dieu-chinh.php) thì rule của
   trang thắng, khiến chữ tiêu đề/menu trên nền xanh bị đổi màu và gần như
   không nhìn thấy.
   ".v2-body .v2-header a" có độ ưu tiên (0,2,1) nên luôn thắng, bất kể thứ tự. */
.v2-body .v2-header a,
.v2-body .v2-header a:link,
.v2-body .v2-header a:visited{ color:#fff; }
.v2-body .v2-header .v2-brand-text{ color:#fff; }
.v2-header{
    background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
    color:#fff;
    position:sticky;
    top:0;
    z-index:1000;
    box-shadow:0 2px 6px rgba(0,0,0,0.15);
}
.v2-header-inner{
    max-width:1280px;
    margin:0 auto;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 16px;
    flex-wrap:wrap;
    gap:10px;
}
/* ----- NÚT HOME (tròn, icon ngôi nhà đặc - có mái, tường, cửa) ----- */
.v2-home-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    border-radius:50%;
    background:linear-gradient(135deg, #2aa1ff 0%, #0d6efd 60%, #0a58ca 100%);
    color:#fff;
    text-decoration:none;
    flex:0 0 auto;
    box-shadow:0 3px 8px rgba(13,110,253,0.45), inset 0 -2px 0 rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    position:relative;
    overflow:hidden;
}
.v2-home-btn::after{
    content:"";
    position:absolute;
    inset:0;
    background:radial-gradient(circle at 30% 25%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 55%);
    pointer-events:none;
}
.v2-home-btn:hover{
    background:linear-gradient(135deg, #0d6efd 0%, #0a58ca 60%, #084298 100%);
    transform: translateY(-1px) scale(1.04);
    box-shadow:0 5px 14px rgba(13,110,253,0.6), inset 0 -2px 0 rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.25);
}
.v2-home-btn:active{ transform: translateY(0) scale(0.98); }
.v2-home-btn:focus-visible{
    outline:3px solid #ffd54f;
    outline-offset:2px;
}
.v2-home-btn svg{
    width:26px;
    height:26px;
    display:block;
    position:relative;
    z-index:1;
}
.v2-brand{
    color:#fff;
    text-decoration:none;
    font-weight:700;
    font-size:16px;
    display:flex;
    align-items:center;
    gap:10px;
    flex:1 1 auto;
    min-width:0;
}
.v2-brand-mark{ display:none; } /* Ẩn dấu ● cũ */
.v2-brand-home{ padding:0; }
.v2-brand-text{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    letter-spacing:0.3px;
}
.v2-burger{
    display:none;
    background:transparent;
    border:0;
    width:40px;
    height:40px;
    cursor:pointer;
    padding:8px;
    border-radius:6px;
}
.v2-burger:hover{ background:rgba(255,255,255,0.15); }
.v2-burger span{
    display:block;
    width:100%;
    height:3px;
    background:#fff;
    margin:4px 0;
    border-radius:2px;
    transition: transform .25s ease, opacity .25s ease;
}
.v2-burger-open span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.v2-burger-open span:nth-child(2){ opacity:0; }
.v2-burger-open span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

.v2-nav{
    flex:0 1 auto;
}
.v2-nav-list{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    gap:4px;
    flex-wrap:wrap;
}
.v2-nav-item a{
    display:block;
    color:#fff;
    text-decoration:none;
    padding:8px 14px;
    border-radius:6px;
    font-size:14px;
    font-weight:500;
    transition: background .15s ease;
    white-space:nowrap;
}
.v2-nav-item a:hover{ background:rgba(255,255,255,0.18); }
.v2-nav-item.v2-active a{
    background:rgba(255,255,255,0.25);
    box-shadow: inset 0 -2px 0 #ffd54f;
}

/* ----- MAIN ----- */
.v2-main{
    flex:1 1 auto;
    width:100%;
    max-width:1280px;
    margin:0 auto;
    padding:16px;
}
/* Khi không có header (vd login), main full-width */
.v2-body:not(.v2-has-menu) .v2-main{
    max-width:100%;
    padding:0;
}

/* ----- FOOTER ----- */
/* Nền xanh lá cây. Chữ màu trắng để đọc rõ trên nền xanh. */
.v2-footer{
    background:#2e7d32;
    color:#ffffff;
    font-size:13px;
    margin-top:auto;
}
.v2-footer-inner{
    max-width:1280px;
    margin:0 auto;
    padding:12px 16px;
    display:flex;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:8px;
}

/* ----- TABLE WRAPPER: cho phép cuộn ngang trên mobile ----- */
.v2-body .v2-table-wrap{
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    margin:12px 0;
    border-radius:6px;
    /* Fix: clear mọi float phía trên (vd #gocphai đặt nút "+ Thêm đơn hàng mới"),
       và chiếm trọn chiều rộng của .v2-main để bảng không bị đẩy ra ngoài viewport */
    clear:both;
    width:100%;
    box-sizing:border-box;
}
.v2-body .v2-table-wrap table{
    width:100%;
    min-width:480px;
    border-collapse:collapse;
}

/* ----- FORM RESPONSIVE (opt-in): chỉ áp dụng cho form ngang (search/filter) ----- */
/* Lưu ý: KHÔNG set flex cho mọi form vì sẽ phá vỡ các form dạng stack (label trên input)
   của trang sửa/thêm sản phẩm, thêm thành viên... */
.v2-form-row{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
}
.v2-form-row > *{ flex:1 1 auto; min-width:0; }
.v2-form-row input[type=text],
.v2-form-row input[type=number],
.v2-form-row input[type=date],
.v2-form-row input[type=email],
.v2-form-row input[type=password],
.v2-form-row select{
    min-width:120px;
    max-width:100%;
}
.v2-form-row input[type=submit],
.v2-form-row button[type=submit]{
    flex:0 0 auto;
}

/* ----- H1, H2: tiêu đề responsive ----- */
.v2-body h1{
    font-size: clamp(18px, 4vw, 26px);
    margin:8px 0 14px;
    text-align:center;
    line-height:1.3;
}
.v2-body h2{
    font-size: clamp(16px, 3.5vw, 22px);
    margin:8px 0 12px;
    line-height:1.3;
}
.v2-body h3{
    font-size: clamp(15px, 3vw, 19px);
    margin:6px 0 10px;
}

/* ----- PARAGRAPH & TABLE CELLS: font co giãn nhẹ ----- */
.v2-body p, .v2-body td, .v2-body th, .v2-body label{
    font-size: clamp(13px, 2.6vw, 15px);
}

/* ----- Khoảng cách an toàn cho nút bấm trên mobile ----- */
.v2-body button, .v2-body input[type=submit], .v2-body .v2-btn{
    min-height:36px;
    padding:8px 14px;
    border-radius:6px;
    cursor:pointer;
}

/* ===== Mobile ===== */
@media (max-width: 768px){
    .v2-burger{ display:block; }
    .v2-nav{
        order:3;
        flex:1 1 100%;
        max-height:0;
        overflow:hidden;
        transition: max-height .3s ease;
    }
    .v2-nav.v2-open{
        max-height:80vh;
        overflow-y:auto;
    }
    .v2-nav-list{
        flex-direction:column;
        background: rgba(13,110,253,0.95);
        border-radius:8px;
        padding:6px;
        margin-top:8px;
    }
    .v2-nav-item a{
        padding:12px 14px;
        font-size:15px;
        border-radius:6px;
    }
    .v2-nav-item.v2-active a{
        box-shadow: inset 4px 0 0 #ffd54f;
    }
    .v2-main{ padding:10px; }
    .v2-header-inner{ padding:8px 10px; }
    .v2-brand-text{ font-size:14px; }
    .v2-footer-inner{ font-size:12px; padding:8px 10px; }
}

@media (max-width: 480px){
    .v2-main{ padding:8px; }
    .v2-brand-text{ display:none; }
    .v2-home-btn{ width:40px; height:40px; }
    .v2-home-btn svg{ width:22px; height:22px; }
}

/* ===== In ấn: bỏ qua header/footer ===== */
@media print{
    .v2-header, .v2-footer{ display:none !important; }
    .v2-main{ padding:0; }
    .v2-body{ background:#fff; }
}

/* ===== Utility: tràn ngang an toàn cho khối nội dung (pre, code, iframe) ===== */
.v2-body pre, .v2-body code{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    max-width:100%;
}

/* ===== Responsive form: Inputs trong .container không bị tràn ===== */
.v2-body .container input[type=text],
.v2-body .container input[type=number],
.v2-body .container input[type=date],
.v2-body .container input[type=email],
.v2-body .container input[type=password],
.v2-body .container select,
.v2-body .container textarea{
    max-width:100%;
}

@media (max-width: 768px){
    /* Giảm padding container trên mobile */
    .v2-body .container{ padding:14px; }
    /* Cho phép table có cuộn ngang - áp dụng cho bất kỳ table trong main */
    .v2-body table{ max-width:100%; }
    .v2-body .v2-table-wrap table{ min-width:520px; }
}

@media (max-width: 480px){
    .v2-body .container{ padding:10px; }
}

/* ===== Tránh select2 / custom dropdowns bị tràn trên mobile ===== */
.v2-body .select2-container{ max-width:100% !important; }
.v2-body .select2-container .select2-selection{ min-height:36px; }
.v2-body img{ max-width:100%; height:auto; }

/* ===== Alert / thông báo V2 (cho phép giữ footer khi cảnh báo) ===== */
.v2-alert{
    max-width:640px;
    margin:24px auto;
    padding:14px 18px;
    border-radius:8px;
    font-size:15px;
    text-align:center;
    border:1px solid transparent;
    line-height:1.5;
}
.v2-alert-danger{
    background:#fff3f3;
    color:#a30000;
    border-color:#f3b3b3;
}
.v2-alert-success{
    background:#f0fbf0;
    color:#1d6f1d;
    border-color:#b3e0b3;
}
.v2-alert-info{
    background:#eef5ff;
    color:#0a3d80;
    border-color:#b3cdf2;
}

/* ===== Bảng thành viên (override style cũ #id1 th,td width:200px) ===== */
/* Áp dụng cho bảng có class v2-table-thanhvien - ghi đè width cố định của style inline cũ */
.v2-table-wrap table.v2-table-thanhvien,
#id1 table.v2-table-thanhvien{
    width:100%;
    min-width:520px;
    border-collapse:collapse;
    background:#fff;
}
.v2-table-wrap table.v2-table-thanhvien th,
#id1 table.v2-table-thanhvien th,
.v2-table-wrap table.v2-table-thanhvien td,
#id1 table.v2-table-thanhvien td{
    width:auto !important;
    min-width:90px;
    height:auto !important;
    padding:12px 10px;
    border:1px solid #cbd5e1;
    text-align:center;
    font-size:15px;
    vertical-align:middle;
    white-space:nowrap;
}
.v2-table-wrap table.v2-table-thanhvien th,
#id1 table.v2-table-thanhvien th{
    background:linear-gradient(180deg, #2aa1ff 0%, #0d6efd 100%);
    color:#fff;
    font-weight:700;
    font-size:15px;
    white-space:nowrap;
}
.v2-table-wrap table.v2-table-thanhvien tr:nth-child(odd),
#id1 table.v2-table-thanhvien tr:nth-child(odd){
    background:#f4f7fb;
}
.v2-table-wrap table.v2-table-thanhvien tr:nth-child(even),
#id1 table.v2-table-thanhvien tr:nth-child(even){
    background:#ffffff;
}
.v2-table-wrap table.v2-table-thanhvien tr:hover,
#id1 table.v2-table-thanhvien tr:hover{
    background:#fff7d6;
}
.v2-table-wrap table.v2-table-thanhvien td a,
#id1 table.v2-table-thanhvien td a{
    color:#0d6efd;
    text-decoration:none;
    font-weight:600;
}
.v2-table-wrap table.v2-table-thanhvien td a:hover,
#id1 table.v2-table-thanhvien td a:hover{
    color:#a30000;
    text-decoration:underline;
}
@media (max-width: 768px){
    .v2-table-wrap table.v2-table-thanhvien th,
    #id1 table.v2-table-thanhvien th,
    .v2-table-wrap table.v2-table-thanhvien td,
    #id1 table.v2-table-thanhvien td{
        font-size:13px;
        padding:8px 6px;
        min-width:70px;
    }
}

/* ===== BANDO / SITEMAP - dạng bảng với font to ===== */
.v2-sitemap-hero{
    text-align:center;
    padding:22px 12px 10px;
}
.v2-sitemap-hero h1{
    font-size:clamp(22px, 4.6vw, 34px);
    color:#0a3d80;
    margin:0 0 6px;
    font-weight:800;
    letter-spacing:0.5px;
}
.v2-sitemap-hero .v2-sitemap-sub{
    color:#4a5568;
    font-size:clamp(15px, 2.8vw, 19px);
    margin:0 0 8px;
}
.v2-sitemap-user{
    display:inline-block;
    margin:8px 0 0;
    padding:8px 18px;
    background:#e7f0ff;
    color:#0a3d80;
    border:1px solid #b3cdf2;
    border-radius:22px;
    font-size:16px;
    font-weight:600;
}
.v2-sitemap-table-wrap{
    max-width:1100px;
    margin:18px auto 32px;
    padding:0 12px;
}
.v2-sitemap-table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    background:#fff;
    border:1px solid #cbd5e1;
    border-radius:10px;
    overflow:hidden;
    box-shadow:0 2px 6px rgba(0,0,0,0.06);
    overflow-x:auto;
    display:block;
}
@media (min-width: 769px){
    .v2-sitemap-table{ display:table; }
}
.v2-sitemap-table thead th{
    background:linear-gradient(180deg, #2aa1ff 0%, #0a58ca 100%);
    color:#fff;
    text-align:left;
    padding:14px 16px;
    font-size:18px;
    font-weight:700;
    letter-spacing:0.3px;
    white-space:nowrap;
}
.v2-sitemap-table thead th:first-child{ width:80px; text-align:center; }
.v2-sitemap-table thead th:nth-child(2){ width:100px; text-align:center; }
.v2-sitemap-table tbody td{
    padding:16px 18px;
    font-size:19px;
    font-weight:500;
    color:#1a202c;
    border-top:1px solid #e2e8f0;
    vertical-align:middle;
    line-height:1.4;
}
.v2-sitemap-table tbody td:nth-child(1){
    text-align:center;
    font-weight:700;
    color:#0a3d80;
    background:#f4f7fb;
    font-size:18px;
}
.v2-sitemap-table tbody td:nth-child(2){
    text-align:center;
    font-size:28px;
    line-height:1;
}
.v2-sitemap-table tbody td:nth-child(3) a{
    color:#0d6efd;
    text-decoration:none;
    font-weight:700;
    display:inline-flex;
    align-items:center;
    gap:8px;
}
.v2-sitemap-table tbody td:nth-child(3) a:hover{
    color:#a30000;
    text-decoration:underline;
}
.v2-sitemap-table tbody tr.v2-sitemap-logout td:nth-child(3) a{
    color:#a30000;
}
.v2-sitemap-table tbody tr.v2-sitemap-logout td:nth-child(3) a:hover{
    color:#7a0000;
}
.v2-sitemap-table tbody tr:hover td{
    background:#fff7d6;
}
.v2-sitemap-table tbody tr:hover td:nth-child(1){
    background:#ffe9a8;
}
.v2-sitemap-table tbody tr.v2-sitemap-cat td{
    background:linear-gradient(90deg, #0a3d80 0%, #0d6efd 100%);
    color:#fff;
    font-weight:800;
    font-size:18px;
    padding:12px 16px;
    letter-spacing:0.5px;
    border-top:0;
}
.v2-sitemap-table tbody tr.v2-sitemap-cat td:nth-child(1){
    background:transparent;
    color:#fff;
}
.v2-sitemap-empty{
    text-align:center;
    color:#4a5568;
    padding:30px 12px;
    font-size:18px;
    font-weight:600;
}
@media (max-width: 768px){
    .v2-sitemap-table thead th{ font-size:15px; padding:10px 10px; }
    .v2-sitemap-table tbody td{ font-size:16px; padding:10px 10px; }
    .v2-sitemap-table tbody td:nth-child(2){ font-size:20px; }
    .v2-sitemap-table tbody tr.v2-sitemap-cat td{ font-size:15px; }
    .v2-sitemap-hero h1{ font-size:22px; }
    .v2-sitemap-hero .v2-sitemap-sub{ font-size:14px; }
    .v2-sitemap-user{ font-size:14px; padding:6px 12px; }
}

/* =====================================================================
 * AUTH PAGES (login / register / remember)
 * Header + footer giống các trang V2, form căn giữa trong .v2-main
 * ===================================================================== */
.v2-auth-wrap{
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    min-height: 60vh;
}
.v2-auth-box{
    width: 100%;
    max-width: 440px;
}
.v2-auth-card{
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    padding: 40px 40px 32px;
    background: linear-gradient(180deg, #7579ff 0%, #b224ef 100%);
    text-align: center;
    box-shadow: 0 14px 36px rgba(99, 56, 255, 0.28);
    color: #fff;
}
.v2-auth-title{
    font-size: clamp(20px, 4vw, 26px);
    color: #fff;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    margin: 0 0 24px;
    font-weight: 700;
}
.v2-auth-card input[type=text],
.v2-auth-card input[type=password]{
    font-family: inherit;
    font-size: 16px;
    color: #fff;
    line-height: 1.3;
    display: block;
    width: 100%;
    height: 46px;
    background: transparent;
    padding: 10px 4px;
    border: 0;
    border-bottom: 2px solid rgba(255,255,255,.28);
    outline: 0;
    margin-bottom: 14px;
}
.v2-auth-card input::placeholder{ color: rgba(255,255,255,.85); }
.v2-auth-card input[type=text]:focus,
.v2-auth-card input[type=password]:focus{
    border-bottom-color: #ffd54f;
    color: #fff;
}
.v2-auth-card input[type=submit]{
    font-size: 16px;
    color: #333;
    line-height: 1.2;
    padding: 0 24px;
    min-width: 130px;
    height: 46px;
    border-radius: 24px;
    background: #fff;
    border: 0;
    outline: 0;
    display: inline-block;
    margin: 18px auto 8px;
    cursor: pointer;
    font-weight: 600;
}
.v2-auth-card input[type=submit]:hover{ background: #ffd54f; }
.v2-auth-card .v2-auth-warn{
    color: #FFEE58;
    font-size: 15px;
    display: block;
    margin: 0 0 14px;
    line-height: 1.5;
}
.v2-auth-card .v2-auth-warn p{ margin: 4px 0; }
.v2-auth-card .v2-auth-success{
    color: #fff;
    font-size: 17px;
    line-height: 1.55;
}
.v2-auth-card .v2-auth-success .v2-msbm{
    color: #FFEB3B;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    display: inline-block;
    margin: 8px 0 14px;
    padding: 6px 14px;
    border: 2px dashed rgba(255,255,255,.55);
    border-radius: 8px;
}
.v2-auth-card .v2-auth-links{
    margin-top: 14px;
    color: #fff;
    font-size: 14px;
}
.v2-auth-card .v2-auth-links a{
    color: #FFEB3B;
    text-decoration: underline;
    margin: 0 4px;
}
.v2-auth-card .v2-auth-links a:hover{ color: #ffd54f; }
.v2-auth-card .v2-auth-submit-row{ text-align: center; }

@media (max-width: 480px){
    .v2-auth-wrap{ padding: 16px 12px; }
    .v2-auth-card{ padding: 32px 22px 26px; border-radius: 10px; }
    .v2-auth-title{ font-size: 20px; margin-bottom: 18px; }
    .v2-auth-card input[type=text],
    .v2-auth-card input[type=password]{ font-size: 15px; height: 44px; }
    .v2-auth-card input[type=submit]{ min-width: 110px; height: 44px; }
}