/* ============================================================ 
   ARTIVITY POS - PREMIUM UI SYSTEM
   v3.0 "Pastel Harmony"
   Focus: Cleanliness, Softness, Modernity
============================================================ */

:root {
    /* --- Colors: Pastel & Soft Palette --- */
    /* Primary (Soft Blue) - Action & Brand */
    --primary: #60A5FA;       /* Blue 400 */
    --primary-light: #93C5FD; /* Blue 300 */
    --primary-dark: #3B82F6;  /* Blue 500 */
    --primary-soft: rgba(96, 165, 250, 0.12);

    /* Secondary (Soft Pink) - Accents */
    --secondary: #F472B6;       /* Pink 400 */
    --secondary-light: #FBCFE8; /* Pink 200 */
    --secondary-soft: rgba(244, 114, 182, 0.12);

    /* Functional Colors (Soft Variations) */
    --success: #2DD4BF;       /* Teal 400 */
    --success-soft: rgba(45, 212, 191, 0.12);
    --warning: #FB923C;       /* Orange 400 */
    --warning-soft: rgba(251, 146, 60, 0.12);
    --danger: #F87171;        /* Red 400 */
    --danger-soft: rgba(248, 113, 113, 0.12);
    --info: #818CF8;          /* Indigo 400 */
    --info-soft: rgba(129, 140, 248, 0.12);

    /* Backgrounds */
    --bg-main: #F8FAFC;       /* Slate 50 - Very clean, light background */
    --bg-sidebar: #1E293B;    /* Slate 800 - Deep, professional contrast */
    --bg-card: #FFFFFF;
    --bg-input: #F1F5F9;      /* Slate 100 */

    /* Typography */
    --text-main: #334155;     /* Slate 700 - Softer than black */
    --text-muted: #94A3B8;    /* Slate 400 */
    --text-light: #F8FAFC;    /* Slate 50 */

    /* --- Shadows & Glass --- */
    /* Ultra-soft, diffused shadows */
    --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.05);
    --shadow-md: 0 8px 16px -4px rgba(148, 163, 184, 0.08);
    --shadow-lg: 0 20px 40px -10px rgba(148, 163, 184, 0.12);
    --shadow-glow: 0 0 20px rgba(96, 165, 250, 0.25);

    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
    --glass-blur: blur(16px);

    /* --- Animation --- */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* --- Dimensions --- */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 9999px;

    /* --- Borders --- */
    --border-color: #E2E8F0;
    --border-color-light: #F1F5F9;
    --border-color-hover: #CBD5E1;

    /* --- Text Variants --- */
    --text-heading: #1E293B;    /* Slate 800 - Headings */
    --text-secondary: #64748B;  /* Slate 500 */
    --text-placeholder: #94A3B8;/* Slate 400 */

    /* --- Functional Color Pairs (Bootstrap-compatible) --- */
    --bs-primary: #0d6efd;
    --bs-primary-hover: #0b5ed7;
    --bs-success: #198754;
    --bs-danger: #dc3545;
    --bs-warning: #ffc107;
    --bs-info: #0dcaf0;
    --bs-secondary: #6c757d;

    /* --- Spacing Scale --- */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* --- Z-Index Scale --- */
    --z-sidebar: 1500;
    --z-modal: 1600;
    --z-swal2: 1600;
    --z-search-dropdown: 99999;
    --z-tooltip: 1000;

    /* --- Transitions --- */
    --transition-fast: 0.15s var(--ease-smooth);
    --transition-base: 0.25s var(--ease-smooth);
    --transition-slow: 0.35s var(--ease-smooth);

    /* --- Attendance Spec Colors --- */
    --spec-blue: #185FA5;
    --spec-amber: #BA7517;
    --spec-red: #E24B4A;
    --spec-green: #3B6D11;
    --spec-teal: #0F6E56;

    /* --- Gradient Tokens --- */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-dark));
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-analytics: linear-gradient(135deg, #0d6efd, #6366f1);

    /* --- WhatsApp Theme --- */
    --wa-green: #008069;
    --wa-chat-bg: #efeae2;
    --wa-bubble-out: #d9fdd3;
}

/* ============================================================ 
   RESET & TYPOGRAPHY
============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    min-height: 100%;
    font-family: 'Poppins', 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Remove the old background image override to ensure clean look */
body {
    background: var(--bg-main) !important;
}

/* Better Scrollbar (Rounder & Softer) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: 10px;
    border: 2px solid var(--bg-main); /* Creates padding effect */
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================ 
   ANIMATIONS & MICRO-INTERACTIONS
============================================================ */

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.animate-entrance {
    animation: fadeInScale 0.6s var(--ease-primary) forwards;
}

/* Card Hover Lift */
.hover-lift {
    transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth);
}
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Click feedback */
.active-press:active {
    transform: scale(0.98);
}

/* ============================================================ 
   DATATABLES
============================================================ */

.dataTables_info {
    padding: 1rem !important;
    font-size: 0.875rem !important;
    justify-content: center !important; 
    align-items: center !important;
}

