/* 
  CSS Variables - Premium Light Theme 
*/
:root {
  --bg-color: #f3f6f9; /* Soft light grayish blue */
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.4);
  --text-main: #1e293b; /* Slate 800 */
  --text-muted: #64748b; /* Slate 500 */
  --brand-color: #ea580c; /* Orange 600 */
  --brand-hover: #c2410c; /* Orange 700 */
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,0.03) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo i {
  font-size: 2rem;
  color: var(--brand-color);
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 1rem;
  margin-left: 8px;
}

.settings-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.settings-btn:hover {
  color: var(--brand-color);
  box-shadow: var(--shadow-sm);
  transform: rotate(15deg);
}

.main-content {
  display: flex;
  gap: 2rem;
  flex: 1;
  overflow: hidden;
}

.input-section {
  flex: 3;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 10px;
  padding-bottom: 2rem;
}

.summary-section {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-width: 350px;
}

/* Utility Classes */
.mt-4 { margin-top: 1.5rem; }
.h-full { height: 100%; }
.flex-col { display: flex; flex-direction: column; }
.text-brand { color: var(--brand-color); }
.w-full { width: 100%; }

/* Cards (Glassmorphism) */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.card-header h2 i {
  color: var(--brand-color);
}

.card-body {
  padding: 1.5rem;
}

/* Forms */
.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.add-item-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.flex-2 { flex: 2; }
.flex-1 { flex: 1; }

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.hidden-label {
  visibility: hidden;
}

input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.8);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

input:focus {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #ffffff;
}

/* Buttons */
.btn-primary {
  background: var(--brand-color);
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Cart / Summary */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  opacity: 0.6;
  text-align: center;
}

.empty-cart i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.cart-item {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.item-total {
  font-weight: 700;
  color: var(--brand-color);
}

.btn-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover {
  background: #fee2e2;
  color: var(--danger);
}

.cart-footer {
  padding: 1.5rem;
  background: rgba(255,255,255,0.5);
  border-top: 1px solid rgba(0,0,0,0.05);
  border-radius: 0 0 var(--radius) var(--radius);
}

.totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 6px 0;
}

.grand-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}


/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }

/* Print Styles */
.print-only { display: none; }

#printTemplate {
    padding: 20px;
    font-family: 'Inter', sans-serif;
    color: black;
    background: white;
}
  
  .print-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #ea580c;
    padding-bottom: 20px;
    margin-bottom: 30px;
  }
  
  .print-logo h2 { color: #ea580c; font-size: 24px; margin-bottom: 5px; }
  .print-logo p { color: #64748b; font-size: 14px; }
  
  .print-info h1 { font-size: 28px; margin-bottom: 5px; text-align: right; }
  .print-info p { text-align: right; color: #64748b; }
  
  .print-customer {
    margin-bottom: 40px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
  }
  .print-customer h3 { margin-bottom: 10px; font-size: 16px; border-bottom: 1px solid #e2e8f0; padding-bottom: 5px; }
  .print-customer p { margin-bottom: 5px; font-size: 14px; }
  
  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
  }
  
  .print-table th {
    background: #f1f5f9;
    padding: 10px;
    text-align: left;
    font-size: 14px;
    border-bottom: 2px solid #cbd5e1;
  }
  
  .print-table td {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
  }
  
  .print-totals {
    width: 300px;
    float: right;
  }
  
  .p-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
  }
  
  .p-grand {
    font-weight: bold;
    font-size: 18px;
    border-top: 2px solid #cbd5e1;
    margin-top: 5px;
    padding-top: 10px;
  }
  
  .print-footer {
    clear: both;
    margin-top: 150px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
  }

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-container {
    padding: 1rem;
    height: auto;
    overflow: visible;
  }
  .app-header {
    margin-bottom: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .settings-btn {
    align-self: flex-end;
    margin-top: -3rem;
  }
  .main-content {
    flex-direction: column;
    overflow: visible;
  }
  .input-section {
    padding-right: 0;
    overflow-y: visible;
    padding-bottom: 0;
  }
  .summary-section {
    min-width: 100%;
    margin-top: 1rem;
  }
  .form-row {
    flex-direction: column;
    gap: 1rem;
  }
  .add-item-form {
    flex-direction: column;
    align-items: stretch;
  }
  .hidden-label {
    display: none;
  }
  .btn-group {
    margin-top: 0.5rem;
  }
}
