/* Custom styles for PiStock PWA */

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: none;
}

/* ===== HEADER SPACING FIX ===== */
/* Add proper spacing for fixed header to prevent content overlap */

/* Main content spacing for fixed header */
#main-content {
    padding-top: 80px !important; /* Account for fixed header height */
    min-height: calc(100vh - 80px - 80px); /* Viewport height minus header and bottom nav */
}

/* Page content spacing */
.page-content {
    padding-top: 80px !important;
}

/* Individual page containers */
.landing-page,
.menu-page,
.dashboard-page,
.report-page,
.pos-page,
.setting-page,
.categories-page,
.products-page,
.sales-page,
.purchase-page,
.clients-page,
.suppliers-page,
.warehouses-page,
.raw-materials-page,
.users-page,
.account-payments-page,
.bank-accounts-page {
    padding-top: 80px !important;
    min-height: calc(100vh - 80px - 80px);
}

/* Mobile responsive header spacing */
@media (max-width: 768px) {
    #main-content {
        padding-top: 70px !important;
        min-height: calc(100vh - 70px - 80px);
    }
    
    .page-content {
        padding-top: 70px !important;
    }
    
    .landing-page,
    .menu-page,
    .dashboard-page,
    .report-page,
    .pos-page,
    .setting-page,
    .categories-page,
    .products-page,
    .sales-page,
    .purchase-page,
    .clients-page,
    .suppliers-page,
    .warehouses-page,
    .raw-materials-page,
    .users-page,
    .account-payments-page,
    .bank-accounts-page {
        padding-top: 70px !important;
        min-height: calc(100vh - 70px - 80px);
    }
}

@media (max-width: 480px) {
    #main-content {
        padding-top: 65px !important;
        min-height: calc(100vh - 65px - 80px);
    }
    
    .page-content {
        padding-top: 65px !important;
    }
    
    .landing-page,
    .menu-page,
    .dashboard-page,
    .report-page,
    .pos-page,
    .setting-page,
    .categories-page,
    .products-page,
    .sales-page,
    .purchase-page,
    .clients-page,
    .suppliers-page,
    .warehouses-page,
    .raw-materials-page,
    .users-page,
    .account-payments-page,
    .bank-accounts-page {
        padding-top: 65px !important;
        min-height: calc(100vh - 65px - 80px);
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #4f46e5;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f44336;
    color: white;
    text-align: center;
    padding: 8px;
    z-index: 9999;
    display: none;
}

.offline-indicator.show {
    display: block;
}

/* ===== UNIVERSAL FLOATING ACTION BUTTON SYSTEM ===== */
/* This system ensures consistent add button positioning across ALL pages */

/* Base floating action button styles */
.fab-btn,
[class*="fab-"],
[class*="floating"],
[id*="fab-"],
[id*="floating"],
[class*="add-"],
[id*="add-"] {
    position: fixed !important;
    bottom: 120px !important;
    right: 20px !important;
    width: 56px !important;
    height: 56px !important;
    background: #3b82f6 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    z-index: 1000 !important;
    transition: all 0.3s ease !important;
}

/* Hover effects for all floating buttons */
.fab-btn:hover,
[class*="fab-"]:hover,
[class*="floating"]:hover,
[id*="fab-"]:hover,
[id*="floating"]:hover,
[class*="add-"]:hover,
[id*="add-"]:hover {
    background: #2563eb !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5) !important;
}

/* Active effects for all floating buttons */
.fab-btn:active,
[class*="fab-"]:active,
[class*="floating"]:active,
[id*="fab-"]:active,
[id*="floating"]:active,
[class*="add-"]:active,
[id*="add-"]:active {
    transform: scale(0.95) !important;
}

/* Specific overrides for different button classes and IDs */
.fab-add-unit,
.fab-add-production,
.fab-add-doc,
.fab-add-client,
.fab-add-supplier,
.fab-add-product,
.fab-add-purchase,
.fab-add-sales,
.fab-add-raw-material,
.fab-add-bank-account,
.fab-add-category,
.fab-add-user,
.floating-pos-btn,
.floating-menu-btn,
#fab-add-unit,
#fab-add-production,
#fab-add-doc,
#fab-add-client,
#fab-add-supplier,
#fab-add-product,
#fab-add-purchase,
#fab-add-sales,
#fab-add-raw-material,
#fab-add-bank-account,
#fab-add-category,
#fab-add-user,
#add-client-btn,
#add-supplier-btn,
#add-product-btn,
#add-purchase-btn,
#add-sales-btn,
#add-raw-material-btn,
#add-bank-account-btn,
#add-category-btn,
#add-user-btn {
    position: fixed !important;
    bottom: 120px !important;
    right: 20px !important;
    width: 56px !important;
    height: 56px !important;
    background: #3b82f6 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    z-index: 1000 !important;
    transition: all 0.3s ease !important;
}

