/* ===================================
   Print Voucher System - Enhanced Stylesheet
   With Dark/Light Theme Switcher
   =================================== */

/* Light Theme Variables (Default) */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Light Theme Colors - White Background */
  --bg-body: #ffffff; /* Changed to white */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);

  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
}

/* Dark Theme Variables - Black Background */
[data-theme="dark"] {
  --bg-body: #000000; /* Changed to black */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.5);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg-body);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Main Layout Container */
.main-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation (Desktop) */
.sidebar {
  width: 280px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  padding: 20px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: var(--transition);
  z-index: 100;
}

.sidebar-header {
  padding: 20px 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin: 15px 0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.user-role {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.theme-toggle {
  position: relative;
  width: 50px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-primary);
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: 0 2px 4px var(--shadow);
}

[data-theme="dark"] .theme-toggle {
  background: var(--primary);
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateX(24px);
}

.theme-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Sidebar Menu */
.sidebar-menu {
  list-style: none;
  padding: 0;
}

.menu-section {
  margin-bottom: 25px;
}

.menu-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding: 0 10px;
}

.menu-item {
  margin-bottom: 5px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.menu-link:hover,
.menu-link.active {
  background: var(--bg-secondary);
  color: var(--primary);
}

.menu-icon {
  font-size: 18px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 20px;
  transition: var(--transition);
}

/* Top Header (Desktop) */
.top-header {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px 30px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Container */
.container {
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px var(--shadow);
  padding: 30px;
}

/* Action Cards */
.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.card {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px var(--shadow);
  border-color: var(--primary);
}

.card-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.upload-icon {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.scan-icon {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.manual-icon {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.card h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

/* Icons */
.icon-ticket::before {
  content: "🎫";
}
.icon-upload::before {
  content: "📤";
}
.icon-camera::before {
  content: "📷";
}
.icon-edit::before {
  content: "✏️";
}
.icon-settings::before {
  content: "⚙️";
}
.icon-print::before {
  content: "🖨️";
}
.icon-moon::before {
  content: "🌙";
}
.icon-sun::before {
  content: "☀️";
}
.icon-menu::before {
  content: "☰";
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  outline: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--bg-primary);
}

.btn-success {
  background: var(--success);
  color: var(--bg-primary);
}

.btn-danger {
  background: var(--danger);
  color: var(--bg-primary);
}

.btn-settings {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Voucher Section */
.voucher-section {
  margin-top: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.actions {
  display: flex;
  gap: 10px;
}

/* Voucher List */
.voucher-list {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 20px;
  max-height: 600px;
  overflow-y: auto;
}

.voucher-item {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 15px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 20px;
  align-items: center;
  transition: var(--transition);
}

.voucher-item:hover {
  box-shadow: 0 4px 12px var(--shadow);
  border-color: var(--primary);
}

.voucher-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.voucher-details {
  flex: 1;
}

.voucher-code {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 5px;
  font-family: "Courier New", monospace;
}

.voucher-meta {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}

.voucher-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-active {
  background: #d1fae5;
  color: #065f46;
}

[data-theme="dark"] .status-active {
  background: #064e3b;
  color: #6ee7b7;
}

.status-used {
  background: #e5e7eb;
  color: #374151;
}

[data-theme="dark"] .status-used {
  background: #374151;
  color: #d1d5db;
}

.status-expired {
  background: #fee2e2;
  color: #991b1b;
}

[data-theme="dark"] .status-expired {
  background: #7f1d1d;
  color: #fca5a5;
}

.voucher-actions {
  display: flex;
  gap: 10px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state::before {
  content: "📋";
  display: block;
  font-size: 64px;
  margin-bottom: 20px;
}

/* Mobile Sidebar Toggle */
.mobile-header {
  display: none;
  background: var(--bg-primary);
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-primary);
  padding: 5px;
}

.mobile-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 25px 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.close {
  font-size: 28px;
  font-weight: 300;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 30px;
}

.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  cursor: pointer;
}

/* Camera Container */
#cameraContainer {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#videoElement {
  width: 100%;
  display: block;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 24px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px var(--shadow-lg);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 2000;
  max-width: 350px;
  font-size: 14px;
  font-weight: 500;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: var(--success);
  color: white;
}

.toast.error {
  background: var(--danger);
  color: white;
}

.toast.warning {
  background: var(--warning);
  color: white;
}

/* Print Styles */
@media print {
  body {
    background: white;
    padding: 0;
  }

  .sidebar,
  .mobile-header,
  .top-header,
  .action-cards,
  .section-header,
  .voucher-checkbox,
  .voucher-actions,
  .modal {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }

  .voucher-item {
    page-break-inside: avoid;
    border: 2px solid black;
    margin-bottom: 20px;
    padding: 20px;
  }

  .voucher-code {
    font-size: 24px;
    color: black;
  }
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
  .sidebar {
    width: 250px;
  }

  .main-content {
    margin-left: 250px;
  }

  .action-cards {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    top: 0;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 70px 15px 15px;
  }

  .top-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
    padding: 15px;
  }

  .header-actions {
    flex-direction: column;
  }

  .container {
    padding: 20px;
    border-radius: var(--radius-sm);
  }

  .action-cards {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .card {
    padding: 20px;
  }

  .card-icon {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .section-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .actions {
    flex-direction: column;
  }

  .voucher-item {
    grid-template-columns: auto 1fr;
    gap: 15px;
    padding: 15px;
  }

  .voucher-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
    flex-direction: column;
  }

  .voucher-meta {
    flex-direction: column;
    gap: 5px;
  }

  .modal-content {
    width: 95%;
    margin: 10px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 20px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    transform: translateY(200px);
  }

  .toast.show {
    transform: translateY(0);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .mobile-header {
    padding: 12px 15px;
  }

  .main-content {
    padding: 60px 10px 10px;
  }

  .container {
    padding: 15px;
  }

  .voucher-list {
    padding: 10px;
  }

  .voucher-item {
    padding: 12px;
  }
}
