/* ==========================================================================
   CIS MASTER WORKSPACE — UI COMPONENTS & CONTROLS
   Entitas: PT Cahaya Intan Semesta Holding
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOP NAVIGATION BAR
   -------------------------------------------------------------------------- */
.workspace-header {
  height: var(--header-height);
  background: rgba(14, 27, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
}

/* Site Switcher Trigger & Dropdown */
.site-switcher-container {
  position: relative;
}

.site-switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-card);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 8px 16px;
  color: var(--text-white);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13.5px;
  font-weight: 600;
}

.site-switcher-btn:hover {
  border-color: var(--gold-primary);
  background: var(--surface-hover);
}

.site-switcher-emblem {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--gold-dim);
  color: var(--gold-primary);
  border: 1px solid var(--gold-primary);
}

.site-switcher-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.site-switcher-container.open .site-switcher-arrow {
  transform: rotate(180deg);
}

.site-switcher-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 290px;
  background: var(--surface-card);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
  animation: fadeInDown 0.2s ease-out forwards;
}

.site-switcher-container.open .site-switcher-dropdown {
  display: flex;
}

.dropdown-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  letter-spacing: 0.5px;
}

.site-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
}

.site-option:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.site-option.active {
  background: var(--gold-dim);
  border-color: var(--gold-primary);
}

.site-option-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.site-option.active .site-option-icon {
  background: var(--gold-primary);
  color: var(--bg-dark);
  border-color: var(--gold-primary);
}

.site-option-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.site-option-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-option-domain {
  font-size: 11px;
  color: var(--text-muted);
}

/* Edge Status Pill */
.edge-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--emerald-primary);
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald-primary);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* User Account Profile Pill */
.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary), #9a7b20);
  color: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

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

.user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
}

.user-role-tag {
  font-size: 10px;
  color: var(--gold-primary);
  font-weight: 700;
  text-transform: uppercase;
}

.btn-header-logout {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-header-logout:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: var(--rose-primary);
  color: var(--rose-primary);
}

/* --------------------------------------------------------------------------
   2. SIDEBAR NAVIGATION
   -------------------------------------------------------------------------- */
.workspace-sidebar {
  width: var(--sidebar-width);
  background: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 30;
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.holding-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #172a45 0%, #0a192f 100%);
  border: 1.5px solid var(--gold-primary);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 12px -2px rgba(212, 175, 55, 0.3);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title-main {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: 0.5px;
}

.brand-title-sub {
  font-size: 10px;
  color: var(--gold-primary);
  font-weight: 700;
  letter-spacing: 1px;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text-white);
}

.nav-item.active {
  background: var(--gold-dim);
  border-color: var(--border-gold);
  color: var(--gold-primary);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.nav-item.active .nav-badge {
  background: var(--gold-primary);
  color: var(--bg-dark);
  border-color: var(--gold-primary);
}

/* --------------------------------------------------------------------------
   3. STAT CARDS & METRIC GRID
   -------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-subtext {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   4. ACTIVE SITE BANNER
   -------------------------------------------------------------------------- */
.site-context-banner {
  background: linear-gradient(135deg, rgba(14, 27, 46, 0.95) 0%, rgba(21, 38, 63, 0.95) 100%);
  border: 1.5px solid var(--border-gold);
  border-radius: 16px;
  padding: 22px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.site-context-banner::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 250px;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.context-info-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.context-emblem-large {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--bg-dark);
  border: 2px solid var(--gold-primary);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow-gold);
}

.context-meta-block h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-white);
  margin-bottom: 4px;
}

.context-meta-block p {
  font-size: 13px;
  color: var(--text-secondary);
}

.context-tech-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tech-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   5. DATA TABLES & AUDIT TRAIL VIEW
   -------------------------------------------------------------------------- */
.data-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.data-panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.panel-title-group h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-white);
}

.panel-title-group p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.data-table-container {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background: var(--bg-subtle);
  padding: 12px 20px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.action-pill-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-pill-btn:hover {
  background: var(--surface-hover);
  color: var(--gold-primary);
  border-color: var(--gold-primary);
}

/* Sub-Tabs for Corporate & Custom Modules */
.sub-tab-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  background: var(--bg-subtle);
}

.corp-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.corp-tab-btn:hover {
  color: var(--text-white);
}

.corp-tab-btn.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
}

/* --------------------------------------------------------------------------
   6. MODAL DIALOGS & FORM CONTROLS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 13, 25, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeInDown 0.2s ease-out;
}

.modal-card {
  background: var(--surface-card);
  border: 1.5px solid var(--border-strong);
  border-radius: 18px;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-elevated);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-white);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-white);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-elevated);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.workspace-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.workspace-input, .workspace-select, .workspace-textarea {
  width: 100%;
  background: #091322;
  border: 1.5px solid #1c2b42;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-white);
  outline: none;
  transition: border-color var(--transition-fast);
}

.workspace-input:focus, .workspace-select:focus, .workspace-textarea:focus {
  border-color: var(--gold-primary);
  background: #0d1a2d;
}

.workspace-textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

.btn-primary-gold {
  background: linear-gradient(135deg, var(--gold-primary) 0%, #b8972b 100%);
  color: #070d19;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary-gold:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text-white);
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background: var(--surface-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 18px;
  color: var(--text-white);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideInRight 0.25s ease-out;
}

.toast.toast-success { border-color: var(--emerald-primary); }
.toast.toast-error { border-color: var(--rose-primary); }
.toast.toast-info { border-color: var(--sky-primary); }

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

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