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

/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --background: #070a12;
  --background-subtle: #0b0f19;
  
  --foreground: #f8fafc;
  --muted-foreground: #94a3b8;
  
  --card: rgba(17, 24, 39, 0.65);
  --card-hover: rgba(26, 35, 54, 0.8);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(99, 102, 241, 0.35);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-foreground: #ffffff;
  
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-rose: #f43f5e;
  
  --secondary: rgba(255, 255, 255, 0.05);
  --secondary-hover: rgba(255, 255, 255, 0.09);
  --secondary-foreground: #e2e8f0;
  
  --destructive: #ef4444;
  --destructive-light: rgba(239, 68, 68, 0.12);
  --destructive-foreground: #ffffff;
  
  --border: rgba(255, 255, 255, 0.08);
  --input: rgba(15, 23, 42, 0.7);
  --input-focus: rgba(99, 102, 241, 0.2);
  
  --radius-sm: 0.5rem;
  --radius: 0.875rem;
  --radius-lg: 1.25rem;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 4px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.2);
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 10, 18, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* --- BASE RESETS & TYPOGRAPHY --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- CORE LAYOUT --- */
.app-container {
  display: flex;
  min-height: 100vh;
  background: radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 40%),
              var(--background);
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 2.25rem;
  padding: 0 0.5rem;
}

.sidebar-logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.sidebar-logo-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  -webkit-text-fill-color: initial;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--foreground);
  transform: translateX(3px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: auto;
}

.user-profile-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 0.875rem;
}

.user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-rose));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--foreground);
}

.user-role {
  font-size: 0.7rem;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* Main Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.top-navbar {
  height: 72px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
}

.top-navbar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-navbar-title span {
  background: linear-gradient(135deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.main-content {
  padding: 2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 72px);
}

/* --- BUTTON PRIMITIVES --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--primary-foreground);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #6366f1, #4338ca);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: rgba(255, 255, 255, 0.08);
}

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

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--foreground);
}

/* --- CARD PRIMITIVES --- */
.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

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

.card-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-top: 0.2rem;
}

/* --- DATA TABLES --- */
.table-container {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

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

.data-table th {
  background-color: rgba(255, 255, 255, 0.03);
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--muted-foreground);
  text-transform: uppercase;
  font-size: 0.725rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background-color 0.2s ease;
}

.data-table tbody tr:hover td {
  background-color: rgba(99, 102, 241, 0.04);
}

/* Empty state indicator */
.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--muted-foreground);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

/* --- BADGES --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.badge-info {
  background-color: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}

.badge-neutral {
  background-color: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.2);
}

/* --- FORMS & INPUTS --- */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  font-family: var(--font-body);
  background-color: var(--input);
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--input-focus);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 1.1rem;
  padding-right: 2.5rem;
}

/* --- POPUP MODAL OVERLAY --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-content {
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border-hover);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8),
              0 0 30px rgba(99, 102, 241, 0.15);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

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

.modal-body {
  padding: 1.75rem;
}

.modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: rgba(11, 15, 25, 0.4);
}

/* --- FEEDBACK ALERTS --- */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid transparent;
}

.alert-danger {
  background-color: var(--destructive-light);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

/* --- APP FOOTER --- */
.app-footer {
  margin-top: auto;
  padding: 1.25rem 1.75rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.app-footer-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.sidebar-copyright {
  padding: 0.75rem 1rem;
  font-size: 0.725rem;
  color: var(--muted-foreground);
  text-align: center;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}
