/* Base Styles and CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --text-color: #333;
    --text-light: #767676;
    --bg-light: #f8f9fa;
    --bg-dark: #212529;
    --white: #ffffff;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    
    /* Colors for stats */
    --blue: #4361ee;
    --green: #4bb543;
    --orange: #ff9a3c;
    --purple: #7209b7;
    --red: #dc3545;

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 70px;
}

body {
    background-color: var(--bg-light);
    color: var(--text-color);
    font-size: 16px;
    overflow-x: hidden;
}

/* Dashboard Container Layout */
.dashboard-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-dark);
    color: var(--white);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.logo-container {
    padding: 0 20px;
    margin-bottom: 30px;
}

.logo-container h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
}

.logo-container h1 span {
    color: var(--primary-color);
}

.main-nav ul {
    list-style: none;
}

.main-nav li {
    margin-bottom: 5px;
}

.main-nav a {
    color: var(--white);
    text-decoration: none;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-nav li.active a {
    background-color: var(--primary-color);
}

.main-nav a i {
    margin-right: 15px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

/* Submenu styles */
.submenu-arrow {
    margin-left: auto !important;
    transition: transform 0.3s;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.2);
}

.has-submenu.open .submenu {
    max-height: 500px; /* Large enough to accommodate all submenu items */
}

.submenu li a {
    padding-left: 50px;
    font-size: 0.95em;
}

.submenu li a i {
    font-size: 16px;
}

/* When sidebar is collapsed */
.sidebar.collapsed .submenu {
    position: absolute;
    left: var(--sidebar-collapsed-width);
    top: 0;
    width: 200px;
    background-color: var(--bg-dark);
    max-height: 0;
    overflow: hidden;
    border-radius: 0 4px 4px 0;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.sidebar.collapsed .has-submenu.open .submenu {
    max-height: 500px;
}

.sidebar.collapsed .has-submenu {
    position: relative;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
}

.logout-btn {
    display: flex;
    align-items: center;
    color: var(--white);
    text-decoration: none;
    padding: 10px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    color: var(--accent-color);
}

.logout-btn i {
    margin-right: 15px;
}

/* When sidebar is collapsed */
.sidebar.collapsed .logo-container h1 span,
.sidebar.collapsed .main-nav a span,
.sidebar.collapsed .logout-btn span {
    display: none;
}

.sidebar.collapsed .main-nav a,
.sidebar.collapsed .logout-btn {
    justify-content: center;
}

.sidebar.collapsed .main-nav a i {
    margin-right: 0;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* Header Styles */
.header {
    background-color: var(--white);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-left h2 {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    margin-right: 20px;
}

.search-box input {
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 15px 8px 35px;
    font-size: 14px;
    width: 220px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    width: 280px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.notification {
    position: relative;
    margin-right: 20px;
    cursor: pointer;
}

.notification i {
    font-size: 20px;
    color: var(--text-color);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--red);
    color: var(--white);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.user-name {
    font-weight: 500;
}

/* Dashboard Content */
.dashboard-content {
    padding: 20px;
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--white);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.stat-icon i {
    color: white;
    font-size: 24px;
}

.bg-blue {
    background-color: var(--blue);
}

.bg-green {
    background-color: var(--green);
}

.bg-orange {
    background-color: var(--orange);
}

.bg-purple {
    background-color: var(--purple);
}

.bg-red {
    background-color: var(--red);
}

.stat-details h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-details p {
    color: var(--text-light);
    font-size: 14px;
}

.stat-progress {
    margin-left: auto;
    display: flex;
    align-items: flex-start;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background-color: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.chart-card.wide {
    grid-column: span 2;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-options {
    display: flex;
    align-items: center;
}

.card-options select {
    padding: 5px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-right: 10px;
    font-size: 14px;
}

.card-options button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
}

.chart-container {
    height: 300px;
    width: 100%;
}

/* Info Container */
.info-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.info-card {
    background-color: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--card-shadow);
}

/* Activity List */
.activity-list {
    margin-bottom: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.activity-icon i {
    color: white;
    font-size: 16px;
}

.activity-details p {
    font-weight: 500;
    margin-bottom: 3px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-light);
}

/* Alerts List */
.alerts-list {
    margin-bottom: 15px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.alert-warning {
    background-color: #fff8e1;
    border-left: 4px solid #ffb300;
}

.alert-danger {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
}

.alert-success {
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.alert-icon {
    margin-right: 15px;
}

.alert-warning .alert-icon i {
    color: #ffb300;
}

.alert-danger .alert-icon i {
    color: #f44336;
}

.alert-success .alert-icon i {
    color: #4caf50;
}

.alert-details h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.alert-details p {
    font-size: 14px;
    color: var(--text-light);
}

/* Card Footer */
.card-footer {
    text-align: center;
    padding-top: 10px;
}

.card-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

/* Sidebar Overlay for Mobile/Tablet Navigation Drawer */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* Form Styles for Create and Edit pages */
.form-container {
    padding: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    margin-bottom: 20px;
}

.form-group.full-width {
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

.file-upload {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-btn:hover {
    background-color: var(--secondary-color);
}

.file-name {
    margin-left: 10px;
    color: var(--text-light);
}

.current-image {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.current-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
}

/* Button Styles */
.btn-primary, .btn-secondary, .btn-danger, .btn-export {
    padding: 10px 15px;
    border-radius: 5px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: #e9ecef;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #dee2e6;
}

.btn-danger {
    background-color: var(--red);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-primary-sm, .btn-danger-sm {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-primary-sm {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

.btn-primary-sm:hover {
    background-color: var(--secondary-color);
}

.btn-danger-sm {
    background-color: var(--red);
    color: white;
}

.btn-danger-sm:hover {
    background-color: #c82333;
}

.btn-primary i, .btn-secondary i, .btn-danger i,
.btn-primary-sm i, .btn-danger-sm i {
    margin-right: 5px;
}

.btn-export {
    background-color: #e9ecef;
    color: var(--text-color);
    margin-left: 10px;
}

.btn-export:hover {
    background-color: #dee2e6;
}

.wide-btn {
    width: 100%;
}

/* Product View Page Styles */
.product-view {
    display: flex;
    gap: 30px;
}

.product-image {
    flex: 0 0 300px;
}

.product-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.product-details {
    flex: 1;
}

.product-title {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.product-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    color: var(--text-light);
}

.product-price {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.product-status {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
}

.product-status.active {
    background-color: rgba(75, 181, 67, 0.1);
    color: var(--green);
}

.product-status.inactive {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--red);
}

.product-stock {
    margin-bottom: 20px;
}

.stock-label {
    font-weight: 500;
    margin-right: 5px;
}

.product-description {
    margin-top: 20px;
}

.product-description h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.related-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.related-product-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.related-product-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.related-product-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
}

.related-product-details h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

/* Reports Page Styles */
.tall-chart {
    height: 400px;
}

.two-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.data-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: var(--text-color);
    background-color: #f8f9fa;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

.product-cell {
    display: flex;
    align-items: center;
}

.product-cell img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    margin-right: 10px;
    object-fit: cover;
}

.status-pill {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pill.active {
    background-color: rgba(75, 181, 67, 0.1);
    color: var(--green);
}

.status-pill.inactive {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--red);
}

.status-pill.low {
    background-color: rgba(255, 154, 60, 0.1);
    color: var(--orange);
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Touch and Kiosk Accessibility Target Optimizations */
button, .btn-primary, .btn-secondary, .btn-danger, .btn-export, 
.btn-primary-sm, .btn-danger-sm, .main-nav a, .logout-btn, .file-upload-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   COMPREHENSIVE ALL-DEVICES RESPONSIVE BREAKPOINT SYSTEM
   ========================================================================== */

/* 1. Extra Large / 4K Kiosk Displays (>= 1400px) */
@media screen and (min-width: 1400px) {
    .dashboard-content {
        max-width: 1800px;
        margin: 0 auto;
        padding: 30px;
    }

    .stats-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }

    .chart-container {
        height: 350px;
    }
}

/* 2. Large Desktops & Laptops (1200px - 1399px) */
@media screen and (max-width: 1200px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 3. Tablets & Small Laptops (992px - 1199px) */
@media screen and (max-width: 1199px) {
    .product-view {
        gap: 20px;
    }

    .product-image {
        flex: 0 0 250px;
    }
}

/* 4. Tablets & Mobile Drawer Switch (< 992px) */
@media screen and (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1000;
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-card.wide {
        grid-column: span 1;
    }
    
    .info-container {
        grid-template-columns: 1fr;
    }

    .product-view {
        flex-direction: column;
    }
    
    .product-image {
        flex: 0 0 auto;
        max-width: 320px;
        margin: 0 auto 20px auto;
    }

    .two-column-grid {
        grid-template-columns: 1fr;
    }
}

/* 5. Mobile Landscape & Large Phones (576px - 767px) */
@media screen and (max-width: 767px) {
    .header {
        padding: 0 15px;
    }

    .header-left h2 {
        font-size: 18px;
    }

    .search-box {
        display: none;
    }
    
    .user-name {
        display: none;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .tall-chart {
        height: 300px;
    }

    .data-table-container {
        margin-top: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th, .data-table td {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn-primary-sm, .btn-danger-sm {
        padding: 8px 12px;
        min-height: 36px;
    }
}

/* 6. Small Mobile Phones (320px - 575px) */
@media screen and (max-width: 575px) {
    .dashboard-content {
        padding: 12px;
    }
    
    .stat-card, .chart-card, .info-card, .auth-card {
        padding: 15px;
        border-radius: 8px;
    }

    .stats-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .stat-details h3 {
        font-size: 20px;
    }

    .chart-container {
        height: 240px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-options {
        width: 100%;
        justify-content: space-between;
    }

    .related-products {
        grid-template-columns: 1fr;
    }
    
    .product-meta {
        flex-direction: column;
        gap: 8px;
    }

    .product-price {
        font-size: 22px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions button, .form-actions a,
    .btn-secondary, .btn-primary, .btn-danger, .btn-export {
        width: 100%;
        margin-left: 0 !important;
    }

    .current-image {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .current-image img {
        width: 100%;
        max-height: 200px;
    }
}

/* 7. Extra Small Screens (< 360px) */
@media screen and (max-width: 359px) {
    .header-left h2 {
        font-size: 16px;
    }

    .logo-container h1 {
        font-size: 22px;
    }

    .stat-details h3 {
        font-size: 18px;
    }

    .stat-details p {
        font-size: 12px;
    }
}

/* 8. Print Styles */
@media print {
    .sidebar, .header, .card-options, .btn-export, .form-actions {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .stat-card, .chart-card, .info-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

