/* ============================================
   ERP-POS System - Complete Responsive CSS
   Mobile First Design
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f5f7fb;
    color: #333;
    line-height: 1.6;
    font-size: 16px;
}

/* ============================================
   LOGIN PAGE RESPONSIVE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    margin: auto;
}

.login-box {
    background: white;
    padding: clamp(20px, 5vw, 40px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: clamp(24px, 5vw, 28px);
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.login-box button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Logo Styles */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.logo-text small {
    font-size: 12px;
    font-weight: normal;
    color: #666;
}

/* Login Page Logo */
.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    height: 60px;
    width: auto;
}

.login-logo h3 {
    margin-top: 10px;
    color: #333;
}

/* Sidebar Logo */
.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo img {
    height: 50px;
    width: auto;
    margin-bottom: 10px;
}

.sidebar-logo h2 {
    font-size: 18px;
    margin: 0;
}

.sidebar-logo p {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
}

/* Receipt Logo */
.receipt-logo {
    text-align: center;
    margin-bottom: 15px;
}

.receipt-logo img {
    height: 50px;
    width: auto;
}

/* Print Invoice Logo */
.print-logo {
    text-align: center;
    margin-bottom: 15px;
}

.print-logo img {
    height: 60px;
    width: auto;
}

/* POS Header Logo */
.pos-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pos-logo img {
    height: 35px;
    width: auto;
}

/* Responsive Logo */
@media (max-width: 768px) {
    .logo-img {
        height: 30px;
    }
    .logo-text {
        font-size: 16px;
    }
    .sidebar-logo img {
        height: 40px;
    }
}



/* ============================================
   ADMIN PANEL - MOBILE FIRST
   ============================================ */
.admin-container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Sidebar - Mobile */
.sidebar {
    background: var(--dark-color);
    color: white;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
}

.sidebar.open {
    transform: translateY(0);
}

.sidebar h2 {
    padding: 20px;
    font-size: 18px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar ul {
    list-style: none;
    padding: 10px 0;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background: rgba(255,255,255,0.1);
    padding-left: 25px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
    border: none;
    font-size: 24px;
}

/* Main Content - Mobile */
.main-content {
    flex: 1;
    padding: 60px 15px 80px 15px;
    width: 100%;
}

/* Dashboard Stats Grid - Mobile */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
}

/* ============================================
   POS SYSTEM - FULLY RESPONSIVE
   ============================================ */
.pos-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.pos-header {
    background: white;
    padding: 15px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.pos-header h1 {
    font-size: 20px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.pos-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Products Section - Mobile */
.pos-products {
    flex: 2;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.search-bar {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    padding-bottom: 10px;
    z-index: 10;
}

.search-bar input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.product-card {
    background: white;
    padding: 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    border: 1px solid var(--border-color);
}

.product-card:active {
    transform: scale(0.98);
}

.product-card h4 {
    font-size: 14px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .price {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 16px;
    margin: 5px 0;
}

.product-card .stock {
    font-size: 11px;
    color: #666;
}

/* Cart Section - Mobile */
.pos-cart {
    background: white;
    border-top: 2px solid var(--border-color);
    padding: 15px;
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    background: white;
    padding-bottom: 10px;
}

.cart-items {
    flex: 1;
    max-height: 200px;
    overflow-y: auto;
}

.cart-item {
    display: grid;
    grid-template-columns: 2fr 0.8fr 1fr 0.5fr;
    gap: 8px;
    padding: 10px;
    background: var(--light-color);
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    align-items: center;
    font-size: 13px;
}

.cart-item input {
    width: 60px;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.cart-item button {
    width: 30px;
    height: 30px;
    padding: 0;
    background: var(--danger-color);
}

.cart-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.summary-row.total {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 10px;
}

/* Payment Methods - Mobile */
.payment-methods {
    margin: 15px 0;
}

.payment-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.payment-option {
    display: flex;
    align-items: center;
    padding: 8px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
}

.payment-form {
    margin-top: 15px;
    padding: 15px;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.payment-form input,
.payment-form select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

.btn-complete,
.btn-mpesa,
.btn-pesapal {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
}

/* ============================================
   DATA TABLES - RESPONSIVE
   ============================================ */
.data-table {
    width: 100%;
    overflow-x: auto;
    display: block;
    background: white;
    border-radius: var(--border-radius);
}

.data-table table {
    width: 100%;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--light-color);
    font-weight: 600;
    font-size: 13px;
}

.data-table td {
    font-size: 13px;
}

/* ============================================
   FORMS - RESPONSIVE
   ============================================ */
.form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 15px;
}

.form-modal-content {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

/* ============================================
   BUTTONS
   ============================================ */
button,
.btn-add,
.btn-filter,
.btn-export,
.btn-print,
.btn-edit,
.btn-delete {
    padding: 10px 15px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

button:active {
    transform: scale(0.98);
}

.btn-add {
    background: var(--success-color);
    color: white;
}

.btn-filter {
    background: var(--primary-color);
    color: white;
}

.btn-export {
    background: var(--info-color);
    color: white;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet Landscape */
@media (min-width: 768px) {
    body {
        font-size: 18px;
    }
    
    /* Admin Panel - Tablet */
    .admin-container {
        flex-direction: row;
    }
    
    .sidebar {
        position: relative;
        width: 260px;
        transform: translateY(0);
        border-radius: 0;
        max-height: 100vh;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .main-content {
        padding: 20px;
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* POS - Tablet */
    .pos-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .pos-main {
        flex-direction: row;
    }
    
    .pos-products {
        flex: 3;
    }
    
    .pos-cart {
        flex: 2;
        max-height: 100vh;
        border-left: 2px solid var(--border-color);
        border-top: none;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .payment-options {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .main-content {
        padding: 30px;
    }
    
    .cart-items {
        max-height: 300px;
    }
}

/* Large Desktop */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .menu-toggle,
    .filters,
    .print-section,
    button {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
        margin: 0;
    }
    
    .data-table {
        font-size: 10px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    button,
    .product-card,
    .btn-add,
    .payment-option {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    button:active,
    .product-card:active {
        opacity: 0.7;
    }
    
    input,
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Sidebar Logo */
.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo img {
    height: 50px;
    width: auto;
    margin-bottom: 10px;
    background: white;
    padding: 5px;
    border-radius: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.sidebar-logo h2 {
    font-size: 16px;
    margin: 10px 0 5px;
    color: white;
    text-align: center;
}

.sidebar-logo p {
    font-size: 10px;
    opacity: 0.7;
    color: white;
    text-align: center;
}

/* POS Logo */
.pos-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pos-logo img {
    height: 40px;
    width: auto;
    background: white;
    padding: 5px;
    border-radius: 8px;
}