/* Ensure buttons are always outside any container */
.sdt-card .fab-btn,
.sdt-card [class*="fab-"],
.sdt-card [class*="floating"],
.sdt-card [id*="fab-"],
.sdt-card [id*="floating"],
.sdt-card [class*="add-"],
.sdt-card [id*="add-"] {
    position: fixed !important;
    bottom: 120px !important;
    right: 20px !important;
    z-index: 1000 !important;
}

/* Mobile responsive adjustments for ALL floating buttons */
@media (max-width: 768px) {
    .fab-btn,
    [class*="fab-"],
    [class*="floating"],
    [id*="fab-"],
    [id*="floating"],
    [class*="add-"],
    [id*="add-"] {
        bottom: 110px !important; /* Slightly higher on mobile */
        right: 16px !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .fab-btn,
    [class*="fab-"],
    [class*="floating"],
    [id*="fab-"],
    [id*="floating"],
    [class*="add-"],
    [id*="add-"] {
        bottom: 105px !important;
        right: 12px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 18px !important;
    }
}

/* SmartDataTable Light Theme Overrides - FORCE LIGHT BACKGROUNDS */
.sdt-card {
    background: #ffffff !important;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    padding: 18px 10px 24px 10px;
    margin-bottom: 18px;
    border: 1px solid #e5e7eb;
}

/* Force all SmartDataTable components to use light backgrounds */
.sdt-table {
    background: #ffffff !important;
}

.sdt-table thead th {
    background: #f8fafc !important;
    color: #374151 !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.sdt-table tbody td {
    background: #ffffff !important;
    color: #374151 !important;
    border-bottom: 1px solid #f3f4f6 !important;
}

.sdt-table tbody tr:hover {
    background: #f0f7ff !important;
}

/* Smart Filter section - Force light background */
.sdt-searchbar {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
}

.sdt-search-input {
    background: #ffffff !important;
    color: #374151 !important;
}

.sdt-fs-btn, .sdt-col-mgr-btn, .sdt-pg-btn {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
}

.sdt-fs-btn:hover, .sdt-col-mgr-btn:hover, .sdt-pg-btn:hover {
    background: #e3eaff !important;
    color: #1e40af !important;
}

.sdt-page-size-dropdown {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
}

/* Override any dark mode styles that might be applied */
[class*="dark"], [class*="dark-mode"] {
    background: #ffffff !important;
    color: #374151 !important;
}

/* Ensure all table containers use light backgrounds */
#clients-table-container,
#suppliers-table-container,
#sales-table-container,
#raw-materials-table-container,
#products-table-container,
#warehouses-table-container,
#purchase-table-container,
#bank-accounts-table-container,
#categories-table-container,
#users-table-container {
    background: #ffffff !important;
}

/* Page background overrides */
.clients-bg,
.suppliers-bg,
.sales-bg,
.raw-materials-bg,
.products-bg,
.warehouses-bg,
.purchase-bg,
.bank-accounts-bg,
.categories-bg,
.users-bg {
    background: #f8fafc !important;
}

