/* ===== LAYOUT STYLES ===== */

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1B2559 0%, #111C44 50%, #0B1437 100%);
  z-index: 9999;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  width: 420px;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.4s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo svg,
.login-brand-logo {
  width: 60px;
  height: 60px;
  margin-bottom: var(--space-4);
  object-fit: contain;
}

.login-logo h1 {
  font-size: var(--font-size-2xl);
  color: var(--primary);
}

.login-logo p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.login-form .form-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.login-form .form-group input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast);
}

.login-form .form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67, 24, 255, 0.1);
}

.login-error {
  color: var(--danger);
  font-size: var(--font-size-sm);
  text-align: center;
  min-height: 20px;
}

/* App Shell */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

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

.sidebar-brand-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.sidebar-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.sidebar-brand-text h2 {
  color: var(--text-white);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.sidebar-brand-text span {
  color: rgba(255,255,255,0.5);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
}

.sidebar-menu-label {
  padding: var(--space-5) var(--space-5) var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.sidebar-menu {
  padding: var(--space-2) var(--space-3);
  flex: 1;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.65);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-white);
}

.sidebar-menu-item.active {
  background: var(--accent);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(67, 24, 255, 0.4);
}

.sidebar-menu-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-menu-item.active svg {
  opacity: 1;
}

.sidebar-menu-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.65);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-footer-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-white);
}

.sidebar-footer-item svg {
  width: 18px;
  height: 18px;
}

.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.toggle-switch {
  width: 40px;
  height: 22px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle-switch::after {
  content: '';
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform var(--transition-fast);
}

.toggle-switch.active {
  background: var(--accent);
}

.toggle-switch.active::after {
  transform: translateX(18px);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: var(--z-header);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-greeting {
  display: flex;
  flex-direction: column;
}

.header-date {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.header-welcome {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-dark);
}

.header-search {
  position: relative;
  width: 350px;
}

.header-search input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
}

.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67, 24, 255, 0.1);
  background: var(--bg-secondary);
}

.header-search input::placeholder {
  color: var(--text-secondary);
}

.header-search svg {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-notification {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-notification:hover {
  background: var(--border);
}

.header-notification svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.header-notification .notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.header-user:hover {
  background: var(--bg-hover);
}

.header-user-avatar {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
}

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

.header-user-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.header-user-role {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* Page Content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  animation: fadeIn var(--transition-base);
}

/* Page Header (used in many pages) */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.page-header h2 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Stat Cards Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  animation: fadeInUp 0.3s ease both;
}

.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon svg {
  width: 24px;
  height: 24px;
}

.stat-card-icon.blue { background: var(--stat-blue); color: var(--stat-blue-icon); }
.stat-card-icon.green { background: var(--stat-green); color: var(--stat-green-icon); }
.stat-card-icon.purple { background: var(--stat-purple); color: var(--stat-purple-icon); }
.stat-card-icon.coral { background: var(--stat-coral); color: var(--stat-coral-icon); }

.stat-card-info {
  display: flex;
  flex-direction: column;
}

.stat-card-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.stat-card-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-dark);
  margin-top: 2px;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

/* Content Card (used in many pages) */
.content-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.content-card-header h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.content-card-body {
  padding: var(--space-5) var(--space-6);
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--space-10) auto;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state h4 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 320px;
}
