* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: background 0.4s ease, color 0.4s ease;
  min-height: 100vh;
}

/* LIGHT THEME */
body.light {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
}

/* DARK THEME */
body.dark {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #f0f0f0;
}

.wrapper {
  min-height: 100vh;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 1000px;
}

/* GLASS MORPHISM CARD */
.card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

body.dark .card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: inherit;
  font-weight: 700;
}

/* HEADER CARD */
.header-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 35px 28px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.dark .header-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.header-title h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 5px;
  color: #ffffff;
}

.header-title p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.theme-btn {
  font-size: 1.8rem;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1) rotate(20deg);
}

/* FORM CARD */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

body.dark .form-group input:focus {
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

/* BUTTONS */
.btn-primary {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  font-size: 1rem;
  height: fit-content;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
  transform: translateY(-1px);
}

body.dark .btn-primary {
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.4);
}

body.dark .btn-primary:hover {
  box-shadow: 0 6px 25px rgba(167, 139, 250, 0.6);
}

.btn-print {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-print:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

body.dark .btn-print {
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.4);
}

body.dark .btn-print:hover {
  box-shadow: 0 6px 25px rgba(167, 139, 250, 0.6);
}

.btn-reset {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 14px 32px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-reset:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(245, 87, 108, 0.6);
}

body.dark .btn-reset {
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

body.dark .btn-reset:hover {
  box-shadow: 0 6px 25px rgba(245, 87, 108, 0.5);
}

/* DISCOUNT CARD */
.discount-card {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%);
  border: 2px solid rgba(255, 193, 7, 0.3);
}

body.dark .discount-card {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 152, 0, 0.1) 100%);
  border: 2px solid rgba(255, 193, 7, 0.25);
}

.discount-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
}

.discount-input {
  display: flex;
  flex-direction: column;
}

.discount-input label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.discount-input input {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.discount-input input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

.discount-display {
  background: rgba(255, 193, 7, 0.15);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.discount-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-weight: 600;
}

.discount-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffc107;
}

/* TABLE CARD */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.08);
}

thead {
  background: rgba(102, 126, 234, 0.2);
}

body.dark thead {
  background: rgba(167, 139, 250, 0.15);
}

th {
  padding: 16px;
  text-align: left;
  font-weight: 700;
  color: inherit;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.1);
}

body.dark tbody tr:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* TABLE BUTTONS */
table button {
  padding: 8px 14px;
  margin: 0 4px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

table button:first-child {
  background: rgba(102, 126, 234, 0.8);
  color: white;
}

table button:first-child:hover {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.05);
}

table button:last-child {
  background: rgba(244, 63, 94, 0.8);
  color: white;
}

table button:last-child:hover {
  background: rgba(244, 63, 94, 1);
  transform: scale(1.05);
}

body.dark table button:first-child {
  background: rgba(167, 139, 250, 0.8);
}

body.dark table button:first-child:hover {
  background: rgba(167, 139, 250, 1);
}

/* EMPTY STATE */
.empty-state {
  display: none;
  text-align: center;
  padding: 40px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
}

.empty-state.show {
  display: block;
}

/* TOTALS CARD */
.totals-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  border: 2px solid rgba(102, 126, 234, 0.3);
}

body.dark .totals-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
  border: 2px solid rgba(167, 139, 250, 0.3);
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.total-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
}

.total-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: inherit;
}

.total-value.discount-row {
  color: #ffc107;
}

.grand-total-row {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
  border: 2px solid rgba(102, 126, 234, 0.5);
  padding: 18px;
  font-size: 1.1rem;
}

body.dark .grand-total-row {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.25) 0%, rgba(244, 114, 182, 0.25) 100%);
  border: 2px solid rgba(167, 139, 250, 0.5);
}

.grand-total {
  font-size: 1.5rem;
  color: #ffffff;
}

/* ACTION BUTTONS */
.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.action-buttons button {
  width: 100%;
}

/* PRINT FOOTER */
.print-footer {
  text-align: center;
  padding: 40px 20px;
  display: none;
  margin-top: 40px;
}

.thank-you {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #333;
}

.visit-again {
  font-size: 1.1rem;
  color: #555;
  font-style: italic;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .wrapper {
    padding: 12px;
  }

  .header-content {
    flex-direction: column;
    gap: 16px;
  }

  .header-title h1 {
    font-size: 2rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .btn-primary {
    width: 100%;
  }

  .discount-content {
    grid-template-columns: 1fr;
  }

  th, td {
    padding: 10px 8px;
    font-size: 0.9rem;
  }

  table button {
    padding: 6px 10px;
    font-size: 0.8rem;
    margin: 2px;
  }

  .totals-grid {
    grid-template-columns: 1fr;
  }

  .grand-total-row {
    grid-column: auto;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .wrapper {
    padding: 10px;
  }

  .card,
  .header-card {
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 16px;
  }

  .header-title h1 {
    font-size: 1.5rem;
  }

  .header-title p {
    font-size: 0.9rem;
  }

  .card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 0.75rem;
  }

  .form-group input {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .btn-primary {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  th, td {
    padding: 8px 6px;
    font-size: 0.8rem;
  }

  table button {
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  .total-row {
    padding: 12px;
  }

  .total-value {
    font-size: 1.1rem;
  }

  .grand-total {
    font-size: 1.3rem;
  }
}

/* PRINT LAYOUT */
@media print {
  .wrapper {
    padding: 0;
    background: white;
  }

  .card,
  .header-card {
    background: white !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    margin-bottom: 20px;
  }

  button,
  input,
  .theme-btn,
  .action-buttons,
  .form-card,
  .discount-card {
    display: none;
  }

  body,
  body.light,
  body.dark {
    background: white;
    color: black;
  }

  .header-title h1,
  .header-title p {
    color: black;
  }

  .table-card,
  .totals-card {
    page-break-inside: avoid;
  }

  .table-card h2,
  .totals-card h2 {
    color: black;
  }

  table {
    background: white;
    border-collapse: collapse;
  }

  thead {
    background: #e8e8e8;
  }

  th {
    background: #e8e8e8 !important;
    color: black !important;
    border: 1px solid #333 !important;
    padding: 12px !important;
    font-weight: 700;
  }

  td {
    border: 1px solid #ccc !important;
    padding: 10px !important;
    color: black !important;
  }

  tbody tr {
    background: white !important;
  }

  .totals-card {
    background: white;
    border: 1px solid #ccc;
  }

  .total-row {
    background: #f9f9f9 !important;
    border: 1px solid #ccc !important;
    padding: 12px !important;
  }

  .grand-total-row {
    grid-column: 1 / -1 !important;
    background: #e8e8e8 !important;
    border: 2px solid #333 !important;
  }

  .total-label,
  .total-value,
  .total-value.discount-row {
    color: black !important;
  }

  .grand-total {
    color: black !important;
  }

  .print-footer {
    display: block;
    border-top: 2px solid #333;
    padding: 30px 20px;
    margin-top: 40px;
    page-break-inside: avoid;
  }

  .thank-you {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
  }

  .visit-again {
    font-size: 1.2rem;
    color: #555;
    font-style: italic;
  }
}
