/* ============================================
   MOBILE INVOICE APP - FIXED VERSION
   Modern Mobile-First Design
   ============================================ */

/* ============================================
   1. CRITICAL: ALWAYS APPLY MOBILE STYLES
   ============================================ */

/* Force mobile styles at 768px and below */
@media screen and (max-width: 768px) {

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #0f0f0f 0%, #1a1a2e 100%);
  min-height: 100vh;
  color: #ffffff;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(244, 208, 63, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(39, 174, 96, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* ============================================
   2. HIDE DESKTOP NAVIGATION
   ============================================ */
.navbar,
.advanced-navbar,
nav.navbar,
.desktop-nav {
  display: none !important;
}

/* ============================================
   3. MOBILE BOTTOM NAVIGATION
   ============================================ */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(244, 208, 63, 0.2);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  z-index: 1000;
  box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-tab i {
  font-size: 22px;
  transition: all 0.3s ease;
}

.nav-tab span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-tab.active {
  color: #f4d03f;
}

.nav-tab.active i {
  transform: scale(1.2);
  filter: drop-shadow(0 0 8px rgba(244, 208, 63, 0.6));
}

.nav-tab:active {
  transform: scale(0.95);
}

/* ============================================
   4. MOBILE HEADER
   ============================================ */
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 999;
  padding: 15px;
  background: transparent;
}

.mobile-header-card {
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(244, 208, 63, 0.1);
}

/* ============================================
   5. MAIN CONTAINER
   ============================================ */
.main-container {
  max-width: 100%;
  padding: 0 15px 90px 15px;
  position: relative;
  z-index: 1;
}

/* ============================================
   6. INVOICE CONTAINER - FULL WIDTH MOBILE
   ============================================ */
#invoice {
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(20px);
  border-radius: 25px;
  overflow: hidden;
  margin: 0 0 20px 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(244, 208, 63, 0.2);
  animation: slideUp 0.6s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   7. INVOICE HEADER
   ============================================ */
.invoice-header {
  background: linear-gradient(135deg, #f4d03f 0%, #f1c40f 100%);
  color: #1a1a1a;
  text-align: center;
  padding: 30px 20px;
  position: relative;
  overflow: hidden;
}

.invoice-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}

/* ============================================
   8. BILL INFO SECTION
   ============================================ */
.bill-info-section {
  padding: 20px;
  background: transparent;
}

.info-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 18px;
  border-radius: 15px;
  border: 1px solid rgba(244, 208, 63, 0.2);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  margin-bottom: 15px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-label {
  font-weight: 700;
  color: #f4d03f;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-input,
.info-value {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(244, 208, 63, 0.3);
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  text-align: right;
  min-width: 140px;
}

.info-input:focus {
  outline: none;
  background: rgba(244, 208, 63, 0.15);
  border-color: #f4d03f;
  box-shadow: 0 0 0 3px rgba(244, 208, 63, 0.2);
}

/* ============================================
   9. CUSTOMER INFO
   ============================================ */
.customer-info {
  padding: 20px;
  background: transparent;
}

.customer-field {
  margin-bottom: 15px;
}

.customer-field label {
  color: #f4d03f;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

.customer-field input {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid rgba(244, 208, 63, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 16px;
  transition: all 0.3s ease;
}

.customer-field input:focus {
  outline: none;
  border-color: #f4d03f;
  background: rgba(244, 208, 63, 0.1);
  box-shadow: 0 0 0 4px rgba(244, 208, 63, 0.15);
}

/* ============================================
   10. TOTALS SECTION
   ============================================ */
.totals-section {
  padding: 20px;
  background: transparent;
}

.total-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  border: 1px solid rgba(244, 208, 63, 0.2);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  margin-bottom: 12px;
}

.total-item.main-total {
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.2), rgba(39, 174, 96, 0.1));
  border: 2px solid #27ae60;
  padding: 22px 20px;
  box-shadow: 0 8px 30px rgba(39, 174, 96, 0.3);
}

.total-label {
  font-weight: 700;
  color: #f4d03f;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.total-value {
  font-weight: 800;
  font-size: 20px;
  color: #ffffff;
}

.main-total .total-label,
.main-total .total-value {
  color: #27ae60;
}

.main-total .total-value {
  font-size: 26px;
}

/* ============================================
   11. ACTION BUTTONS
   ============================================ */
.action-buttons {
  padding: 20px;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.action-btn,
button {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

/* Button Colors */
button[onclick*="printBill"],
.btn-print {
  background: linear-gradient(135deg, #2c2c2c, #1a1a1a);
  color: #f4d03f;
}

button[onclick*="editItems"],
.btn-edit {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

button[onclick*="applyDiscount"],
.btn-discount {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

button[onclick*="saveData"],
.btn-save {
  background: linear-gradient(135deg, #f4d03f, #f1c40f);
  color: #1a1a1a;
}

button[onclick*="viewDrafts"],
.btn-drafts {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

button:active {
  transform: scale(0.97);
}

/* ============================================
   12. FORM INPUTS
   ============================================ */
input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(244, 208, 63, 0.2);
  border-radius: 15px;
  color: #ffffff;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #f4d03f;
  background: rgba(244, 208, 63, 0.1);
  box-shadow: 0 0 0 4px rgba(244, 208, 63, 0.15);
}

/* ============================================
   13. RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 480px) {
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .invoice-header h1 {
    font-size: 24px;
  }
  
  button,
  .action-btn {
    padding: 16px 15px;
    font-size: 13px;
  }
}

/* ============================================
   14. PRINT STYLES
   ============================================ */
@media print {
  body {
    background: white !important;
  }
  
  .mobile-bottom-nav,
  .mobile-header,
  .action-buttons,
  button {
    display: none !important;
  }
  
  #invoice {
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
}

/* ============================================
   15. SAFE AREA SUPPORT (iPhone Notch)
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(70px + env(safe-area-inset-bottom));
  }
  
  .main-container {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }
}

/* ============================================
   16. SMOOTH SCROLLING
   ============================================ */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* ============================================
   17. UTILITY CLASSES
   ============================================ */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.mb-15 { margin-bottom: 15px !important; }
.mb-20 { margin-bottom: 20px !important; }

} /* End of mobile media query */