/* Modern CSS for Al-Hamd Machinery Store POS */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;700&display=swap');

:root {
    --primary-color: #0f172a;       /* Slate 900 - Premium dark header/sidebar */
    --secondary-color: #2563eb;     /* Blue 600 - Highlights and main buttons */
    --secondary-hover: #1d4ed8;     /* Blue 700 */
    --success-color: #10b981;       /* Emerald 500 - Paid / Recovered */
    --warning-color: #f59e0b;       /* Amber 500 - Stock warning / partial */
    --danger-color: #ef4444;        /* Red 500 - Out of stock / Due / Udhaar */
    --info-color: #06b6d4;          /* Cyan 500 */
    --bg-light: #f8fafc;            /* Slate 50 - Background */
    --card-bg: #ffffff;
    --border-color: #e2e8f0;        /* Slate 200 */
    --text-main: #334155;           /* Slate 700 */
    --text-dark: #0f172a;           /* Slate 900 */
    --text-muted: #64748b;          /* Slate 500 */
    --sidebar-width: 260px;
    --font-english: 'Outfit', sans-serif;
    --font-urdu: 'Noto Sans Arabic', sans-serif;
    
    /* Modern Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: var(--font-english);
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    letter-spacing: -0.01em;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-light);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sidebar Wrapper */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    position: relative;
}

#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--primary-color);
    color: #fff;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    margin-left: calc(-1 * var(--sidebar-width));
}

#sidebar .sidebar-header {
    padding: 24px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar .sidebar-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    letter-spacing: -0.02em;
}

#sidebar ul.components {
    padding: 20px 0;
    flex-grow: 1;
}

#sidebar ul li {
    padding: 4px 16px;
}

#sidebar ul li a {
    padding: 12px 16px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
}

#sidebar ul li a i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

#sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

#sidebar ul li a:hover i {
    transform: translateX(2px);
}

#sidebar ul li.active a {
    color: #fff;
    background: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

#sidebar ul li.active a i {
    color: #fff;
}

.pos-btn-sidebar {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pos-btn-sidebar:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3) !important;
}

/* Page Content */
#content {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

.navbar-custom {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 28px;
    box-shadow: var(--shadow-sm);
}

#sidebarCollapse {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

#sidebarCollapse:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

/* Premium Dashboard Cards */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: background 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat-card:hover::after {
    background: var(--secondary-color);
}

.stat-card.border-danger-left:hover::after {
    background: var(--danger-color);
}

.stat-card .card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card h5 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-card h2 {
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
    letter-spacing: -0.03em;
}

/* Data Cards & Tables */
.data-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    overflow: hidden;
}

.data-card .card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card .card-header h4 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

.data-card .card-body {
    padding: 24px;
}

.table-custom {
    margin: 0;
}

.table-custom th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border-color);
    padding: 14px 20px;
}

.table-custom td {
    padding: 16px 20px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: background 0.15s ease;
}

.table-custom tbody tr:hover td {
    background-color: #f8fafc;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

/* Form Styling */
.form-control-custom {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 11px 16px;
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #fff;
}

.form-control-custom:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    outline: none;
}

.form-label-custom {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: inline-block;
}

/* Buttons */
.btn-custom {
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-custom:hover {
    transform: translateY(-1px);
}

.btn-custom-primary {
    background-color: var(--secondary-color);
    color: #fff;
    border: 1px solid var(--secondary-color);
}

.btn-custom-primary:hover {
    background-color: var(--secondary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-custom-success {
    background-color: var(--success-color);
    color: #fff;
    border: 1px solid var(--success-color);
}

.btn-custom-success:hover {
    background-color: #059669;
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-custom-danger {
    background-color: var(--danger-color);
    color: #fff;
    border: 1px solid var(--danger-color);
}

.btn-custom-danger:hover {
    background-color: #dc2626;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* POS Interface specific styles */
.pos-product-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    height: 100%;
}

.pos-product-card:hover {
    transform: translateY(-3px);
    border-color: var(--secondary-color);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

.pos-product-card .stock-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.pos-cart-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.pos-cart-summary {
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
    background: #f8fafc;
}

.cart-row td {
    padding: 10px 8px;
}

/* Badge styling */
.badge-custom {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Responsive styles */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        margin-left: calc(-1 * var(--sidebar-width));
        box-shadow: none;
    }
    
    #sidebar.active {
        margin-left: 0;
        box-shadow: 5px 0 25px rgba(0,0,0,0.15);
    }
    
    /* Create a dark overlay backdrop for mobile sidebar toggle using custom overlay class in HTML */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(2px);
        z-index: 1040;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .pos-cart-container {
        height: auto;
        min-height: 400px;
        margin-top: 20px;
    }
}

@media (max-width: 767.98px) {
    .navbar-custom {
        padding: 12px 16px;
    }
    
    .container-fluid.p-4 {
        padding: 16px !important;
    }
    
    .stat-card {
        padding: 18px;
    }
    
    .data-card .card-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .data-card .card-header .search-box {
        width: 100% !important;
    }
    
    .table-custom th, .table-custom td {
        padding: 12px;
    }

    /* Target buttons on mobile viewport to prevent them from looking too large */
    .btn-custom {
        padding: 8px 14px !important;
        font-size: 0.82rem !important;
        border-radius: var(--radius-sm) !important;
    }

    .btn {
        font-size: 0.85rem !important;
    }

    /* Stack header flex elements vertically on mobile */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 > div {
        text-align: left !important;
        width: 100% !important;
    }

    /* Stack container layout buttons vertically and make them full width */
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex.gap-2,
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex {
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 .btn-custom,
    .d-flex.justify-content-between.align-items-center.mb-4 .btn {
        width: 100% !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    /* Scale down large main headings on mobile */
    h1.h3 {
        font-size: 1.3rem !important;
    }
}
