/* ========================================
   Taihe Yoga Management System - site.css
   ======================================== */

:root {
    --primary: #1A7A6D;
    --primary-light: #2A9D8F;
    --primary-dark: #145F55;
    --secondary: #2C3E50;
    --secondary-light: #34495E;
    --accent: #E76F51;
    --bg: #F4F6F9;
    --white: #FFFFFF;
    --text: #333333;
    --text-light: #6C757D;
    --border: #DEE2E6;
    --success: #28A745;
    --warning: #FFC107;
    --danger: #DC3545;
    --info: #17A2B8;
    --sidebar-width: 250px;
    --header-height: 56px;
}

/* ============ RESET & BASE ============ */
* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    font-size: 14px;
    color: var(--text);
    background-color: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: none; }

/* ============ TOP HEADER ============ */
.top-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--primary);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.top-header .brand {
    width: var(--sidebar-width);
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.top-header .brand i { margin-right: 8px; color: var(--warning); }

.top-header .header-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
}

.top-header .sidebar-toggle {
    background: none; border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.top-header .sidebar-toggle:hover { background: rgba(255,255,255,0.15); }

.top-header .search-box {
    position: relative;
    width: 300px;
}
.top-header .search-box input {
    width: 100%;
    height: 34px;
    border: none;
    border-radius: 17px;
    padding: 0 36px 0 14px;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    font-size: 13px;
    outline: none;
    transition: background 0.2s;
}
.top-header .search-box input::placeholder { color: rgba(255,255,255,0.6); }
.top-header .search-box input:focus { background: rgba(255,255,255,0.3); }
.top-header .search-box button {
    position: absolute; right: 4px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
}

.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-header .header-actions .btn-icon {
    position: relative;
    background: none; border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    transition: background 0.2s;
}
.top-header .header-actions .btn-icon:hover { background: rgba(255,255,255,0.15); }

.top-header .header-actions .badge-count {
    position: absolute;
    top: 2px; right: 4px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    padding: 0 5px;
    border-radius: 10px;
    line-height: 16px;
    min-width: 16px;
    text-align: center;
}

.top-header .user-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none; border: none;
    color: var(--white);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.top-header .user-dropdown .dropdown-toggle:hover { background: rgba(255,255,255,0.15); }

.top-header .user-dropdown .user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.top-header .user-dropdown .user-name { font-size: 13px; }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--secondary);
    z-index: 1020;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s, transform 0.3s;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar .nav-section { padding: 8px 0; }

.sidebar .nav-section-title {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px 6px;
    font-weight: 600;
}

.sidebar .nav-item { position: relative; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-decoration: none;
}
.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
    text-decoration: none;
}
.sidebar .nav-link.active {
    background: var(--primary);
    color: var(--white);
    border-left-color: var(--warning);
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 12px;
    font-size: 15px;
    flex-shrink: 0;
}
.sidebar .nav-link .menu-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .nav-link .menu-arrow {
    font-size: 10px;
    transition: transform 0.3s;
    margin-left: auto;
}
.sidebar .nav-link[aria-expanded="true"] .menu-arrow { transform: rotate(90deg); }

.sidebar .submenu {
    background: rgba(0,0,0,0.15);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.sidebar .submenu.show { max-height: 500px; }

.sidebar .submenu .nav-link {
    padding-left: 56px;
    font-size: 13px;
    border-left: none;
}
.sidebar .submenu .nav-link.active {
    background: var(--primary);
    border-left: none;
}

body.sidebar-collapsed .sidebar { width: 0; transform: translateX(-100%); }
body.sidebar-collapsed .main-content { margin-left: 0; }

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--header-height));
    padding: 20px;
    transition: margin-left 0.3s;
    background: var(--bg);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--secondary);
}
.page-header .breadcrumb {
    margin: 0;
    font-size: 13px;
    background: none;
    padding: 0;
}

/* ============ CARDS ============ */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    background: var(--white);
}
.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: 14px 20px;
    border-radius: 8px 8px 0 0 !important;
}
.card-body { padding: 20px; }

.stat-card {
    border-radius: 10px;
    padding: 20px;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 110px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    right: -20px; top: -20px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}
