/* EMEKI Tresna - Custom Styles */
:root {
  --emeki-primary: #1976d2;
  --emeki-primary-dark: #115293;
  --emeki-primary-light: #e3f2fd;
  --emeki-secondary: #455a64;
  --emeki-success: #2e7d32;
  --emeki-danger: #d32f2f;
  --emeki-warning: #ed6c02;
  --emeki-sidebar-width: 260px;
  --emeki-topbar-height: 64px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f4f6f9;
  color: #2c3e50;
  min-height: 100vh;
}

/* Layout */
#wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

#sidebar {
  width: var(--emeki-sidebar-width);
  background: #1e293b;
  color: #f8fafc;
  flex-shrink: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

#sidebar .brand {
  height: var(--emeki-topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  background: #0f172a;
  color: #38bdf8;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#sidebar .nav-link {
  color: #94a3b8;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 0.375rem;
  margin: 0.2rem 0.75rem;
  transition: all 0.2s;
}

#sidebar .nav-link i {
  font-size: 1.2rem;
  margin-right: 0.85rem;
  width: 1.5rem;
  text-align: center;
}

#sidebar .nav-link:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.08);
}

#sidebar .nav-link.active {
  color: #ffffff;
  background-color: var(--emeki-primary);
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgba(25, 118, 210, 0.4);
}

#sidebar .section-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 700;
  padding: 1.25rem 1.5rem 0.5rem;
}

#content-wrapper {
  flex-grow: 1;
  margin-left: var(--emeki-sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: all 0.3s ease;
}

#topbar {
  height: var(--emeki-topbar-height);
  background: #ffffff;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.main-content {
  padding: 1.75rem 2rem;
  flex-grow: 1;
}

/* Cards & UI elements */
.card {
  border: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.08);
  border-radius: 0.5rem;
}

.card-header {
  background-color: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.stat-card {
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid var(--emeki-primary);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.08);
}

.badge-role-admin {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.badge-role-worker {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Tables */
.table thead th {
  background-color: #f8fafc;
  color: #475569;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
}

.table-hover tbody tr:hover {
  background-color: #f8fafc;
}

/* Tabs */
.nav-tabs .nav-link {
  color: #64748b;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1.25rem;
}

.nav-tabs .nav-link.active {
  color: var(--emeki-primary);
  border-bottom: 2px solid var(--emeki-primary);
  font-weight: 600;
  background: transparent;
}

/* Asistencia Matrix */
.attendance-cell {
  text-align: center;
  min-width: 90px;
  vertical-align: middle;
}

.attendance-btn-group .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* WYSIWYG Editor Container & Overflow Protection */
.card, .card-body {
  min-width: 0;
}

.wysiwyg-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.wysiwyg-container .ql-toolbar {
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.wysiwyg-container .ql-container {
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 140px;
  background: #ffffff;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.wysiwyg-container .ql-editor {
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  box-sizing: border-box;
}

/* Responsiveness */
@media (max-width: 991.98px) {
  #sidebar {
    margin-left: calc(-1 * var(--emeki-sidebar-width));
  }
  #sidebar.show {
    margin-left: 0;
  }
  #content-wrapper {
    margin-left: 0;
  }
}
