﻿@charset "UTF-8";
/* ==========================================================================
   ui-core.css  -  Bộ component dùng chung (form, nút, bảng, thẻ, thông báo...)
   SimpleSoft - Hệ thống quản lý CNTT | UI Modernization, Đợt 1

   Được nạp CUỐI CÙNG trong <head> của Site.master. Mọi selector có tiền tố "body"
   để thắng CSS riêng của từng trang (cùng 1 class) mà chưa cần sửa từng file.
   Các Đợt sau sẽ rút gọn dần CSS riêng của từng trang.
   Chỉ giao diện - không đụng ID, sự kiện, hay JavaScript.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. THẺ NỘI DUNG & TIÊU ĐỀ
   -------------------------------------------------------------------------- */
body .section {
    margin: 0 0 16px;
    padding: 20px 24px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-1);
}

body .form-title {
    margin: 0 0 16px;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    color: var(--c-text);
}

body .filter-section {
    margin: 0 0 16px;
    padding: 12px 16px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-control);
}

/* --------------------------------------------------------------------------
   2. BIỂU MẪU
      .form-row là cha trực tiếp của các .form-group  ->  lưới tự chia cột
   -------------------------------------------------------------------------- */
body .form-container,
body .form-center {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

body .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px 24px;
    width: 100%;
    max-width: none;
    align-items: start;
}

body .form-row > .form-buttons,
body .form-row > .full-width,
body .form-row > .form-group:has(textarea) {
    grid-column: 1 / -1;
}

body .form-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    width: 100%;
    max-width: none;
    margin: 0;
}

body .form-label {
    flex: 0 0 100%;
    width: auto;
    margin: 0;
    font-size: 13px;
    font-style: normal;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    color: var(--c-text-2);
}

body .form-control,
body input[type="text"],
body input[type="password"],
body input[type="number"],
body input[type="email"],
body input[type="tel"],
body input[type="date"],
body input[type="search"],
body select,
body textarea {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 6px 10px;
    font: 14px/1.5 var(--font-default);
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--r-control);
    transition: border-color .12s ease, box-shadow .12s ease;
}

body textarea {
    min-height: 76px;
    resize: vertical;
}

body .form-control:hover,
body input[type="text"]:hover,
body select:hover,
body textarea:hover {
    border-color: var(--c-text-3);
}

body .form-control:focus,
body input[type="text"]:focus,
body input[type="password"]:focus,
body select:focus,
body textarea:focus {
    outline: none;
    border-color: var(--c-brand);
    box-shadow: 0 0 0 1px var(--c-brand);
}

body .form-control[readonly],
body .form-control:disabled,
body .form-control[disabled],
body .form-control.display-only:disabled,
body input[readonly],
body textarea[readonly] {
    font-style: normal;
    color: var(--c-text-3);
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    opacity: 1;
    cursor: not-allowed;
}

body input[type="checkbox"],
body input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--c-brand);
}

body .form-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    max-width: none;
    margin: 8px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
}

/* --------------------------------------------------------------------------
   3. NÚT
   -------------------------------------------------------------------------- */
body .btn,
body .btn-submit,
body .btn-upload,
body .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-height: 32px;
    margin: 0;
    padding: 5px 14px;
    font: 600 14px/1.4 var(--font-default);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--r-control);
    box-shadow: none;
    transition: var(--btn-transition);
}

/* Hành động chính */
body .btn-primary,
body .btn-submit,
body .btn-upload {
    min-width: 96px;
    color: #ffffff;
    background: var(--btn-bg);
    border-color: var(--btn-bg);
}

body .btn-primary:hover,
body .btn-submit:hover,
body .btn-upload:hover {
    color: #ffffff;
    background: var(--btn-bg-hover);
    border-color: var(--btn-bg-hover);
    text-decoration: none;
}

/* Hành động phụ: nền sáng, viền */
body .btn-generate,
body .btn-select,
body .btn-secondary {
    min-width: 0;
    font-weight: 600;
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
}

body .btn-generate:hover,
body .btn-select:hover,
body .btn-secondary:hover {
    color: var(--c-text);
    background: var(--c-hover);
    text-decoration: none;
}

/* Nút trong form: nhận diện theo ID (đuôi tên control), chỉ đổi màu, không đổi hành vi */
body .form-buttons .btn-primary[id*="Delete" i],
body .form-buttons .btn-primary[id*="Remove" i] {
    background: transparent;
    color: var(--c-danger);
    border-color: var(--c-danger);
}

body .form-buttons .btn-primary[id*="Delete" i]:hover,
body .form-buttons .btn-primary[id*="Remove" i]:hover {
    background: var(--c-danger-tint);
    color: var(--c-danger);
}

body .form-buttons .btn-primary[id*="Cancel" i],
body .form-buttons .btn-primary[id*="Reset" i],
body .form-buttons .btn-primary[id*="Clear" i],
body .form-buttons .btn-primary[id*="Close" i],
body .form-buttons .btn-primary[id*="Back" i] {
    background: var(--c-surface);
    color: var(--c-text);
    border-color: var(--c-border-strong);
}

