/*
 * auraERP – Brand Stylesheet
 * Bootstrap 5 CSS variable overrides + custom components.
 */

/* ── Brand colour palette ───────────────────────────────────────────── */
:root {
  --aura-primary:       #2563eb;   /* vibrant blue  */
  --aura-primary-dark:  #1d4ed8;
  --aura-accent:        #7c3aed;   /* purple accent */
  --aura-sidebar-bg:    #0f172a;   /* dark navy     */
  --aura-sidebar-text:  #cbd5e1;
  --aura-sidebar-hover: #1e293b;
  --aura-sidebar-active:#2563eb;
  --aura-topbar-height: 56px;
  --aura-sidebar-width: 240px;

  /* Bootstrap overrides */
  --bs-primary:       var(--aura-primary);
  --bs-primary-rgb:   37, 99, 235;
  --bs-link-color:    var(--aura-primary);
}

/* ── Layout shell ───────────────────────────────────────────────────── */
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background-color: #f8fafc;
}

#aura-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
#aura-sidebar {
  width: var(--aura-sidebar-width);
  min-height: 100vh;
  background: var(--aura-sidebar-bg);
  color: var(--aura-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease;
  overflow: hidden;
}

#aura-sidebar.collapsed {
  width: 60px;
}

.aura-logo {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.6rem;
  border-bottom: 1px solid #1e293b;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.aura-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--aura-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
}

.aura-logo .logo-text {
  transition: opacity 0.2s;
}

#aura-sidebar.collapsed .logo-text,
#aura-sidebar.collapsed .nav-label,
#aura-sidebar.collapsed .module-label {
  opacity: 0;
  pointer-events: none;
}

/* sidebar nav items */
.aura-nav {
  flex: 1;
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
  overflow-y: auto;
}

.aura-nav-section {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  white-space: nowrap;
}

.aura-nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1rem;
  color: var(--aura-sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.aura-nav-item a:hover {
  background: var(--aura-sidebar-hover);
  color: #fff;
}

.aura-nav-item a.active {
  background: var(--aura-sidebar-active);
  color: #fff;
}

.aura-nav-item a .nav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

/* ── Main content area ──────────────────────────────────────────────── */
#aura-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Top navigation bar ─────────────────────────────────────────────── */
#aura-topbar {
  height: var(--aura-topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.aura-topbar-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1e293b;
}

.aura-topbar-spacer { flex: 1; }

/* ── Page content ───────────────────────────────────────────────────── */
#aura-content {
  flex: 1;
  padding: 1.5rem;
}

/* ── Cards ──────────────────────────────────────────────────────────── */
.aura-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
}

.aura-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.aura-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  margin: 0;
}

/* ── Tables ─────────────────────────────────────────────────────────── */
.aura-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.aura-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.aura-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

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

.aura-table .action-col {
  width: 100px;
  text-align: right;
}

/* ── Badges / Status ────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 0.2em 0.55em;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-active   { background: #dcfce7; color: #166534; }
.status-inactive { background: #fee2e2; color: #991b1b; }
.status-pending  { background: #fef9c3; color: #854d0e; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn-aura-primary {
  background: var(--aura-primary);
  color: #fff;
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-aura-primary:hover { background: var(--aura-primary-dark); color: #fff; }

/* ── Login page ─────────────────────────────────────────────────────── */
.aura-login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.aura-login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.aura-login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.aura-login-logo .logo-icon {
  width: 42px;
  height: 42px;
  background: var(--aura-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  font-weight: 900;
}

.aura-login-logo .logo-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.aura-login-logo .logo-name span {
  color: var(--aura-primary);
}

/* ── HTMX loading indicator ─────────────────────────────────────────── */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* ── Toast notifications ────────────────────────────────────────────── */
#aura-toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aura-toast {
  background: #1e293b;
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  min-width: 260px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
}

.aura-toast.success { background: #166534; }
.aura-toast.error   { background: #991b1b; }
.aura-toast.warning { background: #854d0e; }

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

/* ── Form elements ──────────────────────────────────────────────────── */
.aura-form-group {
  margin-bottom: 1rem;
}

.aura-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aura-form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #aura-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: left 0.2s ease;
  }

  #aura-sidebar.open {
    left: 0;
  }

  #aura-sidebar.collapsed {
    width: var(--aura-sidebar-width);
  }
}
