:root{
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #0d6efd;
  --muted: #64748b;
  --border: #e2e8f0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

/* Split Layout */
.app-container {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  height: 100%;
  overflow-y: auto;
  transition: all 0.3s ease;
  background: var(--card);
  position: relative;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .menu-text,
.sidebar.collapsed .text-uppercase,
.sidebar.collapsed hr {
  display: none;
}

.sidebar.collapsed .menu-item {
  padding: 0.75rem;
  justify-content: center;
}

.sidebar.collapsed .menu-item i {
  margin: 0;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg);
  transition: margin-left 0.3s ease;
}

.menu-toggle {
  position: absolute;
  right: -12px;
  top: 15px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.3s ease;
}

.menu-toggle:hover {
  transform: scale(1.1);
}

.sidebar.collapsed .menu-toggle {
  transform: rotate(180deg);
}

.sidebar.collapsed .menu-toggle:hover {
  transform: rotate(180deg) scale(1.1);
}

/* Menu System */
.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--bs-body-color);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.menu-item:hover {
  background: rgba(13,110,253,0.05);
  border-left-color: var(--accent);
  color: var(--accent);
}

.menu-item.active {
  background: rgba(13,110,253,0.1);
  border-left-color: var(--accent);
  color: var(--accent);
}

/* Modern UI Elements */
.editor-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.form-control, .input-group-text {
  border-color: var(--border);
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}
.form-control-lg {
  border-radius: 8px;
}
.btn {
  border-radius: 8px;
  font-weight: 500;
}
.table {
  --bs-table-border-color: var(--border);
}
.invoice-card {
  border: none;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.05);
}

/* Navigation and theme */
.navbar{
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
  padding: 0.5rem 1rem;
}
.navbar-brand{
  font-weight: 600;
}
.site-logo{
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.dropdown-item .form-switch{
  padding-left: 0;
}

/* Dark mode */
[data-bs-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --muted: #94a3b8;
  --border: #334155;
}

[data-bs-theme="dark"] .navbar {
  background-color: #1e293b !important;
  border-bottom-color: #334155 !important;
}

[data-bs-theme="dark"] .menu-item {
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .menu-item:hover {
  background: rgba(255,255,255,0.05);
}

[data-bs-theme="dark"] .menu-item.active {
  background: rgba(255,255,255,0.1);
}

[data-bs-theme="dark"] .sidebar {
  background: var(--card);
  border-right-color: var(--border);
}

/* Keep invoice preview light even in dark mode */
#invoicePreview {
  background: white !important;
  color: black !important;
}
#invoicePreview .text-muted {
  color: #64748b !important;
}
#invoicePreview .table {
  color: black !important;
}
#invoicePreview .table thead {
  background: #f8fafc !important;
  color: black !important;
}
#invoicePreview .card-header {
  background: white !important;
  color: black !important;
}
#invoicePreview .badge {
  background: #0d6efd !important;
  color: white !important;
}

body{background:var(--bg);}
.invoice-card{
  background:var(--card);
  border-radius:8px;
  box-shadow:0 6px 18px rgba(0,0,0,0.06);
}
.invoice-table th, .invoice-table td{vertical-align:middle}

#invoicePreview{
  width: 210mm; /* A4 width */
  min-height: 297mm; /* A4 height */
  padding: 20mm; /* standard margin */
  margin: 0 auto;
  background: white;
}

/* Hide elements from PDF */
@media print {
  .pdf-exclude {
    display: none !important;
  }
}

.table thead th{border-bottom:2px solid #e9ecef}

/* printer friendly adjustments */
@media print{
  body{background:white}
}

/* header and logo */
.site-header{background:linear-gradient(90deg, rgba(13,110,253,0.08), rgba(13,110,253,0.02)); padding:12px; border-radius:10px}
.site-logo{width:48px; height:48px; object-fit:contain}
.preview-logo{max-width:200px; max-height:80px; object-fit:contain}

/* small responsive tweaks */
@media (max-width:767px){
  .site-header{flex-direction:column; align-items:flex-start}
  .site-logo{width:40px;height:40px}
}

/* invoice footer */
.invoice-footer{border-top:1px solid #eef2f6}
.footer-logo{width:32px; height:32px; object-fit:contain}
.invoice-footer .small{color:var(--muted)}
#qrcode{display:inline-block; background:white; padding:8px; border-radius:4px}