.dataTables_paginate {
    padding: 1rem !important;
    font-size: 0.875rem !important;
}

.dataTables_length {
    padding: 1rem !important;
    font-size: 0.875rem !important;
    justify-content: center !important; 
    align-items: center !important;
}

/* ============================================================ 
   SIDEBAR (Modern & Clean)
============================================================ */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-sidebar);
    /* Subtle inner glow for depth instead of harsh shadow */
    box-shadow: 20px 0 40px rgba(0,0,0,0.04); 
    z-index: var(--z-sidebar);
    transition: width 0.4s var(--ease-smooth);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
}

#sidebar.collapsed {
    width: 90px;
}

/* Header */
.sidebar-header {
    height: 90px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.4s var(--ease-smooth);
}

#sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
    flex-direction: column;
    height: auto;
    padding-top: 24px;
    gap: 15px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s var(--ease-smooth);
}

.brand .logo {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 0 15px rgba(96, 165, 250, 0.2));
    transition: all 0.3s var(--ease-smooth);
}

.brand .logo-collapsed {
    display: none;
    height: 36px;
    width: auto;
    filter: drop-shadow(0 0 15px rgba(96, 165, 250, 0.3));
    transition: all 0.3s var(--ease-smooth);
}

#sidebar.collapsed .brand {
    justify-content: center;
    width: 100%;
}

#sidebar.collapsed .brand .logo {
    display: none;
}

#sidebar.collapsed .brand .logo-collapsed {
    display: block;
}

/* Hover Interaction for Brand */
.brand:hover {
    transform: translateY(-1px);
}

.brand:hover .logo, 
.brand:hover .logo-collapsed {
    transform: scale(1.05);
    filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.4));
}

#toggleSidebar {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
}

#toggleSidebar:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.4);
    transform: rotate(90deg);
}

#sidebar.collapsed #toggleSidebar {
    transform: rotate(0deg); /* Reset rotation or keep it? Let's keep it simple */
}

#sidebar.collapsed #toggleSidebar:hover {
    transform: rotate(180deg);
}

/* Menu */
.sidebar-menu {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Increased spacing */
}

/* Clean scrollbar for sidebar */
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: 14px;
    border: 1px solid transparent;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    width: 100%;
    background: none;
}

.menu-item .icon {
    width: 24px;
    font-size: 18px;
    margin-right: 14px;
    display: flex;
    justify-content: center;
    transition: transform 0.2rem var(--ease-spring);
    color: var(--text-secondary);
}

.menu-item:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.03);
}

.menu-item:hover .icon {
    transform: scale(1.2);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid rgba(96, 165, 250, 0.2);
    font-weight: 600;
}

.menu-item.active .icon {
    color: var(--primary);
}

.rotate {
    transform: rotate(90deg);
    transition: transform 0.2s var(--ease-smooth);
}

.rotate.down {
    transform: rotate(0deg);
}

.menu-item.active::after {
    content: '';
    position: absolute;
    right: 12px;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
}

/* Collapsed Logic */
#sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 16px 0;
}
#sidebar.collapsed .menu-item span,
#sidebar.collapsed .rotate,
#sidebar.collapsed .menu-item.active::after {
    display: none;
}
#sidebar.collapsed .menu-item .icon { margin: 0; }

/* Submenu */
.submenu {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    padding: 4px;
}
.submenu a {
    display: block;
    padding: 10px 10px 10px 56px;
    color: #94A3B8;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
}
.submenu a:hover {
    color: #fff;
    background: rgba(255,255,255,0.03);
    transform: translateX(2px);
}
.submenu a.active {
    color: var(--secondary);
    font-weight: 600;
}
#sidebar.collapsed .submenu { display: none !important; }

/* Footer */
.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 8px 16px -4px rgba(96, 165, 250, 0.4);
}
.details .name {
    color: #F8FAFC;
    font-weight: 600;
    font-size: 14px;
}
.details .role-badge {
    color: #94A3B8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    display: inline-block;
}
#sidebar.collapsed .details, #sidebar.collapsed .logout-btn { display: none; }
#sidebar.collapsed .sidebar-footer { justify-content: center; padding: 24px 0; }


/* ============================================================ 
   CONTENT & LAYOUT
============================================================ */
#contentArea {
    position: relative;
    margin-left: 280px;
    width: calc(100% - 280px);
    padding: 32px;
    min-height: 100vh;
    transition: all 0.4s var(--ease-smooth);
}

#contentArea.collapsed {
    margin-left: 90px;
    width: calc(100% - 90px);
}

/* Card System */
.card, .content-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color); /* Subtle border */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); /* Soft shadow */
    transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth);
    overflow: visible; /* Important for dropdowns */
    position: relative;
    margin-bottom: 24px;
}

/* Ensure complex interactive elements inside don't break */
.card:has(.result-box), 
.content-box:has(.result-box) { overflow: visible !important; }

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md); /* Lift effect */
    border-color: var(--border-color-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color-light);
    padding: 24px 32px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 32px;
}

