@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #084298;
    --primary-hover: #06357a;
    --primary-light: rgba(8, 66, 152, 0.08);
    --secondary-color: #6c757d;
    --bg-color: #f4f6f9;
    --surface-color: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #fd7e14;
    
    --sidebar-width: 256px;
    --navbar-height: 60px;
    --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-size: 14px;
    overflow-x: hidden;
}

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* =============================================
   SIDEBAR
   ============================================= */
#sidebar-wrapper {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 100%);
    border-right: 1px solid rgba(0,0,0,0.06);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
    transition: transform var(--sidebar-transition), width var(--sidebar-transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-heading {
    height: var(--navbar-height);
    min-height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: white;
    gap: 10px;
}

.sidebar-heading img {
    height: 30px;
}

.sidebar-heading span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
}

.menu-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 1rem 0.75rem 0.4rem 0.75rem;
    letter-spacing: 1px;
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    color: #4b5563;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.15s ease;
    margin-bottom: 1px;
    white-space: nowrap;
    position: relative;
}

.sidebar-link i:first-child {
    width: 20px;
    min-width: 20px;
    font-size: 1rem;
    margin-right: 10px;
    color: #9ca3af;
    text-align: center;
    transition: color 0.15s ease;
}

.sidebar-link span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link:hover {
    background-color: rgba(8, 66, 152, 0.05);
    color: var(--primary-color);
}

.sidebar-link:hover i:first-child {
    color: var(--primary-color);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(8, 66, 152, 0.10) 0%, rgba(8, 66, 152, 0.06) 100%);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
}

.sidebar-link.active i:first-child {
    color: var(--primary-color);
}

/* Chevron icon in collapsible items */
.sidebar-link[aria-expanded="true"] .transition-icon {
    transform: rotate(180deg);
}
.transition-icon {
    transition: transform 0.2s ease;
}
.fs-10 {
    font-size: 10px;
}
.fs-12 {
    font-size: 12px;
}

/* Submenu styling */
.sidebar-menu .collapse .sidebar-link,
.sidebar-menu .collapsing .sidebar-link {
    padding-left: 0.5rem;
    font-size: 13px;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: white;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.sidebar-backdrop.show {
    opacity: 1;
}

/* =============================================
   PAGE CONTENT WRAPPER
   ============================================= */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--sidebar-transition), width var(--sidebar-transition);
}

/* Desktop: sidebar collapsed state */
#sidebar-wrapper.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
#page-content-wrapper.expanded {
    margin-left: 0;
    width: 100%;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar-custom {
    height: var(--navbar-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.navbar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

/* =============================================
   CONTENT AREA
   ============================================= */
.content-container {
    flex: 1;
    padding: 1.25rem;
    background-color: var(--bg-color);
}

/* =============================================
   CARDS
   ============================================= */
.card-custom {
    border: none;
    border-radius: 12px;
    background-color: var(--surface-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 1.25rem;
}

.card-custom .card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 14px;
}

.card-custom .card-body {
    padding: 1.25rem;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* =============================================
   WIDGET CARDS
   ============================================= */
.widget-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* =============================================
   TABLES
   ============================================= */
.table-custom-container {
    background-color: var(--surface-color);
    border-radius: 12px;
}

.table-custom thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    background-color: var(--bg-color);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.table-custom tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_processing {
    background: rgba(255,255,255,0.9) !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 8px;
    padding: 1rem !important;
    font-size: 13px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.45rem 1.1rem;
    transition: all 0.15s ease;
    font-size: 13.5px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* =============================================
   FORMS
   ============================================= */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color);
    font-size: 14px;
    transition: all 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem var(--primary-light);
}

/* =============================================
   LOGIN
   ============================================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(8, 66, 152, 0.9) 0%, rgba(3, 22, 53, 0.95) 100%), 
                url('https://images.unsplash.com/photo-1578916171728-46686eac8d58?q=80&w=1974&auto=format&fit=crop') no-repeat center center;
    background-size: cover;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 16px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
}

/* =============================================
   POS LAYOUT
   ============================================= */
.pos-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.pos-header {
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.pos-content {
    flex: 1;
    overflow: hidden;
    padding: 1rem;
}

.pos-product-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.pos-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.pos-product-img {
    height: 120px;
    object-fit: cover;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.pos-cart-panel {
    background-color: var(--surface-color);
    border-radius: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.pos-cart-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem;
    background-color: rgba(0, 0, 0, 0.01);
}

/* =============================================
   MEMBER DETAIL
   ============================================= */
.member-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-light);
}

.balance-card-blue {
    background: linear-gradient(135deg, var(--primary-color) 0%, #032e6a 100%);
    color: white;
    border-radius: 12px;
    padding: 1.25rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* Mobile: sidebar slides in as overlay */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        box-shadow: none;
    }
    #sidebar-wrapper.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }
    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    .content-container {
        padding: 1rem;
    }
    .navbar-custom {
        padding: 0 1rem;
    }
}

/* Small mobile */
@media (max-width: 575.98px) {
    .content-container {
        padding: 0.75rem;
    }
    .card-custom .card-header {
        padding: 0.85rem 1rem;
        font-size: 13px;
    }
    .card-custom .card-body {
        padding: 1rem;
    }
}