body .form-buttons .btn-primary[id*="Cancel" i]:hover,
body .form-buttons .btn-primary[id*="Reset" i]:hover,
body .form-buttons .btn-primary[id*="Clear" i]:hover,
body .form-buttons .btn-primary[id*="Close" i]:hover,
body .form-buttons .btn-primary[id*="Back" i]:hover {
    background: var(--c-hover);
    color: var(--c-text);
}

/* Nút thao tác trong bảng: nhỏ, đặc */
body .action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

body .btn-edit,
body .btn-delete,
body .btn-update,
body .btn-cancel,
body .btn-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 3px 10px;
    font: 600 13px/1.4 var(--font-default);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    border: 0;
    border-radius: var(--r-control);
    transition: var(--btn-transition);
}

body .btn-edit   { background: var(--bg-btn-edit); }
body .btn-delete { background: var(--bg-btn-delete); }
body .btn-update { background: var(--bg-btn-update); }
body .btn-cancel { background: var(--bg-btn-cancel); }
body .btn-view   { background: var(--bg-btn-view); }

body .btn-edit:hover   { background: var(--btn-bg-hover); color: #fff; text-decoration: none; }
body .btn-delete:hover { background: var(--btn-danger-hover); color: #fff; text-decoration: none; }
body .btn-update:hover { background: var(--btn-success-hover); color: #fff; text-decoration: none; }
body .btn-cancel:hover { background: var(--btn-neutral-hover); color: #fff; text-decoration: none; }
body .btn-view:hover   { background: var(--bg-btn-view-hover); color: #fff; text-decoration: none; }

body .btn:disabled,
body .btn[disabled],
body .aspNetDisabled.btn {
    opacity: .5;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   4. BẢNG DỮ LIỆU (GridView: .grid, .gridtk, .grid-table)
   -------------------------------------------------------------------------- */
body .grid-wrapper,
body .gridtk-wrapper {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: var(--r-control);
}

body .grid,
body .gridtk,
body .grid-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    background: var(--c-surface);
    font-size: 13px;
}

body .grid-wrapper > .grid,
body .gridtk-wrapper > .gridtk {
    border: 0;
}

body .grid th,
body .gridtk th,
body .grid-table th {
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: var(--grid-text-align-left);
    white-space: nowrap;
    color: var(--c-text-2);
    background: var(--c-surface-2);
    border: 0;
    border-bottom: 1px solid var(--c-border-strong);
}

body .grid td,
body .gridtk td,
body .grid-table td {
    padding: 8px 12px;
    text-align: var(--grid-text-align);
    vertical-align: middle;
    color: var(--c-text);
    border: 0;
    border-bottom: 1px solid var(--c-border);
}

body .grid tr:hover td,
body .gridtk tr:hover td {
    background: var(--c-hover);
}

body .selected-row,
body .grid tr.selected-row td {
    font-weight: 600;
    background: var(--c-brand-tint) !important;
    border-left: 0;
}

body .selected-row td:first-child {
    box-shadow: inset 3px 0 0 var(--c-brand);
}

body .edit-row td {
    background: var(--c-warn-tint);
}

/* Hàng phân trang của GridView */
body .grid tr:last-child > td table td,
body .grid tr:last-child > td table a,
body .grid tr:last-child > td table span {
    padding: 4px 8px;
    border: 0;
    font-size: 13px;
}

/* --------------------------------------------------------------------------
   5. THÔNG BÁO
      Các Label thông báo hiện dùng ForeColor="Red" + Font-Bold (style nội tuyến).
      Chỉ hiện thành khung khi có nội dung; không đổi ID hay logic.
   -------------------------------------------------------------------------- */
body span[style*="color:Red"],
body span[style*="color:red"] {
    color: var(--c-danger) !important;
    font-weight: 600 !important;
}

body span[style*="color:Red"]:not(:empty),
body span[style*="color:red"]:not(:empty) {
    display: block;
    margin: 0 0 16px;
    padding: 10px 14px;
    background: var(--c-danger-tint);
    border: 1px solid var(--c-danger);
    border-radius: var(--r-control);
}

/* Badge dùng cho các trang ở Đợt sau (trạng thái ticket, tồn kho...) */
body .badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    border: 1px solid var(--c-border-strong);
    border-radius: 999px;
    color: var(--c-text-2);
    background: var(--c-surface-2);
}

body .badge-info    { color: var(--c-brand);   background: var(--c-brand-tint);   border-color: var(--c-brand); }
body .badge-success { color: var(--c-success); background: var(--c-success-tint); border-color: var(--c-success); }
body .badge-warning { color: var(--c-warn);    background: var(--c-warn-tint);    border-color: var(--c-warn); }
body .badge-danger  { color: var(--c-danger);  background: var(--c-danger-tint);  border-color: var(--c-danger); }

/* --------------------------------------------------------------------------
   6. MODAL
   -------------------------------------------------------------------------- */
body .modal-background {
    background: rgba(0, 0, 0, .5);
}

body .modal-panel {
    padding: 24px;
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-2);
}

body .modal-header {
    margin-bottom: 16px;
    font-weight: 600;
    text-align: left;
}

/* --------------------------------------------------------------------------
   7. MÀN HÌNH NHỎ
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    body .section {
        padding: 16px;
    }

    body .form-row {
        grid-template-columns: 1fr;
    }

    body .form-buttons .btn {
        flex: 1 1 auto;
    }
}
