:root {
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --card-bg: #252525;
    --accent-color: #00f5ff;
    --accent-glow: rgba(0, 245, 255, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-muted: #495670;
    --border-color: #333333;
    --success-color: #00ff88;
    --error-color: #ff4757;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #00f5ff 0%, #0066ff 100%);
    --shadow-glow: 0 0 30px rgba(0, 245, 255, 0.1);
    --font-primary: 'Rajdhani', sans-serif;
    --font-accent: 'Orbitron', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(0, 245, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    flex-direction: column;
}

.logo {
    font-family: var(--font-accent);
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    text-shadow: 0 0 30px rgba(0, 245, 255, 0.5);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(37, 37, 37, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nav-link:hover, .nav-link.active {
    background: rgba(0, 245, 255, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-header {
    margin-bottom: 3rem;
}

.page-title {
    font-family: var(--font-accent);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(0, 245, 255, 0.05) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.stat-card:hover::before {
    transform: translateX(100%);
}

.stat-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-glow);
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-content h3 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.full-width {
    grid-column: 1 / -1;
}

.chart-container, .recent-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.chart-container:hover, .recent-section:hover {
    border-color: rgba(0, 245, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 245, 255, 0.1);
}

.section-title {
    font-family: var(--font-accent);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    letter-spacing: 1px;
}

/* Sales List */
.sales-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sale-item {
   background: rgba(37, 37, 37, 0.5);
   border: 1px solid var(--border-color);
   border-radius: 12px;
   padding: 1.5rem;
   display: flex;
   justify-content: space-between;
   align-items: center;
   transition: all 0.3s ease;
   position: relative;
   overflow: hidden;
}

.sale-item::before {
   content: '';
   position: absolute;
   left: 0;
   top: 0;
   width: 3px;
   height: 100%;
   background: var(--gradient-accent);
   transform: scaleY(0);
   transition: transform 0.3s ease;
}

.sale-item:hover::before {
   transform: scaleY(1);
}

.sale-item:hover {
   background: rgba(0, 245, 255, 0.05);
   border-color: var(--accent-color);
   transform: translateX(10px);
}

.sale-info h4 {
   font-size: 1.2rem;
   font-weight: 600;
   color: var(--text-primary);
   margin-bottom: 0.5rem;
}

.sale-info p {
   color: var(--text-secondary);
   font-size: 0.9rem;
}

.sale-amount {
   font-size: 1.3rem;
   font-weight: 700;
   color: var(--accent-color);
   font-family: var(--font-accent);
}

/* Ingredients List */
.ingredients-list {
   display: flex;
   flex-direction: column;
   gap: 1.5rem;
}

.ingredient-batch {
   background: rgba(37, 37, 37, 0.5);
   border: 1px solid var(--border-color);
   border-radius: 12px;
   padding: 1.5rem;
   transition: all 0.3s ease;
}

.ingredient-batch:hover {
   background: rgba(0, 245, 255, 0.05);
   border-color: var(--accent-color);
   box-shadow: 0 5px 20px rgba(0, 245, 255, 0.1);
}

.batch-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 1rem;
   padding-bottom: 1rem;
   border-bottom: 1px solid var(--border-color);
}

.batch-header h4 {
   font-size: 1.2rem;
   font-weight: 600;
   color: var(--text-primary);
}

.batch-meta {
   display: flex;
   gap: 1rem;
   align-items: center;
}

.batch-date {
   color: var(--text-secondary);
   font-size: 0.9rem;
}

.batch-total {
   font-size: 1.2rem;
   font-weight: 700;
   color: var(--accent-color);
   font-family: var(--font-accent);
}

.batch-items {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 0.75rem;
}

.batch-item {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 0.75rem;
   background: rgba(0, 0, 0, 0.3);
   border-radius: 8px;
   border: 1px solid rgba(51, 51, 51, 0.5);
}

.item-name {
   color: var(--text-primary);
   font-weight: 500;
}

.item-cost {
   color: var(--success-color);
   font-weight: 600;
   font-family: var(--font-accent);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

@keyframes fadeIn {
   from { opacity: 0; }
   to { opacity: 1; }
}

.modal-content {
    background: var(--card-bg);
    margin: 2rem auto;
    padding: 0;
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 245, 255, 0.3);
    animation: slideIn 0.4s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.modal-content.wide {
    max-width: 700px;
}

@keyframes slideIn {
   from { transform: translateY(-50px) scale(0.9); opacity: 0; }
   to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
   background: var(--gradient-accent);
   color: white;
   padding: 1.5rem 2rem;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.modal-header h3 {
   font-family: var(--font-accent);
   font-size: 1.5rem;
   font-weight: 700;
}

.close {
   color: white;
   font-size: 2rem;
   font-weight: bold;
   cursor: pointer;
   transition: all 0.3s ease;
   width: 30px;
   height: 30px;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 50%;
}

.close:hover {
   background: rgba(255, 255, 255, 0.2);
   transform: rotate(90deg);
}

/* Form Styles */
.form {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group {
   margin-bottom: 1.5rem;
}

.form-row {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 1rem;
}

.form-group label {
   display: block;
   margin-bottom: 0.5rem;
   color: var(--text-primary);
   font-weight: 600;
   letter-spacing: 0.5px;
}

.form-group input, .form-group select {
   width: 100%;
   padding: 1rem;
   background: rgba(37, 37, 37, 0.8);
   border: 1px solid var(--border-color);
   border-radius: 10px;
   color: var(--text-primary);
   font-size: 1rem;
   transition: all 0.3s ease;
   font-family: var(--font-primary);
}

.form-group input:focus, .form-group select:focus {
   outline: none;
   border-color: var(--accent-color);
   background: rgba(37, 37, 37, 1);
   box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

/* Ingredients Section */
.ingredients-section {
    margin: 2rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#ingredientsList {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 1rem;
}

#ingredientsList::-webkit-scrollbar {
    width: 6px;
}

#ingredientsList::-webkit-scrollbar-track {
    background: rgba(37, 37, 37, 0.5);
    border-radius: 3px;
}

#ingredientsList::-webkit-scrollbar-thumb {
    background: var(--gradient-accent);
    border-radius: 3px;
}

#ingredientsList::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.ingredients-section h4 {
   color: var(--accent-color);
   font-size: 1.2rem;
   margin-bottom: 1rem;
   font-family: var(--font-accent);
}

.ingredient-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.btn-remove {
   width: 40px;
   height: 40px;
   background: var(--error-color);
   border: none;
   border-radius: 50%;
   color: white;
   font-size: 1.2rem;
   cursor: pointer;
   transition: all 0.3s ease;
   display: flex;
   align-items: center;
   justify-content: center;
}

.btn-remove:hover {
   background: #ff3742;
   transform: scale(1.1);
}

.total-section {
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin: 1.5rem 0 1rem 0;
    flex-shrink: 0;
}

.total-display {
   font-size: 1.3rem;
   color: var(--accent-color);
   font-family: var(--font-accent);
}

/* Buttons */
.btn-primary, .btn-secondary {
   padding: 1rem 2rem;
   border: none;
   border-radius: 12px;
   font-size: 1rem;
   font-weight: 600;
   cursor: pointer;
   transition: all 0.3s ease;
   text-transform: uppercase;
   letter-spacing: 1px;
   font-family: var(--font-accent);
   position: relative;
   overflow: hidden;
}

.btn-primary {
    margin-top: 1rem;
    flex-shrink: 0;
}

.btn-secondary {
    margin: 1rem 0;
    flex-shrink: 0;
}

.btn-primary {
   background: var(--gradient-accent);
   color: white;
   width: 100%;
   margin-top: 1rem;
}

.btn-primary::before {
   content: '';
   position: absolute;
   top: 0;
   left: -100%;
   width: 100%;
   height: 100%;
   background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
   transition: left 0.5s ease;
}

.btn-primary:hover::before {
   left: 100%;
}

.btn-primary:hover {
   transform: translateY(-3px);
   box-shadow: 0 10px 30px rgba(0, 245, 255, 0.4);
}

.btn-secondary {
   background: transparent;
   color: var(--accent-color);
   border: 2px solid var(--accent-color);
   margin: 1rem 0;
}

.btn-secondary:hover {
   background: var(--accent-color);
   color: white;
   transform: translateY(-2px);
   box-shadow: 0 5px 20px rgba(0, 245, 255, 0.3);
}

/* Floating Action Button */
.fab-container {
   position: fixed;
   bottom: 2rem;
   right: 2rem;
   z-index: 1500;
}

.fab {
   width: 60px;
   height: 60px;
   border-radius: 50%;
   background: var(--gradient-accent);
   border: none;
   color: white;
   font-size: 1.5rem;
   cursor: pointer;
   box-shadow: 0 8px 25px rgba(0, 245, 255, 0.4);
   transition: all 0.3s ease;
   display: flex;
   align-items: center;
   justify-content: center;
}

.fab:hover {
   transform: translateY(-5px) scale(1.1);
   box-shadow: 0 15px 40px rgba(0, 245, 255, 0.6);
}

.fab span {
   font-weight: bold;
   font-size: 2rem;
}

/* Notification */
.notification {
   position: fixed;
   top: 2rem;
   right: 2rem;
   padding: 1rem 2rem;
   border-radius: 12px;
   color: white;
   font-weight: 600;
   z-index: 3000;
   transform: translateX(400px);
   transition: all 0.4s ease;
   font-family: var(--font-accent);
   letter-spacing: 0.5px;
}

.notification.show {
   transform: translateX(0);
}

.notification.success {
   background: linear-gradient(135deg, var(--success-color), #00cc6a);
   box-shadow: 0 8px 25px rgba(0, 255, 136, 0.3);
}

.notification.error {
   background: linear-gradient(135deg, var(--error-color), #ff3742);
   box-shadow: 0 8px 25px rgba(255, 71, 87, 0.3);
}

/* Chart Styling */
canvas {
   max-height: 400px !important;
   border-radius: 12px;
}

.ingredient-name, 
.ingredient-quantity, 
.ingredient-kg, 
.ingredient-cost {
    padding: 1rem;
    background: rgba(37, 37, 37, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
}

.ingredient-name:focus, 
.ingredient-quantity:focus, 
.ingredient-kg:focus, 
.ingredient-cost:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(37, 37, 37, 1);
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

.added-by {
    font-size: 0.8rem !important;
    color: var(--accent-color) !important;
    font-style: italic;
    margin-top: 0.25rem;
}

.batch-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-edit, .btn-delete {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-edit {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    color: white;
}

.btn-edit:hover {
    background: linear-gradient(135deg, #ff8c00, #ff7700);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 165, 0, 0.4);
}

.btn-delete {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: white;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #ff3742, #ff2732);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

.permission-notice {
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-size: 0.9rem;
}

.sale-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.sale-actions {
    display: flex;
    gap: 0.5rem;
}

.sale-actions .btn-edit,
.sale-actions .btn-delete {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Loading Animation */
@keyframes pulse {
   0%, 100% { opacity: 1; }
   50% { opacity: 0.5; }
}

.loading {
   animation: pulse 2s infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
   width: 8px;
}

::-webkit-scrollbar-track {
   background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
   background: var(--gradient-accent);
   border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
   background: var(--accent-color);
}

/* Selection Styling */
::selection {
   background: rgba(0, 245, 255, 0.3);
   color: var(--text-primary);
}

/* Focus Visible */
*:focus-visible {
   outline: 2px solid var(--accent-color);
   outline-offset: 2px;
}

/* IMPROVED RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 1024px) {
   .content-grid {
       grid-template-columns: 1fr;
   }
   
   .stats-grid {
       grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
   }
   
   .main-content {
       padding: 1.5rem;
   }
}

@media (max-width: 768px) {
   /* Navigation improvements */
   .navbar {
       flex-direction: column;
       gap: 1rem;
       padding: 1rem;
       position: relative;
   }
   
   .nav-links {
       flex-wrap: wrap;
       justify-content: center;
       width: 100%;
       gap: 0.5rem;
   }
   
   .nav-link {
       padding: 0.5rem 1rem;
       font-size: 0.9rem;
       flex: 1;
       min-width: 120px;
       max-width: 150px;
       justify-content: center;
   }
   
   .logo {
       font-size: 1.8rem;
       text-align: center;
   }
   
   .subtitle {
       text-align: center;
   }
   
   /* Main content adjustments */
   .main-content {
       padding: 1rem;
   }
   
   .dashboard-header {
       margin-bottom: 2rem;
   }
   
   .page-title {
       font-size: 2rem;
       margin-bottom: 1.5rem;
   }
   
   /* Stats grid - 2 columns on tablets */
   .stats-grid {
       grid-template-columns: repeat(2, 1fr);
       gap: 1rem;
   }
   
   .stat-card {
       padding: 1rem;
       min-height: 120px;
       gap: 1rem;
   }
   
   .stat-icon {
       font-size: 2.5rem;
   }
   
   .stat-content h3 {
       font-size: 1.8rem;
   }
   
   .stat-content p {
       font-size: 1rem;
   }
   
   /* Content sections */
   .content-grid {
       gap: 1rem;
       margin-bottom: 1rem;
   }
   
   .chart-container, .recent-section {
       padding: 1.5rem;
       border-radius: 12px;
   }
   
   .section-title {
       font-size: 1.3rem;
       margin-bottom: 1rem;
   }
   
   /* Sales list mobile improvements */
   .sale-item {
       flex-direction: column;
       gap: 1rem;
       padding: 1rem;
   }
   
   .sale-item:hover {
       transform: translateY(-3px);
   }
   
   .sale-info {
       width: 100%;
   }
   
   .sale-details {
       width: 100%;
       flex-direction: row;
       justify-content: space-between;
       align-items: center;
   }
   
   .sale-actions {
       gap: 0.5rem;
   }
   
   .sale-actions .btn-edit,
   .sale-actions .btn-delete {
       padding: 0.4rem 0.8rem;
       font-size: 0.75rem;
       min-width: 44px;
       min-height: 44px;
   }
   
   /* Modal improvements */
   .modal-content {
       margin: 0.5rem auto;
       width: 95%;
       max-width: 95vw;
       max-height: 95vh;
       border-radius: 15px;
   }
   
   .modal-header {
       padding: 1rem;
   }
   
   .modal-header h3 {
       font-size: 1.3rem;
   }
   
   .close {
       min-width: 44px;
       min-height: 44px;
       font-size: 1.8rem;
   }
   
   /* Form improvements */
   .form {
       padding: 1rem;
       max-height: calc(95vh - 80px);
   }
   
   .form-row {
       grid-template-columns: 1fr;
       gap: 1rem;
  }
  
  .form-group {
      margin-bottom: 1rem;
  }
  
  .form-group input,
  .form-group select {
      padding: 0.75rem;
      font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Ingredients section mobile */
  .ingredients-section h4 {
      font-size: 1.1rem;
      margin-bottom: 0.75rem;
  }
  
  #ingredientsList {
      max-height: 250px;
  }
  
  .ingredient-row {
      grid-template-columns: 1fr;
      gap: 0.75rem;
      background: rgba(37, 37, 37, 0.3);
      padding: 1rem;
      border-radius: 8px;
      margin-bottom: 1rem;
  }
  
  .ingredient-row input {
      padding: 0.75rem;
  }
  
  .btn-remove {
      width: 44px;
      height: 44px;
      margin-top: 0.5rem;
      align-self: center;
      font-size: 1.1rem;
  }
  
  .total-section {
      padding: 1rem;
      margin: 1rem 0;
  }
  
  .total-display {
      font-size: 1.2rem;
  }
  
  /* Button improvements */
  .btn-primary,
  .btn-secondary {
      padding: 0.75rem 1.5rem;
      font-size: 0.9rem;
      min-height: 44px;
  }
  
  /* Batch items mobile */
  .batch-items {
      grid-template-columns: 1fr;
  }
  
  .batch-header {
      flex-direction: column;
      gap: 1rem;
      text-align: center;
  }
  
  .batch-meta {
      justify-content: center;
      flex-wrap: wrap;
  }
  
  /* FAB adjustments */
  .fab {
      width: 56px;
      height: 56px;
      bottom: 1rem;
      right: 1rem;
      font-size: 1.3rem;
  }
  
  .fab span {
      font-size: 1.8rem;
  }
  
  /* Notification mobile */
  .notification {
      top: 1rem;
      right: 1rem;
      left: 1rem;
      transform: translateY(-100px);
      font-size: 0.9rem;
      padding: 0.75rem 1rem;
  }
  
  .notification.show {
      transform: translateY(0);
  }
}

@media (max-width: 640px) {
  /* Single column stats on small tablets */
  .stats-grid {
      grid-template-columns: 1fr;
  }
  
  .nav-links {
      gap: 0.25rem;
  }
  
  .nav-link {
      min-width: 100px;
      max-width: 130px;
      padding: 0.5rem 0.75rem;
      font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  /* Very small screens */
  .navbar {
      padding: 0.75rem;
  }
  
  .logo {
      font-size: 1.5rem;
      letter-spacing: 2px;
  }
  
  .subtitle {
      font-size: 0.75rem;
  }
  
  .main-content {
      padding: 0.75rem;
  }
  
  .page-title {
      font-size: 1.8rem;
      margin-bottom: 1rem;
  }
  
  /* Stats cards - vertical layout on very small screens */
  .stat-card {
      flex-direction: column;
      text-align: center;
      gap: 0.75rem;
      padding: 1rem;
  }
  
  .stat-icon {
      font-size: 2rem;
  }
  
  .stat-content h3 {
      font-size: 1.5rem;
  }
  
  .stat-content p {
      font-size: 0.9rem;
  }
  
  /* Chart and sections */
  .chart-container, .recent-section {
      padding: 1rem;
  }
  
  .section-title {
      font-size: 1.2rem;
  }
  
  /* Sales items */
  .sale-item {
      padding: 0.75rem;
  }
  
  .sale-info h4 {
      font-size: 1.1rem;
  }
  
  .sale-info p {
      font-size: 0.85rem;
  }
  
  .sale-amount {
      font-size: 1.1rem;
  }
  
  /* Modal very small screens */
  .modal-content {
      margin: 0.25rem auto;
      width: 98%;
      max-height: 98vh;
      border-radius: 12px;
  }
  
  .modal-header {
      padding: 0.75rem;
  }
  
  .modal-header h3 {
      font-size: 1.2rem;
  }
  
  .form {
      padding: 0.75rem;
  }
  
  .form-group input,
  .form-group select {
      padding: 0.625rem;
  }
  
  /* Ingredients list smaller */
  #ingredientsList {
      max-height: 200px;
  }
  
  .ingredient-row {
      padding: 0.75rem;
      gap: 0.5rem;
  }
  
  .btn-remove {
      width: 40px;
      height: 40px;
      font-size: 1rem;
  }
  
  /* Batch improvements */
  .ingredient-batch {
      padding: 1rem;
  }
  
  .batch-header {
      margin-bottom: 0.75rem;
      padding-bottom: 0.75rem;
  }
  
  .batch-header h4 {
      font-size: 1.1rem;
  }
  
  .batch-total {
      font-size: 1.1rem;
  }
  
  .batch-date {
      font-size: 0.8rem;
  }
  
  /* Navigation very small */
  .nav-links {
      flex-direction: column;
      width: 100%;
  }
  
  .nav-link {
      width: 100%;
      max-width: none;
      justify-content: center;
  }
  
  /* FAB smaller */
  .fab {
      width: 50px;
      height: 50px;
      bottom: 0.75rem;
      right: 0.75rem;
  }
  
  .fab span {
      font-size: 1.6rem;
  }
  
  /* Buttons full width on very small screens */
  .btn-primary,
  .btn-secondary {
      width: 100%;
      padding: 0.75rem;
      font-size: 0.85rem;
  }
}

/* Landscape phone optimizations */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-content {
      max-height: 95vh;
      margin: 0.25rem auto;
  }
  
  .form {
      padding: 0.5rem;
  }
  
  .modal-header {
      padding: 0.5rem 1rem;
  }
  
  .modal-header h3 {
      font-size: 1.1rem;
  }
  
  #ingredientsList {
      max-height: 150px;
  }
  
  .ingredient-row {
      padding: 0.5rem;
  }
  
  .total-section {
      padding: 0.75rem;
      margin: 0.5rem 0;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Ensure all interactive elements are touch-friendly */
  .btn-edit,
  .btn-delete,
  .btn-remove,
  .close,
  .nav-link,
  .fab {
      min-width: 44px;
      min-height: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .stat-card:hover,
  .sale-item:hover,
  .ingredient-batch:hover,
  .chart-container:hover,
  .recent-section:hover {
      transform: none;
  }
  
  /* Larger tap targets for form elements */
  .form-group input,
  .form-group select {
      min-height: 44px;
      padding: 0.75rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure crisp rendering on retina displays */
  .logo,
  .stat-icon,
  .section-title {
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
  }
}

/* Print styles */
@media print {
  .navbar,
  .fab-container,
  .notification,
  .modal,
  .btn-edit,
  .btn-delete,
  .btn-remove {
      display: none !important;
  }
  
  .main-content {
      padding: 0;
      max-width: none;
  }
  
  .stats-grid {
      break-inside: avoid;
  }
  
  .stat-card {
      break-inside: avoid;
      box-shadow: none;
      border: 1px solid #ccc;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
  }
  
  body::before {
      animation: none;
  }
  
  .stat-card::before,
  .sale-item::before {
      display: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
      --border-color: #ffffff;
      --text-secondary: #ffffff;
  }
  
  .stat-card,
  .sale-item,
  .ingredient-batch,
  .chart-container,
  .recent-section {
      border-width: 2px;
  }
}

/* Dark mode preferences (redundant but explicit) */
@media (prefers-color-scheme: dark) {
  /* Your design is already dark, but this ensures consistency */
  body {
      background: var(--primary-bg);
      color: var(--text-primary);
  }
}

/* Textarea Styles */
.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(37, 37, 37, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-primary);
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    transition: all 0.3s ease;
    position: relative;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(37, 37, 37, 1);
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.2);
}

.form-group textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.form-group textarea:focus::placeholder {
    opacity: 0.5;
}

/* Custom scrollbar for textarea */
.form-group textarea::-webkit-scrollbar {
    width: 8px;
}

.form-group textarea::-webkit-scrollbar-track {
    background: rgba(37, 37, 37, 0.5);
    border-radius: 4px;
    margin: 2px;
}

.form-group textarea::-webkit-scrollbar-thumb {
    background: var(--gradient-accent);
    border-radius: 4px;
    border: 1px solid rgba(37, 37, 37, 0.8);
}

.form-group textarea::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Enhanced focus state with glow effect */
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(37, 37, 37, 1);
    box-shadow: 
        0 0 20px rgba(0, 245, 255, 0.2),
        inset 0 1px 3px rgba(0, 245, 255, 0.1);
}

/* Hover state */
.form-group textarea:hover:not(:focus) {
    border-color: rgba(0, 245, 255, 0.5);
    background: rgba(37, 37, 37, 0.9);
}

/* Character counter styling (if needed) */
.textarea-counter {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-accent);
}

.textarea-counter.warning {
    color: #ffa500;
}

.textarea-counter.danger {
    color: var(--error-color);
}

/* Mobile responsiveness for textarea */
@media (max-width: 768px) {
    .form-group textarea {
        padding: 0.75rem;
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 80px;
    }
}

@media (max-width: 480px) {
    .form-group textarea {
        padding: 0.625rem;
        min-height: 70px;
        border-radius: 8px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .form-group textarea {
        min-height: 100px;
        padding: 0.75rem;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .form-group textarea {
        border-width: 2px;
    }
    
    .form-group textarea:focus {
        border-width: 3px;
    }
}

/* Debt Item Cards */
.debt-item {
    background: rgba(37, 37, 37, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.debt-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-accent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.debt-item:hover::before {
    transform: scaleY(1);
}

.debt-item:hover {
    background: rgba(0, 245, 255, 0.08);
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 245, 255, 0.15);
}

.debt-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debt-info h4 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-family: var(--font-accent);
    letter-spacing: 0.5px;
}

.debt-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.debt-notes {
    background: rgba(0, 245, 255, 0.1);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    font-style: italic;
    color: var(--accent-color) !important;
    margin-top: 0.5rem;
}

.debt-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    min-width: 200px;
}

.debt-amount {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-color);
    font-family: var(--font-accent);
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

.debt-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.status-paid {
    background: linear-gradient(135deg, var(--success-color), #00cc6a);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.status-unpaid {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.3);
}

.debt-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.debt-actions .btn-edit,
.debt-actions .btn-delete {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 3rem;
    background: rgba(37, 37, 37, 0.3);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    font-size: 1.1rem;
}

/* Mobile responsiveness for debt cards */
@media (max-width: 768px) {
    .debt-item {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .debt-details {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-width: auto;
    }
    
    .debt-amount {
        font-size: 1.5rem;
    }
    
    .debt-status {
        align-items: center;
    }
    
    .debt-actions {
        justify-content: center;
        margin-top: 0;
    }
    
    .debt-info h4 {
        font-size: 1.2rem;
    }
    
    .debt-notes {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .debt-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .debt-details {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .debt-amount {
        font-size: 1.3rem;
    }
    
    .debt-actions .btn-edit,
    .debt-actions .btn-delete {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    
    .status-paid,
    .status-unpaid {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}