/* ========================================
   YASSIN AGENCY - Dashboard CSS
   Professional Infrastructure Design System
   ======================================== */

/* ── Root Variables & Foundation ──────────────── */
:root {
  /* Primary Colors */
  --primary: #162839;
  --on-primary: #ffffff;
  --primary-container: #2c3e50;
  --on-primary-container: #96a9be;

  /* Secondary Colors (Orange) */
  --secondary: #a83a00;
  --on-secondary: #ffffff;
  --secondary-container: #d4af37;
  --on-secondary-container: #5b1b00;

  /* Tertiary Colors (Gold) */
  --tertiary: #735c00;
  --on-tertiary: #ffffff;
  --tertiary-container: #cca730;

  /* Surface & Background */
  --surface: #ffffff;
  --on-surface: #181c1e;
  --surface-variant: #e0e3e5;
  --on-surface-variant: #43474c;
  --background: #f7fafc;
  --on-background: #181c1e;

  /* Outline & Borders */
  --outline: #74777d;
  --outline-variant: #e1e8ed;
  --surface-container-low: #f1f4f6;
  --surface-container: #ebeef0;

  /* Semantic Colors */
  --error: #ba1a1a;
  --on-error: #ffffff;
  --error-container: #ffdad6;

  /* Spacing */
  --spacing-base: 8px;
  --spacing-gutter: 24px;
  --spacing-margin: 32px;

  /* Border Radius */
  --radius-sm: 0.125rem;
  --radius-default: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-headline-lg: 32px;
  --font-headline-md: 24px;
  --font-headline-sm: 18px;
  --font-body-lg: 16px;
  --font-body-md: 14px;
  --font-label-caps: 12px;
  --font-label-md: 12px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(22, 40, 57, 0.04);
  --shadow-md: 0 4px 12px rgba(22, 40, 57, 0.08);
  --shadow-lg: 0 12px 24px rgba(22, 40, 57, 0.15);
  --shadow-inset: inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

/* ── Global Styles ───────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--on-surface);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Typography ──────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
}

h1, .headline-lg { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
h2, .headline-md { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
h3, .headline-sm { font-size: 18px; font-weight: 600; }
.body-lg { font-size: 16px; font-weight: 400; line-height: 24px; }
.body-md { font-size: 14px; font-weight: 400; line-height: 20px; }
.label-caps { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.label-md { font-size: 12px; font-weight: 600; line-height: 16px; }

/* ── Layout Structure ────────────────────────── */
body {
  display: flex;
  flex-direction: column;
}

.shell {
  display: flex;
  flex: 1;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background-color: var(--primary);
  color: var(--on-primary);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: 0 8px 16px rgba(22, 40, 57, 0.15);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s ease;
  border-right: 4px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  opacity: 1;
}

.nav-item.active {
  background-color: rgba(212, 175, 55, 0.1);
  border-right-color: var(--secondary-container);
  color: white;
}

.nav-item i {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

/* ── Header / Top Navigation ──────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  height: 80px;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  z-index: 40;
}

.notif-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background-color: var(--secondary-container);
  border-radius: 50%;
  border: 2px solid white;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--outline-variant);
}

.user-info {
  text-align: right;
}

.user-role {
  font-size: 9px;
  color: var(--secondary-container);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-primary);
  border: 2px solid var(--outline-variant);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Main Content ────────────────────────────── */
.main {
  margin-left: 260px;
  padding-top: 80px;
  flex: 1;
  min-height: 100vh;
}

.content {
  padding: 40px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ── Bespoke Cards (Function Boxes) ──────────── */
.bespoke-card {
  background: linear-gradient(145deg, #ffffff, #f1f4f6);
  border: 1px solid var(--outline-variant);
  border-radius: 16px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 4px rgba(22, 40, 57, 0.04), var(--shadow-inset);
}

.bespoke-card:hover {
  border-color: var(--secondary-container);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(212, 175, 55, 0.15),
              0 4px 8px -2px rgba(212, 175, 55, 0.1),
              var(--shadow-inset);
}

.bespoke-card i {
  font-size: 36px;
  color: var(--secondary-container);
}

/* ── Icon Shield (Custom Icon Style) ─────────── */
.icon-shield {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  box-shadow: 0 8px 16px rgba(22, 40, 57, 0.1);
}

.icon-shield::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.2));
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
}

.icon-shield i {
  position: relative;
  z-index: 10;
  font-size: 36px;
  color: var(--secondary-container);
}

.bespoke-card:hover .icon-shield {
  transform: scale(1.05);
}

/* ── Buttons ────────────────────────────────── */
.btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--secondary-container);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background-color: transparent;
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-variant);
}

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

