/* =======================================================================
   HỆ THỐNG ĐĂNG KÝ & QUẢN LÝ NHÀ PHÂN PHỐI - FNTU
   CSS Styling - Design System FNTU
   ======================================================================= */

:root {
    --brand-primary: #008744;        /* FNTU Green */
    --brand-primary-dark: #006332;   /* Deep Green */
    --brand-primary-light: #e8f5e9;  /* Light Green BG */
    --brand-accent: #d92525;         /* FNTU Red */
    --brand-accent-dark: #b71c1c;    /* Deep Red */
    --brand-accent-light: #ffebee;   /* Light Red BG */
    --brand-gold: #f59e0b;           /* Amber / Gold */
    --brand-dark: #0f172a;           /* Slate 900 */
    --brand-sidebar: #0f2319;        /* Premium Dark Green Sidebar */
    --brand-card-bg: #ffffff;
    --brand-border: #e2e8f0;
    --brand-text: #1e293b;
    --brand-text-muted: #64748b;
    --brand-bg: #f8fafc;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 12px 28px rgba(0, 135, 68, 0.15);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 85px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--brand-text);
    background-color: var(--brand-bg);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Custom Navbar */
.navbar-main {
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    padding: 4px 0;
    transition: all 0.3s ease;
    z-index: 1030;
}
.navbar-brand-custom {
    padding: 2px 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.navbar-logo {
    height: 74px;
    width: auto;
    max-width: 260px;
    object-fit: contain;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.navbar-brand-custom:hover .navbar-logo {
    transform: scale(1.03);
}

.navbar-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
}
.nav-link-custom {
    font-weight: 600;
    color: #334155 !important;
    padding: 8px 14px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    font-size: 0.93rem;
    white-space: nowrap !important;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.nav-link-custom i {
    font-size: 0.95rem;
    color: #64748b;
    transition: color 0.2s ease;
}
.nav-link-custom:hover {
    color: var(--brand-primary) !important;
    background: var(--brand-primary-light);
}
.nav-link-custom:hover i {
    color: var(--brand-primary);
}
.nav-link-custom.active {
    color: var(--brand-primary) !important;
    background: var(--brand-primary-light);
    font-weight: 700;
}
.nav-link-custom.active i {
    color: var(--brand-primary);
}

.navbar-actions {
    flex-shrink: 0;
    white-space: nowrap !important;
}
.btn-nav-login {
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap !important;
    border: 1.5px solid #008744;
    color: #008744;
    background: transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-nav-login:hover {
    background: #008744;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 135, 68, 0.25);
    transform: translateY(-1px);
}
.btn-nav-register {
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap !important;
    box-shadow: 0 4px 12px rgba(0, 135, 68, 0.3);
}
.btn-nav-action {
    white-space: nowrap !important;
    font-size: 0.9rem;
    padding: 8px 16px;
}

/* Buttons */
.btn-brand {
    background-color: var(--brand-primary);
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 135, 68, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-brand:hover {
    background-color: var(--brand-primary-dark);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 135, 68, 0.35);
}
.btn-brand-accent {
    background-color: var(--brand-accent);
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(217, 37, 37, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-brand-accent:hover {
    background-color: var(--brand-accent-dark);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 37, 37, 0.35);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #024120 0%, #006332 50%, #008744 100%);
    color: #ffffff;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}
.hero-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
}
.hero-badge {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Cards */
.card-custom {
    background: #ffffff;
    border: 1px solid var(--brand-border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    overflow: hidden;
}
.card-custom:hover {
    box-shadow: var(--shadow-md);
}
.card-header-custom {
    background: #ffffff;
    border-bottom: 1px solid var(--brand-border);
    padding: 16px 22px;
    font-weight: 700;
    font-size: 1.05rem;
}

/* Stat Cards */
.stat-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--brand-border);
    padding: 14px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 0;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-icon-emerald { background: #d1fae5; color: #008744; }
.stat-icon-amber   { background: #fef3c7; color: #d97706; }
.stat-icon-indigo  { background: #e0e7ff; color: #4338ca; }
.stat-icon-rose    { background: #ffebee; color: #d92525; }

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
}
.stat-value-money {
    font-size: 1.15rem;
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--brand-text-muted);
    font-weight: 600;
    line-height: 1.25;
    margin-top: 3px;
    white-space: normal;
}

/* Badges */
.badge {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.775rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap !important;
}
.badge-warning  { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-info     { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-primary  { background-color: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge-orange   { background-color: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.badge-success  { background-color: #d1fae5; color: #006332; border: 1px solid #a7f3d0; }
.badge-danger   { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-secondary{ background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* Stepper / Timeline */
.step-tracker {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 25px 0;
}
.step-tracker::before {
    content: '';
    position: absolute;
    top: 22px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: #e2e8f0;
    z-index: 1;
}
.step-item {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}
.step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #cbd5e1;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto 8px auto;
    transition: all 0.3s;
    font-size: 0.95rem;
}
.step-item.active .step-circle {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 135, 68, 0.2);
}
.step-item.completed .step-circle {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #ffffff;
}
.step-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}
.step-item.active .step-title {
    color: var(--brand-primary);
    font-weight: 700;
}

/* Sidebar Layout for Admin / Portal */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}
.app-sidebar {
    width: 260px;
    background-color: var(--brand-sidebar);
    color: #94a3b8;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-header {
    padding: 16px 20px;
    background: #091711;
    border-bottom: 1px solid #163628;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-header img {
    height: 38px;
    width: auto;
}
.sidebar-menu {
    list-style: none;
    padding: 12px 10px;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}
.sidebar-menu li {
    margin-bottom: 3px;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.885rem;
    border-radius: 8px;
    transition: all 0.18s;
}
.sidebar-menu a:hover, .sidebar-menu a.active {
    color: #ffffff;
    background-color: #163628;
    border-left: 4px solid var(--brand-primary);
}
.sidebar-menu .menu-category {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    font-weight: 700;
    padding: 12px 14px 4px;
}
.app-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    overflow-x: clip;
    min-width: 0;
}
.app-topbar {
    min-height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.app-main {
    padding: 24px;
    flex-grow: 1;
}

/* Sidebar Toggle & Mobile Backdrop */
.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #334155;
    font-size: 1.25rem;
    padding: 6px 10px;
    border-radius: 6px;
}
.btn-sidebar-toggle:hover {
    background: #f1f5f9;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1030;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Tables */
.table-custom {
    background: #ffffff;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    width: 100%;
}
.table-custom thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 9px 10px;
    border-bottom: 1px solid var(--brand-border);
}
.table-custom tbody td {
    padding: 9px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.875rem;
}
.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Custom Sleek Scrollbar for Tables */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modern Segment Tabs */
.nav-segment-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 0;
}
.nav-segment-tabs .nav-link {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.nav-segment-tabs .nav-link:hover {
    background: #f8fafc;
    color: var(--brand-primary);
    border-color: #cbd5e1;
}
.nav-segment-tabs .nav-link.active {
    background: var(--brand-primary) !important;
    color: #ffffff !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 2px 8px rgba(0, 135, 68, 0.22);
}
.nav-segment-tabs .nav-link.active i {
    color: #ffffff !important;
}
.nav-segment-tabs .nav-link.active .badge {
    background-color: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
}

/* Product Pricing Grid */
.price-tag-retail {
    font-size: 0.825rem;
    color: #94a3b8;
    text-decoration: line-through;
}
.price-tag-wholesale {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--brand-primary);
}
.discount-pill {
    background: var(--brand-primary-light);
    color: var(--brand-primary-dark);
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.775rem;
    border: 1px solid #a7f3d0;
}

/* Maximum width helper classes */
.max-w-400 { max-width: 400px; }
.max-w-500 { max-width: 500px; }
.max-w-600 { max-width: 600px; }
.max-w-700 { max-width: 700px; }
.max-w-800 { max-width: 800px; }
.max-w-900 { max-width: 900px; }

/* Responsive adjustments for Tablets & Smartphones */
@media (max-width: 991.98px) {
    .navbar-logo, .navbar-brand-custom img {
        height: 68px;
        max-width: 230px;
    }
    .navbar-collapse .navbar-nav {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        padding-top: 12px;
    }
    .navbar-collapse .navbar-actions {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px !important;
        padding-bottom: 8px;
    }
    .navbar-collapse .navbar-actions .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .btn-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .app-wrapper {
        display: block;
        width: 100%;
        min-height: 100vh;
    }
    .app-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 275px !important;
        max-width: 82vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1060 !important;
        transform: translateX(-100%) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    .app-sidebar.show {
        transform: translateX(0) !important;
    }
    .sidebar-backdrop {
        z-index: 1050 !important;
    }
    .app-content {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    /* Cố định Header tuyệt đối trên mobile & tablet */
    .app-topbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 58px !important;
        min-height: 58px !important;
        z-index: 1040 !important;
        padding: 8px 16px !important;
        background: #ffffff !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important;
    }
    .app-main {
        padding: 16px 12px !important;
        padding-top: 72px !important;
    }
    .hero-section {
        padding: 40px 0;
        text-align: center;
    }
    .hero-title {
        font-size: 1.85rem;
    }
    .step-tracker::before {
        display: none;
    }
    .step-tracker {
        flex-wrap: wrap;
        gap: 12px;
    }
    .step-item {
        flex: 1 1 30%;
        margin-bottom: 10px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-value {
        font-size: 1.3rem;
    }
}

@media (max-width: 767.98px) {
    .app-main {
        padding: 10px 6px !important;
        padding-top: 68px !important;
    }
    .card-custom {
        padding: 12px 10px;
        border-radius: 10px;
    }
    .card-custom.p-4 {
        padding: 12px 8px !important;
    }
    .table-custom thead th {
        padding: 8px 8px;
        font-size: 0.76rem;
    }
    .table-custom tbody td {
        padding: 8px 8px;
        font-size: 0.82rem;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0;
    }
    /* 4 nút tab hồ sơ: 2 trên 2 dưới trên mobile */
    .nav-segment-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .nav-segment-tabs .nav-item {
        width: 100% !important;
        display: flex !important;
    }
    .nav-segment-tabs .nav-link {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 10px 6px !important;
        font-size: 0.78rem !important;
        line-height: 1.25 !important;
        gap: 4px !important;
        white-space: normal !important;
        min-height: 60px !important;
        border-radius: 10px !important;
    }
    .nav-segment-tabs .nav-link span {
        font-size: 0.76rem !important;
        font-weight: 600 !important;
    }
    .nav-segment-tabs .nav-link i {
        font-size: 1.05rem !important;
    }
    .nav-segment-tabs .nav-link .badge {
        font-size: 0.68rem !important;
        padding: 2px 6px !important;
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 1.55rem;
    }
    .hero-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    .step-item {
        flex: 1 1 45%;
    }
    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    .step-title {
        font-size: 0.72rem;
    }
    .navbar-brand-custom img,
    .navbar-logo {
        height: 62px !important;
        max-width: 210px !important;
    }
    .navbar-toggler {
        padding: 4px 8px;
        font-size: 1.15rem;
    }
    .btn-brand, .btn-brand-accent {
        padding: 8px 14px;
        font-size: 0.875rem;
    }
    .card-custom {
        padding: 14px 12px;
    }
    .card-custom.p-4 {
        padding: 14px 12px !important;
    }
}

/* Printable styles */
@media print {
    .no-print, .app-sidebar, .app-topbar, .btn, .btn-sidebar-toggle, .sidebar-backdrop {
        display: none !important;
    }
    .app-content, .app-main {
        padding: 0 !important;
        background: #ffffff !important;
    }
    .card-custom {
        box-shadow: none !important;
        border: none !important;
    }
}
