/* 
 * LAPHONG ACCOUNTING DESIGN SYSTEM
 * accounting.laphong.org
 * Professional Financial & Accounting UI Style Guide
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
  /* Color Palette - Financial & Professional */
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #1e293b;

  --bg-app: #f8fafc;
  --surface-card: #ffffff;
  --surface-muted: #f1f5f9;
  
  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-light: #eff6ff;

  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-info: #0284c7;
  --color-info-bg: #f0f9ff;
  --color-purple: #8b5cf6;
  --color-purple-bg: #f5f3ff;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

/* Layout Container */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* LEFT SIDEBAR */
.app-sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 40;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 20px 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  padding: 8px 12px 6px;
  letter-spacing: 0.8px;
}

.nav-item {
  list-style: none;
  margin-bottom: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link svg {
  flex-shrink: 0;
  color: #64748b;
  transition: color 0.15s ease;
}

.nav-link:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-link:hover svg {
  color: #ffffff;
}

.nav-link.active {
  background-color: var(--brand-primary);
  color: #ffffff;
  font-weight: 600;
}

.nav-link.active svg {
  color: #ffffff;
}

/* SIDEBAR USER BOTTOM AREA */
.sidebar-user-area {
  padding: 14px 14px;
  border-top: 1px solid var(--sidebar-border);
  background-color: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-profile-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  overflow: hidden;
  white-space: nowrap;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 11px;
  color: #94a3b8;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-logout:hover {
  background-color: #334155;
  color: #ef4444;
}

/* MAIN CONTENT AREA */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-topbar {
  background-color: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
}

.topbar-badge-system {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-container {
  padding: 28px;
  flex: 1;
}

/* VIEW HEADERS */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}

.view-breadcrumb {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.view-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CARDS */
.card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
  padding: 20px;
}

.card-header {
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: var(--font-body);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
}

.btn-secondary {
  background-color: var(--surface-card);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--surface-muted);
  color: var(--text-primary);
}

.btn-secondary.active {
  background-color: var(--sidebar-hover);
  color: #fff;
  border-color: var(--sidebar-hover);
}

.btn-table-action {
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--brand-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-table-action:hover {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary);
}

.btn-group-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-icon-action {
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon-action:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.btn-icon-action.highlight {
  color: var(--brand-primary);
  border-color: #bfdbfe;
  background: #eff6ff;
}

.btn-icon-action.highlight:hover {
  background: #dbeafe;
}

/* TABLES */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background-color: var(--surface-muted);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.badge-success {
  background-color: var(--color-success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background-color: var(--color-warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-danger {
  background-color: var(--color-danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-indigo {
  background-color: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.badge-cyan {
  background-color: #ecfeff;
  color: #155e75;
  border: 1px solid #a5f3fc;
}

.badge-neutral {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-subtle {
  background-color: #f1f5f9;
  color: #64748b;
}

.badge-code {
  font-family: var(--font-mono);
  background-color: #f1f5f9;
  color: #334155;
  font-size: 11px;
}

.badge-category {
  background-color: #f8fafc;
  color: #475569;
  border: 1px solid var(--border-subtle);
}

.badge-mock {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge-mock-hero {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-md);
}

/* FORMS */
.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: var(--font-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  appearance: none;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.form-group {
  margin-bottom: 14px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 10px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-group .form-control {
  padding-left: 34px;
}

/* MODAL SYSTEM */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.btn-close:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13.5px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast-item {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  animation: toastIn 0.25s ease forwards;
}

.toast-item.toast-fade-out {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.3s ease;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info { border-left: 4px solid var(--brand-primary); }

.toast-icon { flex-shrink: 0; display: flex; }
.toast-success .toast-icon { color: var(--color-success); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--brand-primary); }

.toast-message { flex: 1; color: var(--text-primary); font-weight: 500; }
.toast-close { background: none; border: none; font-size: 16px; color: var(--text-muted); cursor: pointer; }

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

/* UTILITY CLASSES */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-emerald { color: #059669; }
.text-emerald-600 { color: #059669; }
.text-amber { color: #d97706; }
.text-rose { color: #e11d48; }
.text-rose-600 { color: #e11d48; }
.text-indigo-600 { color: #4f46e5; }
.text-slate-900 { color: #0f172a; }
.text-slate-700 { color: #334155; }
.text-slate-500 { color: #64748b; }
.text-slate-400 { color: #94a3b8; }
.flex { display: flex; }
.items-center { align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

.link-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
}
.link-action:hover {
  text-decoration: underline;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }
  .btn-menu-toggle {
    display: block;
  }
  .view-container {
    padding: 16px;
  }
}