.stat-card.bg-primary-custom { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-card.bg-success-custom { background: linear-gradient(135deg, #28A745, #5CB85C); }
.stat-card.bg-warning-custom { background: linear-gradient(135deg, #F0AD4E, #FFC107); }
.stat-card.bg-info-custom { background: linear-gradient(135deg, var(--info), #5BC0DE); }
.stat-card.bg-danger-custom { background: linear-gradient(135deg, var(--danger), #E57373); }
.stat-card .stat-icon { font-size: 36px; opacity: 0.8; }
.stat-card .stat-content { flex: 1; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: 13px; opacity: 0.9; margin-top: 2px; }

/* ============ DATA TABLE ============ */
.dataTable { font-size: 13px; }
.dataTable thead th {
    background: #F8F9FA;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--secondary);
    padding: 10px 12px;
    white-space: nowrap;
}
.dataTable tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #F0F0F0;
}
.dataTable tbody tr:hover { background: #F8FFFE; }

.dt-container .dt-paging { margin-top: 12px; }
.dt-container .dt-paging .dt-paging-button {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    margin: 0 2px;
    cursor: pointer;
    background: var(--white);
    font-size: 13px;
}
.dt-container .dt-paging .dt-paging-button.current {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.dt-container .dt-paging .dt-paging-button:hover:not(.current) { background: #E9ECEF; }
.dt-container .dt-length select,
.dt-container .dt-search input {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
}

/* ============ FORMS ============ */
.form-label { font-weight: 500; font-size: 13px; color: var(--secondary); margin-bottom: 4px; }
.form-control, .form-select { font-size: 13px; border-color: var(--border); border-radius: 6px; }
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(26,122,109,0.15);
}
.form-text { font-size: 12px; }

/* ============ BUTTONS ============ */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-teal { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn-teal:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }

/* ============ MODAL ============ */
.modal-header { background: var(--primary); color: var(--white); border-radius: 0; }
.modal-header .btn-close { filter: brightness(0) invert(1); }

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.login-card .login-logo { text-align: center; margin-bottom: 30px; }
.login-card .login-logo i { font-size: 48px; color: var(--primary); }
.login-card .login-logo h3 { margin: 12px 0 4px; color: var(--secondary); font-weight: 700; }
.login-card .login-logo p { color: var(--text-light); font-size: 13px; }
.login-card .form-control { height: 44px; font-size: 14px; padding-left: 14px; }
.login-card .btn-login {
    height: 44px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 8px;
}
.login-card .btn-login:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.login-card .input-group-text { background: #F8F9FA; border-color: var(--border); color: var(--text-light); }

/* ============ POS / FRONT DESK ============ */
.pos-container { display: flex; gap: 16px; height: calc(100vh - var(--header-height) - 80px); }
.pos-left { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.pos-right { flex: 1; display: flex; flex-direction: column; }

.member-info-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: 10px;
    padding: 16px;
}
.member-info-card .member-name { font-size: 18px; font-weight: 700; }
.member-info-card .member-stats { display: flex; gap: 20px; margin-top: 10px; }

.pos-cart { flex: 1; overflow-y: auto; }
.pos-total { border-top: 2px solid var(--border); padding-top: 16px; margin-top: auto; }
.pos-total .total-amount { font-size: 28px; font-weight: 700; color: var(--accent); }

.privilege-panel {
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

/* ============ KPI CARDS ============ */
.kpi-card {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.kpi-card .kpi-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.kpi-card .kpi-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ============ BADGES ============ */
.badge-status-active { background: #D4EDDA; color: #155724; padding: 4px 10px; border-radius: 20px; font-size: 12px; }
.badge-status-inactive { background: #F8D7DA; color: #721C24; padding: 4px 10px; border-radius: 20px; font-size: 12px; }
.badge-status-pending { background: #FFF3CD; color: #856404; padding: 4px 10px; border-radius: 20px; font-size: 12px; }

/* ============ TOAST ============ */
.toast-container { position: fixed; top: 70px; right: 20px; z-index: 9999; }
.custom-toast {
    min-width: 280px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ FOOTER ============ */
.site-footer {
    text-align: center;
    padding: 16px 0;
    color: var(--text-light);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .top-header .search-box { width: 200px; }
    .pos-container { flex-direction: column; height: auto; }
    .pos-left { width: 100%; }
}
@media (max-width: 768px) {
    .top-header .search-box { display: none; }
    .top-header .brand { width: auto; font-size: 15px; }
    .stat-card { min-height: 90px; }
    .stat-card .stat-value { font-size: 22px; }
    .stat-card .stat-icon { font-size: 28px; }
    .main-content { padding: 12px; }
}

/* ============ PRINT STYLES ============ */
@media print {
    .top-header, .sidebar, .btn, .no-print { display: none !important; }
    .main-content { margin: 0 !important; padding: 10px !important; }
    .card { box-shadow: none !important; border: 1px solid #DDD !important; }
    .stat-card { box-shadow: none !important; border: 1px solid #DDD !important; color: #333 !important; background: #F8F8F8 !important; }
    body { background: white !important; }
}
