/* ============================================
   Design system - inspired by luutru.anm-design.biz.vn
   ============================================ */

/* Font */
body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background: #f9fafb;
    color: #111827;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* ---- Top Navbar ---- */
.top-navbar {
    background: #1739b4;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-navbar .nav-brand {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 32px;
}

.top-navbar .nav-brand:hover {
    color: #fff;
}

.top-navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

.top-navbar .nav-link {
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
}

.top-navbar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.top-navbar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.2);
}

.top-navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.top-navbar .nav-search {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
    outline: none;
}

.top-navbar .nav-search::placeholder {
    color: rgba(255,255,255,0.6);
}

.top-navbar .nav-search:focus {
    background: rgba(255,255,255,0.25);
}

.top-navbar .nav-user {
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.15s;
    border: none;
    background: none;
}

.top-navbar .nav-user:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* ---- Page Container ---- */
.page-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 4px 0 0 0;
}

/* ---- Stat Cards ---- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid transparent;
}

.stat-card.blue { border-left-color: #1739b4; }
.stat-card.green { border-left-color: #16a34a; }
.stat-card.red { border-left-color: #dc2626; }
.stat-card.yellow { border-left-color: #ca8a04; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #eff6ff; color: #1739b4; }
.stat-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }
.stat-icon.yellow { background: #fefce8; color: #ca8a04; }

.stat-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 400;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

/* ---- Content Card / Table Container ---- */
.content-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.content-card-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.content-card-body {
    padding: 24px;
}

/* Backward compatible */
.table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    padding: 24px;
    margin-bottom: 24px;
}

/* ---- Filter Bar ---- */
.filter-bar {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    padding: 16px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-control,
.filter-bar .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 14px;
    height: 38px;
    background: #fff;
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: #1739b4;
    box-shadow: 0 0 0 2px rgba(23,57,180,0.15);
}

/* ---- Buttons ---- */
.btn-blue {
    background: #1739b4;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
    text-decoration: none;
}

.btn-blue:hover {
    background: #1230a0;
    color: #fff;
}

.btn-outline-gray {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-outline-gray:hover {
    background: #f9fafb;
    color: #111827;
}

/* ---- Table ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: transparent;
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 24px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

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

.data-table .text-link {
    color: #1739b4;
    font-weight: 600;
    text-decoration: none;
}

.data-table .text-link:hover {
    text-decoration: underline;
}

.data-table .text-bold {
    font-weight: 600;
    color: #111827;
}

/* Action links in table */
.action-link {
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    margin-right: 12px;
}

.action-link.view { color: #1a5af1; }
.action-link.edit { color: #ca8a04; }
.action-link.delete { color: #dc2626; }
.action-link.revoke { color: #dc2626; }

.action-link:hover {
    text-decoration: underline;
}

/* ---- Badges ---- */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }

/* ---- Pagination ---- */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 16px 24px;
}

.pagination-bar .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.pagination-bar .page-btn:hover {
    background: #f3f4f6;
}

.pagination-bar .page-btn.active {
    background: #1739b4;
    color: #fff;
    border-color: #1739b4;
}

.pagination-bar .page-info {
    font-size: 13px;
    color: #6b7280;
    margin: 0 8px;
}

/* ---- Login ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1739b4;
}

.login-card {
    width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    padding: 40px;
}

.login-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    margin-bottom: 4px;
}

.login-card .subtitle {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 28px;
}

.login-card .form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.login-card .form-control {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
}

.login-card .form-control:focus {
    border-color: #1739b4;
    box-shadow: 0 0 0 2px rgba(23,57,180,0.15);
}

.login-card .btn-login {
    width: 100%;
    background: #1739b4;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.login-card .btn-login:hover {
    background: #1230a0;
}

/* ---- Forms ---- */
.form-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    padding: 32px;
    max-width: 700px;
}

.form-card .form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-card .form-control,
.form-card .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
}

.form-card .form-control:focus,
.form-card .form-select:focus {
    border-color: #1739b4;
    box-shadow: 0 0 0 2px rgba(23,57,180,0.15);
}

/* ---- Tabs ---- */
.nav-tabs-custom {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.nav-tabs-custom .tab-link {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    cursor: pointer;
}

.nav-tabs-custom .tab-link:hover {
    color: #111827;
}

.nav-tabs-custom .tab-link.active {
    color: #1739b4;
    border-bottom-color: #1739b4;
}

/* ---- Info Table (detail pages) ---- */
.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 500;
    font-size: 13px;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    width: 160px;
    white-space: nowrap;
}

.info-table td {
    padding: 10px 16px;
    font-size: 14px;
    color: #111827;
    border: 1px solid #e5e7eb;
}

/* ---- Modal overrides ---- */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 16px 24px;
}

.modal-body .form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.modal-body .form-control,
.modal-body .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: #1739b4;
    box-shadow: 0 0 0 2px rgba(23,57,180,0.15);
}

/* ---- Alert ---- */
.alert-toast {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 1100;
    min-width: 300px;
    max-width: 450px;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

.alert-toast.success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #16a34a;
}

.alert-toast.danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Dropdown overrides ---- */
.dropdown-menu {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 4px;
}

.dropdown-item {
    border-radius: 6px;
    font-size: 14px;
    padding: 8px 12px;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .top-navbar {
        padding: 0 12px;
    }

    .top-navbar .nav-links {
        display: none;
    }

    .page-container {
        padding: 16px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
}

/* ---- Utilities ---- */
.text-empty {
    text-align: center;
    color: #9ca3af;
    padding: 40px 24px;
    font-size: 14px;
}

.code-text {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 13px;
    color: #374151;
}
