/* assets/css/style.css */
:root {
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --secondary-color: #818cf8;
    /* Indigo 400 */
    --bg-color: #f3f4f6;
    /* Gray 100 */
    --surface-color: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Login Page Specifics */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e7ff 0%, #fae8ff 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

/* Utility Overrides */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #4338ca;
    /* Indigo 700 */
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.form-control {
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
}

.form-control:focus {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    border-color: var(--primary-color);
}

/* Sidebar & Navigation */
.sidebar {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    padding: 1.5rem;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    z-index: 1000;
    overflow-y: auto;
    /* Allow scrolling */
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: 260px;
    padding: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: #eef2ff;
    color: var(--primary-color);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Dashboard Cards */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    height: 100%;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.bg-purple-light {
    background: #f3e8ff;
    color: #9333ea;
}

.bg-blue-light {
    background: #dbeafe;
    color: #2563eb;
}

.bg-green-light {
    background: #dcfce7;
    color: #16a34a;
}

.bg-orange-light {
    background: #ffedd5;
    color: #ea580c;
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    height: calc(100vh - 4rem);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Changed to 3 columns */
    gap: 0.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    min-height: 0;
    /* Critical for Flexbox scrolling */
    align-content: start;
    /* Prevent rows from stretching to fill height */
    grid-auto-rows: min-content;
    /* Keep rows at minimum height needed */
}

.product-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.product-img-box {
    height: 100px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    flex-shrink: 0;
}

.product-details {
    padding: 0.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    width: 100%;
}

/* Global List View Styles (Applied to all screens) */
.product-card {
    height: auto !important;
    /* Allow grow */
    min-height: 80px;
    /* Taller default */
    border: 1px solid #ddd;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.product-details {
    text-align: left;
}

.product-details .text-truncate {
    white-space: normal;
    /* Allow wrapping */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.product-details .d-flex {
    width: 100%;
    justify-content: space-between !important;
    align-items: center;
    margin-top: auto;
}

.stock-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.pos-cart-panel {
    background: white;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-summary {
    background: #f9fafb;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Laptop Responsiveness */
@media (max-width: 1400px) {
    .sidebar {
        width: 200px;
        padding: 1rem;
    }

    .main-content {
        margin-left: 200px;
        padding: 1rem;
    }

    .nav-link span {
        font-size: 0.9rem;
    }

    .pos-layout {
        grid-template-columns: 1fr 320px;
        gap: 0.75rem;
    }

    .product-grid {
        gap: 0.5rem;
    }
}

/* Tablet/Mobile - Stack Layout */
@media (max-width: 992px) {
    .sidebar {
        width: 0;
        overflow: hidden;
        padding: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .pos-layout {
        display: block;
        height: auto;
    }

    .product-grid {
        height: 500px;
        /* Scrollable area */
        margin-bottom: 1rem;
    }

    .pos-cart-panel {
        height: auto;
    }
}