/**
 * AL-HASSAN BRICKS — DIGI KHATA
 * Global Stylesheet — Sleek Interface Theme
 * Building Trust, Delivering Quality
 */

:root {
  /* Brand Palette */
  --color-primary: #8B0000;
  --color-primary-hover: #700000;
  --color-primary-light: #FEE2E2;
  --color-secondary: #CC5500;
  --color-secondary-hover: #B24700;
  --color-gold: #FFD700;
  
  /* Backgrounds & Canvas */
  --bg-app: #FDFBF7;
  --bg-card: #FFFFFF;
  --bg-muted: #F8F9FA;
  --bg-sidebar: #8B0000;
  --bg-sidebar-active: #CC5500;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.1);
  
  /* Typography & Neutrals */
  --text-main: #333333;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --text-white: #FFFFFF;
  
  /* Borders & Dividers */
  --border-subtle: #F3F4F6;
  --border-default: #E5E7EB;
  --border-sidebar: rgba(255, 255, 255, 0.12);
  
  /* Functional Accents */
  --color-success: #16A34A;
  --color-success-bg: #DCFCE7;
  --color-warning: #D97706;
  --color-warning-bg: #FEF3C7;
  --color-danger: #DC2626;
  --color-danger-bg: #FEE2E2;
  
  /* Elevation & Geometry */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  /* Fonts */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background-color: var(--bg-app);
  overflow-x: hidden;
  position: relative;
}

/* Sidebar Backdrop Overlay for Mobile/Tablet */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

body.sidebar-locked {
  overflow: hidden;
}

/* Sidebar Styling - Premium Kiln Brick Aesthetic */
.app-sidebar {
  width: 260px;
  background-color: #7C1313;
  /* Authentic Brickwork Pattern Texture */
  background-image: 
    linear-gradient(180deg, rgba(20, 5, 5, 0.45) 0%, rgba(12, 3, 3, 0.75) 100%),
    /* Mortar & Brick Bond Layer */
    linear-gradient(to right, rgba(0, 0, 0, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 1px, transparent 1px);
  background-size: 100% 100%, 54px 26px, 54px 26px, 54px 26px;
  background-position: 0 0, 0 0, 0 0, 27px 13px;
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
  z-index: 100;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-right: 2px solid rgba(204, 85, 0, 0.4);
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.22);
}

.sidebar-brand {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 215, 0, 0.25);
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.95) 0%, rgba(60, 10, 10, 0.95) 100%);
  position: relative;
}

.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #CC5500 0%, #FFD700 50%, #CC5500 100%);
}

.brand-logo-container {
  width: 48px;
  height: 48px;
  background: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--color-gold);
  overflow: hidden;
  transition: transform 0.2s ease;
}

.brand-logo-container:hover {
  transform: scale(1.05);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand h1,
.brand-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.sidebar-brand .tagline {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-gold);
  margin-top: 0.2rem;
  opacity: 0.95;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.mobile-close-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white) !important;
  text-decoration: none;
  border: none;
}

.mobile-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.18s ease;
  min-height: 42px;
  border-radius: 8px;
  border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  padding-left: 1.25rem;
  border-left-color: rgba(255, 215, 0, 0.6);
}

.sidebar-nav-link.active {
  background: linear-gradient(90deg, rgba(204, 85, 0, 0.9) 0%, rgba(160, 50, 0, 0.75) 100%);
  color: #FFFFFF;
  font-weight: 700;
  border-left: 4px solid var(--color-gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-nav-link .nav-icon {
  margin-right: 0.75rem;
  width: 1.25rem;
  font-size: 1.15rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

/* Main Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-app);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Top Header */
.app-header {
  height: 4rem;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.btn-hamburger-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background-color: #F3F4F6;
  color: var(--color-primary);
  border: 1px solid var(--border-default);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-hamburger-toggle:hover,
.btn-hamburger-toggle:active {
  background-color: var(--color-primary-light);
  color: var(--color-primary-hover);
  border-color: var(--color-primary);
}

.header-title-area {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.header-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-date {
  font-size: 0.75rem;
  color: var(--text-light);
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.header-avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius-full);
  background: #FFFFFF;
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  border: 2px solid #E5E7EB;
  flex-shrink: 0;
  overflow: hidden;
  padding: 1px;
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}

/* Toast Notifications */
.custom-toast {
  min-width: 280px;
  max-width: 420px;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--color-primary);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.custom-toast.toast-success {
  border-left-color: var(--color-success);
}

.custom-toast.toast-danger {
  border-left-color: var(--color-primary);
}

.custom-toast.toast-info {
  border-left-color: #0284C7;
}

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

