/* Material Design 3 Components & Layout Styles */

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8fafc;
  color: #1e293b;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* App Layout Grid */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* Sidebar / Navigation Drawer (MD3 Style) */
.sidebar {
  width: 280px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
  z-index: 100;
  transition: width 0.2s ease;
}

.sidebar-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #006494, #004b71);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0, 100, 148, 0.25);
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.menu-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.8px;
  margin: 16px 12px 6px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 100px; /* MD3 pill shape */
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.nav-item.active {
  background-color: #cbe6ff;
  color: #001e30;
  font-weight: 700;
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
}

.nav-badge {
  margin-left: auto;
  background-color: #ba1a1a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

/* User Profile Footer in Sidebar */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #fafafa;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #006494;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 12px;
  color: #64748b;
}

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

/* Top App Bar (MD3 Style) */
.top-app-bar {
  height: 64px;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.top-bar-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #f1f5f9;
  padding: 8px 16px;
  border-radius: 100px;
  width: 320px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.search-bar:focus-within {
  background-color: #ffffff;
  border-color: #006494;
  box-shadow: 0 0 0 3px rgba(0, 100, 148, 0.15);
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: #0f172a;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
  position: relative;
}

.icon-button:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.icon-button .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: #ba1a1a;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

/* Page Container (Scrollable) */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

/* MD3 Cards & Grid */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background-color: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-elevated {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border: none;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-value {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 6px;
}

.card-subtext {
  font-size: 13px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up {
  color: #16a34a;
  font-weight: 600;
}

.trend-down {
  color: #dc2626;
  font-weight: 600;
}

/* Status Chips (MD3) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.chip-success {
  background-color: #dcfce7;
  color: #15803d;
}

.chip-warning {
  background-color: #fef9c3;
  color: #a16207;
}

.chip-error {
  background-color: #fee2e2;
  color: #b91c1c;
}

.chip-info {
  background-color: #e0f2fe;
  color: #0369a1;
}

/* Data Table (MD3 Styled) */
.data-table-container {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 24px;
}

.table-header-title {
  padding: 20px 24px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background-color: #f8fafc;
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
}

td {
  padding: 16px 24px;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

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

tr:hover td {
  background-color: #f8fafc;
}

/* MD3 Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: #006494;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #004b71;
  box-shadow: 0 4px 12px rgba(0, 100, 148, 0.3);
}

.btn-secondary {
  background-color: #cbe6ff;
  color: #001e30;
}

.btn-secondary:hover {
  background-color: #b0d8ff;
}

.btn-outlined {
  background-color: transparent;
  border: 1px solid #72777e;
  color: #006494;
}

.btn-outlined:hover {
  background-color: #f1f5f9;
}

/* Live Activity Stream */
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}

.feed-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feed-time {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

.feed-text {
  font-size: 14px;
  color: #1e293b;
  line-height: 1.4;
}

/* Form Builder Controls */
.form-section-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.question-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  position: relative;
}

/* Utility View Hiding */
.view-pane {
  display: none;
}

.view-pane.active {
  display: block;
}

/* Modal UI Components (MD3) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-container {
  background-color: #ffffff;
  width: 90%;
  max-width: 500px;
  border-radius: 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  background-color: #fafafa;
}

/* MD3 Inputs */
.md-input-container {
  margin-bottom: 16px;
}

.md-input-container label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 6px;
}

.md-input, .md-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background-color: #f8fafc;
  transition: all 0.2s ease;
}

.md-input:focus, .md-select:focus {
  outline: none;
  border-color: #006494;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 100, 148, 0.1);
}

.md-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
}

.md-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #006494;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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