/* Status badges - Light theme */
.badge-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.badge-inactive {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* Action buttons */
.action-btn {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
  cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e3eaff !important;
    color: #1e40af !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .fab-btn,
    [class*="fab-"],
    [class*="floating"],
    [id*="fab-"],
    [id*="floating"] {
        bottom: 110px !important; /* Slightly higher on mobile */
        right: 16px !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .fab-btn,
    [class*="fab-"],
    [class*="floating"],
    [id*="fab-"],
    [id*="floating"] {
        bottom: 105px !important;
        right: 12px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 18px !important;
    }
}

/* Mode switch button styles - COMMENTED OUT DARK MODE */
/*
#mode-switch-btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  background: #23272f;
  color: #b0b8c1;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 1px 4px #0002;
  transition: background 0.2s, color 0.2s;
}
#mode-switch-btn:hover {
  background: #181b20;
  color: #fff;
}
#mode-switch-btn:active {
  background: #2196f3;
  color: #fff;
}
*/

/* COMMENTED OUT ALL DARK MODE STYLES */
/*
.production-dark-bg {
  background: #181b20;
  min-height: 100vh;
}
.production-kpi-scroll .market-card {
  background: #23272f;
  color: #fff;
}
.production-tab-switcher {
  background: #181b20;
}
.production-tab-btn {
  background: #23272f;
  color: #b0b8c1;
}
.production-tab-btn.active, .production-tab-btn:active {
  background: #2196f3;
  color: #fff;
}
.text-white { color: #fff !important; }
*/

.production-kpi-scroll {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 10px;
  padding: 8px 12px 0 12px;
  margin-bottom: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.production-kpi-scroll .market-card {
  min-width: 140px;
  max-width: 180px;
  background: linear-gradient(135deg, #f5f6fa 80%, #e3e9f7 100%);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: 1px solid rgba(59,130,246,0.1);
}
.production-kpi-scroll .market-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(59,130,246,0.15);
}

/* Custom shapes for navigation templates */
.clip-hexagon {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.clip-diamond {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.clip-star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.clip-circle {
  clip-path: circle(50% at 50% 50%);
}

.clip-triangle {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.clip-heart {
  clip-path: path('M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z');
}

/* Navigation template styles */
.nav-template-modern {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 8px;
  margin: 0 8px;
}

.nav-template-classic {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 6px;
  margin: 0 4px;
}

.nav-template-minimal {
  background: transparent;
  border: none;
  padding: 4px;
  margin: 0 2px;
} 

.nav-template-bold {
  background: #1f2937;
  border-radius: 16px;
  padding: 10px;
  margin: 0 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nav-template-elegant {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-radius: 24px;
  padding: 12px;
  margin: 0 8px;
  box-shadow: 0 8px 24px rgba(240, 147, 251, 0.3);
}

.nav-template-tech {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 18px;
  padding: 8px;
  margin: 0 6px;
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.25);
}

/* Bottom navigation fixed positioning with safe area support */
.fixed.bottom-0 {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40 !important;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Ensure navigation is always on top */
nav.fixed {
  z-index: 40 !important;
}

/* Custom CSS for navigation templates */
.nav-item {
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 8px;
  min-width: 60px;
}

.nav-item:hover {
  transform: translateY(-2px);
}

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

.nav-icon {
  font-size: 18px;
  margin-bottom: 4px;
  transition: all 0.3s ease;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

/* Template-specific styles */
.nav-template-modern .nav-item.active {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
}

.nav-template-classic .nav-item.active {
  background: #3b82f6;
  color: white;
}

.nav-template-minimal .nav-item.active {
  color: #3b82f6;
  font-weight: 600;
}

.nav-template-bold .nav-item.active {
  background: #3b82f6;
  color: white;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.nav-template-elegant .nav-item.active {
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(255,255,255,0.2);
}

.nav-template-tech .nav-item.active {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(255,255,255,0.15);
}

/* Responsive design for navigation */
@media (max-width: 640px) {
  .nav-item {
    min-width: 50px;
    padding: 6px 2px;
  }
  
  .nav-icon {
    font-size: 16px;
  }
  
  .nav-label {
    font-size: 9px;
  }
}

@media (max-width: 480px) {
  .nav-item {
    min-width: 45px;
    padding: 4px 1px;
  }
  
  .nav-icon {
    font-size: 14px;
  }
  
  .nav-label {
    font-size: 8px;
  }
} 

/* --- Sidebar Styles (Refined, Theming, No Dark Mode) --- */
.pwa-sidebar {
  background: #fff;
  color: #222;
  box-shadow: 2px 0 16px #0002;
  border-right: 1px solid #f0f0f0;
  transition: background 0.2s, color 0.2s;
}
.pwa-sidebar .sidebar-profile {
  background: #fafbfc;
  border-bottom: 1px solid #f0f0f0;
}
.pwa-sidebar .sidebar-avatar {
  border: 2px solid #e5e7eb;
  background: #f3f4f6;
}
.pwa-sidebar .sidebar-user-name {
  color: #222;
}
.pwa-sidebar .sidebar-user-username {
  color: #888;
}
.pwa-sidebar .sidebar-menu {
  padding-top: 18px;
}
.pwa-sidebar .sidebar-menu-item {
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.pwa-sidebar .sidebar-menu-item.active {
  background: #e8f0fe;
  color: #2563eb;
  border-left: 4px solid #2563eb;
}
.pwa-sidebar .sidebar-menu-item:hover {
  background: #f3f6ff;
  color: #2563eb;
}
.pwa-sidebar .sidebar-menu-icon {
  color: #888;
  transition: color 0.15s;
}
.pwa-sidebar .sidebar-menu-item.active .sidebar-menu-icon,
.pwa-sidebar .sidebar-menu-item:hover .sidebar-menu-icon {
  color: #2563eb;
}
.pwa-sidebar .sidebar-badge {
  display: inline-block;
  min-width: 18px;
  padding: 2px 6px;
  font-size: 12px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  margin-left: 8px;
  font-weight: 600;
  vertical-align: middle;
}
.pwa-sidebar .sidebar-group {
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}
.pwa-sidebar .sidebar-group-title {
  font-size: 13px;
  color: #aaa;
  font-weight: 600;
  margin: 0 0 6px 28px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pwa-sidebar .sidebar-collapsible {
  cursor: pointer;
  user-select: none;
}
.pwa-sidebar .sidebar-collapsible .fa-chevron-down {
  margin-left: auto;
  font-size: 13px;
  transition: transform 0.2s;
}
.pwa-sidebar .sidebar-collapsible.open .fa-chevron-down {
  transform: rotate(180deg);
}
.pwa-sidebar .sidebar-collapsible-list {
  display: none;
  padding-left: 18px;
}
.pwa-sidebar .sidebar-collapsible.open + .sidebar-collapsible-list {
  display: block;
}
.pwa-sidebar .sidebar-app-info {
  background: #fafbfc;
  border-top: 1px solid #f0f0f0;
}
/* --- Disable dark mode for now --- */
[class*="dark"], [class*="dark-mode"] {
  background: #fff !important;
  color: #222 !important;
} 