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

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #f43f5e;
    --danger-light: #ffe4e6;
    --dark: #0f172a;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --bg-app: #f8fafc;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(226, 232, 240, 0.8);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --font-app: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-app);
}

body {
    background-color: var(--bg-app);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar Custom */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--gray-100);
}
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Sidebar Styling (Desktop) */
.sidebar {
    width: 260px;
    background-color: var(--dark);
    color: #fff;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand i {
    color: var(--primary-light);
    font-size: 24px;
}

.sidebar-brand h3 {
    font-weight: 700;
    font-size: 20px;
    background: linear-gradient(135deg, #fff, var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.sidebar-profile {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.profile-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.profile-info span {
    font-size: 12px;
    color: var(--gray-400);
    text-transform: capitalize;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
}

.sidebar-item a:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.03);
}

.sidebar-item.active a {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
}

/* Header Navbar */
.navbar {
    height: 70px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--gray-700);
    font-size: 24px;
    cursor: pointer;
}

.nav-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-700);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.store-badge {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Main Content Padding */
.content-body {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 100px; /* space for mobile nav */
}

/* UI Alert styling */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
}

/* Dashboard Cards */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.08);
}

.stat-info p {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-info h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card.primary .stat-icon { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(244, 63, 94, 0.1); color: var(--danger); }

/* Dashboard layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media(max-width: 991px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--gray-200);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    flex-grow: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e11d48; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 4px; }

/* Custom Inputs & Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    font-size: 14px;
    color: var(--dark);
    background-color: #fff;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control:disabled {
    background-color: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.input-group {
    display: flex;
    position: relative;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Custom Table Design */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    background: #fff;
    border-radius: var(--radius-md);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    background-color: var(--gray-100);
    color: var(--gray-600);
    font-weight: 600;
    padding: 14px 18px;
    font-size: 13px;
    border-bottom: 2px solid var(--gray-200);
}

.table-custom td {
    padding: 14px 18px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

.table-custom tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.6);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 11px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: #dbeafe; color: #1d4ed8; }

/* Login Page Layout */
.login-body {
    background: radial-gradient(circle at 10% 20%, rgba(216, 241, 230, 0.46) 0.1%, rgba(233, 226, 226, 0.28) 90.1%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100vw;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeInUp 0.5s ease;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-logo {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.login-header h2 {
    font-weight: 800;
    font-size: 24px;
    color: var(--dark);
}

.login-header p {
    font-size: 14px;
    color: var(--gray-500);
}

/* POS (Cashier) Interface Layout Splits */
.pos-container {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    height: calc(100vh - 120px);
}

.pos-products {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-search-bar {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
}

.pos-product-grid {
    padding: 16px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    display: grid;
    gap: 16px;
    overflow-y: auto;
    flex-grow: 1;
}

.product-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.product-item:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.product-item-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--gray-500);
}

.product-item-price {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.pos-cart {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-cart-header {
    background: var(--gray-100);
    padding: 14px 20px;
    font-weight: 700;
    font-size: 15px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-app);
    border: 1px solid var(--gray-200);
    animation: fadeIn 0.2s ease;
}

.cart-item-detail {
    flex-grow: 1;
    margin-right: 12px;
}

.cart-item-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
}

.cart-item-price {
    font-size: 12px;
    color: var(--gray-500);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-qty-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.cart-qty-input {
    width: 32px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 13px;
}

.cart-item-subtotal {
    font-weight: 700;
    font-size: 13px;
    color: var(--dark);
    min-width: 70px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    margin-left: 8px;
}

.pos-cart-footer {
    padding: 20px;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pos-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--gray-600);
}

.pos-row.total {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    border-top: 1px dashed var(--gray-300);
    padding-top: 10px;
}

/* Attendance Styling (Absensi) */
.attendance-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

@media(max-width: 768px) {
    .attendance-layout {
        grid-template-columns: 1fr;
    }
}

.clock-widget {
    background: linear-gradient(135deg, var(--dark), var(--primary-dark));
    color: #fff;
    padding: 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.clock-time {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: 1px;
}

.clock-date {
    font-size: 14px;
    color: var(--gray-300);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    background: var(--gray-100);
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 700;
    font-size: 16px;
}

.modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Mobile Friendly Navigation (Bottom Bar) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    height: 60px;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    flex: 1;
    height: 100%;
    transition: var(--transition);
}

.mobile-nav-item i {
    font-size: 20px;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

/* Responsive Grid and Off-canvas for Mobile */
@media(max-width: 991px) {
    .sidebar {
        left: -260px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .nav-toggle {
        display: block;
    }
    
    .mobile-nav {
        display: flex;
    }
    
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
        padding-bottom: 60px;
    }
    
    .pos-cart {
        margin-top: 20px;
    }
    
    .content-body {
        padding: 16px;
    }
}

/* POS Mobile Helper Tabs */
.pos-tabs {
    display: none;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    margin: -16px -16px 16px -16px;
}

@media(max-width: 991px) {
    .pos-tabs {
        display: flex;
    }
    
    .pos-tab {
        flex: 1;
        padding: 14px;
        text-align: center;
        font-weight: 600;
        font-size: 14px;
        color: var(--gray-500);
        border-bottom: 2px solid transparent;
        cursor: pointer;
    }
    
    .pos-tab.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
    }
    
    .pos-products.hidden-mobile,
    .pos-cart.hidden-mobile {
        display: none !important;
    }
}

/* Receipt Print layout */
.receipt-print {
    font-family: 'Courier New', Courier, monospace;
    width: 280px;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.4;
    color: #000;
    padding: 10px;
}

.receipt-print .center {
    text-align: center;
}

.receipt-print .line {
    border-bottom: 1px dashed #000;
    margin: 6px 0;
}

.receipt-print .flex {
    display: flex;
    justify-content: space-between;
}

.receipt-print .title {
    font-size: 16px;
    font-weight: bold;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeInUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Barcode Scanner Video Styles */
#reader video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: var(--radius-md) !important;
}