/* ============================================================ 
   UI ELEMENTS
============================================================ */

.swal2-actions button {
    border-radius: 16px;
    transition: all 0.2s var(--ease-smooth);
}
.swal2-actions button:hover {
    transform: scale(1.025);
}

/* Buttons */
.btn {
    border-radius: var(--radius-md); /* More rounded */
    padding: 10px 24px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s var(--ease-smooth);
    border: none;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 10px 20px -5px rgba(96, 165, 250, 0.4);
    transform: translateY(-2px);
}

/* Secondary/Outline style */
.btn-outline-secondary {
    border: 1px solid var(--border-color);
    color: var(--text-main);
    background: #fff;
}
.btn-outline-secondary:hover {
    background: var(--bg-main);
    border-color: var(--border-color-hover);
    color: var(--primary);
}

/* Inputs */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1px solid transparent; 
    background: var(--bg-input);
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.25s;
    color: var(--text-main);
}

.form-control:focus, .form-select:focus {
    background: #fff;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-soft);
    outline: none;
}

.form-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Tables - Clean & Spacious */
.table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
.table thead th {
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    padding: 16px 24px;
}
.table thead th:first-child {
    border-top-left-radius: var(--radius-md);
}
.table thead th:last-child {
    border-top-right-radius: var(--radius-md);
}
.table tbody td {
    padding: 20px 24px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color-light);
    color: var(--text-main);
    font-size: 14px;
    background: #fff;
    transition: background 0.2s;
}
.table-hover tbody tr:hover td {
    background: #F8FAFC;
}

/* Category Group Headers for Product List */
.table .group-header td {
    background: linear-gradient(135deg, var(--bg-input) 0%, var(--border-color) 100%) !important;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-dark);
    padding: 12px 24px !important;
    border-top: 2px solid var(--primary-light);
    border-bottom: 1px solid var(--border-color-hover);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table .group-header td i {
    opacity: 0.7;
}


/* Badges - Pastel Pops */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Pagination */
.page-item .page-link {
    border-radius: 8px;
    margin: 0 4px;
    border: none;
    color: var(--text-muted);
    background: transparent;
    font-weight: 500;
}
.page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(96, 165, 250, 0.3);
}

/* ============================================================ 
   SEARCH RESULT BOX & OVERFLOW
============================================================ */
/* Fix z-indices and overflows for dropdowns */
.pos-layout, .pos-layout .card, .pos-layout .card-body {
    overflow: visible !important;
}

.result-box {
    top: calc(100% + 12px);
    border: none;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1), 0 10px 15px -5px rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    padding: 8px;
    max-height: 380px;
    z-index: var(--z-search-dropdown) !important;
    background: #fff;
    overflow-y: auto;
}

.result-item {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.result-item:hover {
    background-color: var(--primary-soft);
    border-color: rgba(96, 165, 250, 0.2);
    transform: translateX(4px);
}

.result-item .fw-bold { color: var(--text-main); font-size: 15px; }
.result-item .small { color: var(--text-muted); font-size: 13px; }

/* ============================================================ 
   PRINT PREVIEW & MODALS
============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-bottom: 1px solid var(--border-color-light);
    padding: 24px 32px;
}
.modal-footer {
    border-top: 1px solid var(--border-color-light);
    padding: 24px 32px;
}
.modal-backdrop { display: none !important; }
.modal {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal) !important;
}
.swal2-container { z-index: var(--z-swal2) !important; }

/* Receipt Paper */
.paper-receipt {
    background: #fff;
    padding: 24px;
    margin: 20px auto;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 15px rgba(0,0,0,0.1);
    /* Zig-zag bottom */
    mask-image: radial-gradient(circle at 10px bottom, transparent 10px, black 11px) 0 100%/20px 20px repeat-x;
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 10px), transparent 100%),
        radial-gradient(10px circle at 10px bottom, transparent 50%, black 51%) 0 100% / 20px 10px repeat-x;
}
.paper-receipt.w-58 { width: 360px; min-width: 360px; }
.paper-receipt.w-80 { width: 440px; min-width: 440px; }

/* Preview Area Pattern */
#previewScrollArea {
    background-color: var(--bg-main);
    background-image: radial-gradient(var(--border-color-hover) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Nav Pills */
.nav-pills .nav-link {
    border-radius: var(--radius-md);
    padding: 10px 20px;
    color: var(--text-muted);
    font-weight: 500;
}
.nav-pills .nav-link:hover {
    color: var(--primary);
    background: var(--primary-soft);
}
.nav-pills .nav-link.active {
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ============================================================ 
   UTILITIES & HELPERS
============================================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Legacy / Print Overrides */
.preview-container, .preview-po {
    font-family: 'Courier New', monospace !important;
    background: #fff;
    padding: 15px; border: 1px solid var(--border-color);
}

@media print {
    #sidebar, #toggleSidebar, .no-print { display: none !important; }
    #contentArea { margin: 0; width: 100%; padding: 0; }
    body { background: #fff !important; }
}