/* ── Responsive Design ──────────────────────── */
@media (max-width: 1200px) {
  .topbar {
    padding: 0 24px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    box-shadow: none;
    border-bottom: 1px solid var(--outline-variant);
  }

  .main, .topbar {
    margin-left: 0;
    left: 0;
    position: static;
  }

  .topbar {
    position: sticky;
    top: 0;
    flex-wrap: wrap;
    height: auto;
    padding: 16px 20px;
  }

  .content {
    padding: 20px 16px;
  }

  .nav-item {
    flex: 1;
    min-width: 120px;
  }
}

/* ── Utility Classes ────────────────────────── */
.text-muted {
  color: var(--on-surface-variant);
  opacity: 0.7;
}

.rounded-md {
  border-radius: var(--radius-lg);
}

/* ── Search Results (Dropdown) ───────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.search-results.active {
  display: block;
}

/* ── Animations ──────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ── Print Styles ────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-actions {
    display: none;
  }

  .main {
    margin-left: 0;
    padding-top: 0;
  }
}

/* ── Toast Notifications ──────────────────────── */
#toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background-color: var(--surface);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  pointer-events: auto;
  min-width: 300px;
  max-width: 450px;
  animation: toast-slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-left-width: 4px;
}

@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast i { font-size: 20px; }
.toast span { flex: 1; }

.toast.success { border-left-color: #22c55e; }
.toast.success i { color: #22c55e; }

.toast.error { border-left-color: #ef4444; }
.toast.error i { color: #ef4444; }

.toast.warning { border-left-color: #f59e0b; }
.toast.warning i { color: #f59e0b; }

.toast.info { border-left-color: #3b82f6; }
.toast.info i { color: #3b82f6; }


/* ── Premium Modals (.pm-*) ───────────────────── */
.pm-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9990;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.pm-backdrop.open {
  opacity: 1;
}

.pm-dialog {
  background-color: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pm-backdrop.open .pm-dialog {
  transform: scale(1) translateY(0);
}

.pm-header {
  padding: 24px;
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
}

.pm-header.accent {
  background: linear-gradient(to right, rgba(212, 175, 55, 0.05), transparent);
  border-bottom-color: rgba(212, 175, 55, 0.2);
}

.pm-header.danger {
  background: linear-gradient(to right, rgba(239, 68, 68, 0.05), transparent);
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

.pm-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--surface-container-low);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.pm-header.accent .pm-header-icon {
  background-color: rgba(212, 175, 55, 0.1);
  color: var(--secondary-container);
}

.pm-header.danger .pm-header-icon {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.pm-header-text { flex: 1; }
.pm-header-title { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.pm-header-sub { font-size: 13px; color: var(--on-surface-variant); }

.pm-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.pm-close:hover {
  background-color: var(--surface-container);
  color: var(--primary);
}

.pm-steps {
  display: flex;
  padding: 16px 24px;
  background-color: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
  gap: 24px;
}

.pm-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  opacity: 0.6;
}

.pm-step.active {
  color: var(--primary);
  opacity: 1;
}

.pm-step.done {
  color: var(--secondary-container);
  opacity: 1;
}

.pm-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--outline-variant);
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.pm-step.active .pm-step-num { background-color: var(--primary); color: white; }
.pm-step.done .pm-step-num { background-color: var(--secondary-container); color: white; }

.pm-body {
  padding: 24px;
}

.pm-section {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-section i { color: var(--secondary-container); }

.pm-grid { display: grid; gap: 16px; }
.pm-grid-2 { grid-template-columns: 1fr 1fr; }
.pm-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.pm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pm-col-full { grid-column: 1 / -1; }

.pm-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.pm-label .req { color: #ef4444; }

.pm-input, .pm-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background-color: var(--surface-container-low);
  font-size: 14px;
  color: var(--primary);
  transition: all 0.2s;
  outline: none;
}

.pm-input:focus, .pm-select:focus {
  border-color: var(--secondary-container);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
  background-color: var(--surface);
}

.pm-input.invalid, .pm-select.invalid {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.05);
}

.pm-hint { font-size: 11px; color: var(--on-surface-variant); opacity: 0.8; }
.pm-error { font-size: 11px; color: #ef4444; display: none; font-weight: 600; }
.pm-field.err .pm-error { display: block; }

.pm-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--outline-variant);
  background-color: var(--surface-container-low);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
