/**
 * RankCrackers Next — Universal Component Styling
 * Responsive across 360px, 390px, 768px, 1024px, 1440px
 */

/* ==========================================================================
   Buttons
   ========================================================================== */

.rc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rc-space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--rc-text-sm);
  font-weight: 600;
  border-radius: var(--rc-radius-md);
  border: 1px solid transparent;
  transition: all var(--rc-transition-fast);
  white-space: nowrap;
  user-select: none;
}

.rc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.rc-btn-primary {
  background: var(--rc-gold-gradient);
  color: #111111;
  border-color: #b3883b;
  box-shadow: var(--rc-shadow-sm);
}

.rc-btn-primary:hover:not(:disabled) {
  background: var(--rc-gold-gradient-hover);
  box-shadow: var(--rc-shadow-gold);
  transform: translateY(-1px);
}

.rc-btn-secondary {
  background: var(--rc-surface-card);
  color: var(--rc-gold-deep);
  border-color: var(--rc-gold-accent);
}

.rc-btn-secondary:hover:not(:disabled) {
  background: var(--rc-gold-subtle);
  border-color: var(--rc-gold-deep);
}

.rc-btn-ghost {
  background: transparent;
  color: var(--rc-text-secondary);
}

.rc-btn-ghost:hover:not(:disabled) {
  background: var(--rc-surface-muted);
  color: var(--rc-text-primary);
}

.rc-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--rc-text-xs);
  border-radius: var(--rc-radius-sm);
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.rc-card {
  background: var(--rc-surface-card);
  border: 1px solid var(--rc-border-subtle);
  border-radius: var(--rc-radius-lg);
  padding: var(--rc-space-6);
  box-shadow: var(--rc-shadow-sm);
  transition: border-color var(--rc-transition-fast);
}

.rc-card-interactive {
  cursor: pointer;
}

.rc-card-interactive:hover {
  border-color: var(--rc-gold-accent);
  box-shadow: var(--rc-shadow-md);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

.rc-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--rc-space-1);
  margin-bottom: var(--rc-space-4);
}

.rc-label {
  font-size: var(--rc-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rc-text-secondary);
}

.rc-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--rc-text-sm);
  background: var(--rc-surface-card);
  border: 1px solid var(--rc-border-subtle);
  border-radius: var(--rc-radius-md);
  color: var(--rc-text-primary);
  transition: border-color var(--rc-transition-fast), box-shadow var(--rc-transition-fast);
}

.rc-input:focus {
  outline: none;
  border-color: var(--rc-gold-accent);
  box-shadow: 0 0 0 3px var(--rc-gold-subtle);
}

.rc-input::placeholder {
  color: var(--rc-text-muted);
}

/* ==========================================================================
   Status Indicators & Badges
   ========================================================================== */

.rc-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--rc-space-1);
  padding: 0.25rem 0.625rem;
  font-size: var(--rc-text-xs);
  font-weight: 600;
  border-radius: var(--rc-radius-pill);
  line-height: 1;
}

.rc-badge-live {
  background: var(--rc-status-live-bg);
  color: var(--rc-status-live);
  border: 1px solid rgba(27, 94, 32, 0.2);
}

.rc-badge-held {
  background: var(--rc-status-held-bg);
  color: var(--rc-status-held);
  border: 1px solid rgba(230, 81, 0, 0.2);
}

.rc-badge-disconnected {
  background: var(--rc-status-disconnected-bg);
  color: var(--rc-status-disconnected);
  border: 1px solid rgba(97, 97, 97, 0.2);
}

.rc-badge-role {
  background: var(--rc-gold-subtle);
  color: var(--rc-gold-deep);
  border: 1px solid var(--rc-gold-border);
}

/* ==========================================================================
   Navigation Bar & Brand Header
   ========================================================================== */

.rc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--rc-surface-card);
  border-bottom: 1px solid var(--rc-border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.rc-brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--rc-space-3);
}

.rc-brand-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  box-shadow: var(--rc-shadow-sm);
}

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

.rc-brand-name {
  font-size: var(--rc-text-lg);
  font-weight: 700;
  color: var(--rc-text-primary);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.rc-brand-taglines {
  display: flex;
  align-items: center;
  gap: var(--rc-space-2);
  font-size: var(--rc-text-xs);
  color: var(--rc-text-secondary);
}

.rc-tagline-sa {
  font-weight: 500;
  color: var(--rc-gold-deep);
}

.rc-tagline-en {
  color: var(--rc-text-muted);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.rc-toast {
  position: fixed;
  bottom: var(--rc-space-6);
  right: var(--rc-space-6);
  padding: 0.875rem 1.5rem;
  background: #111111;
  color: #ffffff;
  font-size: var(--rc-text-sm);
  font-weight: 500;
  border-radius: var(--rc-radius-md);
  box-shadow: var(--rc-shadow-lg);
  z-index: 100;
  border-left: 4px solid var(--rc-gold-accent);
  transition: opacity var(--rc-transition-normal), transform var(--rc-transition-normal);
}

.rc-toast.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

/* ==========================================================================
   Responsive Shell Layout
   ========================================================================== */

.rc-shell {
  display: flex;
  min-height: calc(100vh - 65px);
}

.rc-sidebar {
  width: 260px;
  background: var(--rc-surface-card);
  border-right: 1px solid var(--rc-border-subtle);
  padding: var(--rc-space-4);
  flex-shrink: 0;
}

.rc-main-content {
  flex: 1;
  padding: var(--rc-space-8);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 768px) {
  .rc-shell {
    flex-direction: column;
  }
  .rc-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--rc-border-subtle);
  }
  .rc-main-content {
    padding: var(--rc-space-4);
  }
}

/* ==========================================================================
   Startup Screen Overlay (Light Canvas Constitution)
   ========================================================================== */

.rc-startup-overlay {
  position: fixed;
  inset: 0;
  background: var(--rc-canvas-bg, #fcfbf8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rc-startup-fade-out {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.rc-startup-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--rc-space-3);
  max-width: 380px;
  padding: var(--rc-space-6);
}

.rc-startup-logo img {
  width: 96px;
  height: 96px;
  border-radius: var(--rc-radius-lg, 16px);
  box-shadow: 0 8px 32px rgba(184, 156, 86, 0.25);
  background: var(--rc-gold-gradient);
}

.rc-startup-title {
  font-size: var(--rc-text-2xl, 1.75rem);
  font-weight: 700;
  color: var(--rc-text-primary, #1a1a1a);
  letter-spacing: -0.02em;
  margin: 0;
}

.rc-startup-taglines {
  display: flex;
  align-items: center;
  gap: var(--rc-space-2);
  font-size: var(--rc-text-xs, 0.75rem);
  color: var(--rc-text-secondary, #5c5c5c);
}

.rc-startup-taglines .rc-tagline-sa {
  font-weight: 600;
  color: var(--rc-gold-deep, #7d6124);
}

.rc-startup-progress-bar {
  width: 160px;
  height: 3px;
  background: var(--rc-border-subtle, #e6e4dc);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: var(--rc-space-2);
}

.rc-startup-progress-fill {
  width: 100%;
  height: 100%;
  background: var(--rc-gold-gradient);
  animation: rc-startup-pulse 1s infinite alternate;
}

@keyframes rc-startup-pulse {
  0% { transform: translateX(-50%); opacity: 0.6; }
  100% { transform: translateX(50%); opacity: 1; }
}

/* ==========================================================================
   Auth / Login Layout (Light Canvas Constitution)
   ========================================================================== */

.rc-auth-container {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--rc-space-6);
  background: radial-gradient(circle at top, rgba(184, 156, 86, 0.08) 0%, transparent 70%);
}

.rc-login-card {
  width: 100%;
  max-width: 440px;
  background: var(--rc-surface-card, #ffffff);
  border: 1px solid var(--rc-border-subtle, #e6e4dc);
  border-radius: var(--rc-radius-xl, 20px);
  padding: var(--rc-space-8);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.rc-login-header {
  text-align: center;
  margin-bottom: var(--rc-space-6);
}

.rc-login-header .brand-mark {
  margin-bottom: var(--rc-space-3);
  display: inline-block;
}

.rc-login-header .brand-mark img {
  border-radius: var(--rc-radius-md, 12px);
  box-shadow: 0 4px 16px rgba(184, 156, 86, 0.2);
}

.rc-login-title {
  font-size: var(--rc-text-xl, 1.25rem);
  font-weight: 700;
  color: var(--rc-text-primary, #1a1a1a);
  margin: 0 0 var(--rc-space-1) 0;
}

.rc-login-subtitle {
  font-size: var(--rc-text-xs, 0.75rem);
  color: var(--rc-text-secondary, #5c5c5c);
  margin: 0;
}

.rc-alert {
  padding: var(--rc-space-3) var(--rc-space-4);
  border-radius: var(--rc-radius-md, 8px);
  font-size: var(--rc-text-xs, 0.75rem);
  font-weight: 500;
  margin-bottom: var(--rc-space-4);
  display: flex;
  align-items: center;
  gap: var(--rc-space-2);
}

.rc-alert-error {
  background: var(--rc-status-error-bg, #ffebee);
  border: 1px solid rgba(183, 28, 28, 0.2);
  color: var(--rc-status-error, #b71c1c);
}

.rc-alert-info {
  background: #e3f2fd;
  border: 1px solid rgba(25, 118, 210, 0.2);
  color: #0d47a1;
}

/* ==========================================================================
   OS Navigation & Founder Workspace (Light Canvas Constitution)
   ========================================================================== */

.rc-os-list {
  display: flex;
  flex-direction: column;
  gap: var(--rc-space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}

.rc-os-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--rc-radius-md, 8px);
  font-size: var(--rc-text-xs, 0.75rem);
  font-weight: 500;
  color: var(--rc-text-secondary, #5c5c5c);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--rc-transition-fast, 0.15s ease);
}

.rc-os-item:hover {
  background: var(--rc-surface-muted, #f6f5f0);
  color: var(--rc-text-primary, #1a1a1a);
}

.rc-os-item.active {
  background: var(--rc-gold-subtle, rgba(184, 156, 86, 0.12));
  color: var(--rc-gold-deep, #7d6124);
  border-color: var(--rc-gold-border, #d4bc78);
  font-weight: 600;
}

.rc-os-views-subnav {
  display: flex;
  gap: var(--rc-space-2);
  border-bottom: 1px solid var(--rc-border-subtle, #e6e4dc);
  padding-bottom: var(--rc-space-3);
  margin-bottom: var(--rc-space-6);
  overflow-x: auto;
}

.rc-os-view-tab {
  padding: 0.375rem 0.875rem;
  font-size: var(--rc-text-xs, 0.75rem);
  font-weight: 600;
  border-radius: var(--rc-radius-pill, 9999px);
  background: var(--rc-surface-muted, #f6f5f0);
  color: var(--rc-text-secondary, #5c5c5c);
  border: 1px solid var(--rc-border-subtle, #e6e4dc);
  cursor: pointer;
  white-space: nowrap;
}

.rc-os-view-tab.active {
  background: var(--rc-gold-gradient);
  color: #111111;
  border-color: #b3883b;
  font-weight: 700;
}

.rc-telemetry-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--rc-space-3);
  padding: var(--rc-space-2) var(--rc-space-4);
  background: var(--rc-surface-card, #ffffff);
  border: 1px solid var(--rc-border-subtle, #e6e4dc);
  border-radius: var(--rc-radius-md, 8px);
  font-size: var(--rc-text-xs, 0.75rem);
  margin-bottom: var(--rc-space-6);
  box-shadow: var(--rc-shadow-sm);
}

.rc-telemetry-metric {
  display: flex;
  align-items: center;
  gap: var(--rc-space-2);
}

.rc-telemetry-label {
  color: var(--rc-text-muted, #85837d);
}

.rc-telemetry-val {
  color: var(--rc-text-primary, #1a1a1a);
  font-weight: 600;
  font-family: var(--rc-font-mono);
}

.rc-preview-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--rc-space-2) var(--rc-space-4);
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-left: 4px solid var(--rc-gold-accent, #b89c56);
  margin-bottom: var(--rc-space-4);
  border-radius: var(--rc-radius-sm, 4px);
  font-size: var(--rc-text-xs, 0.75rem);
  color: #5d4037;
}

/* ==========================================================================
   Student Navigation & Realm (Light Canvas Constitution)
   ========================================================================== */

.rc-student-subnav {
  display: flex;
  gap: var(--rc-space-2);
  border-bottom: 1px solid var(--rc-border-subtle, #e6e4dc);
  padding-bottom: var(--rc-space-3);
  margin-bottom: var(--rc-space-6);
}

.rc-student-tab {
  padding: 0.5rem 1rem;
  font-size: var(--rc-text-sm, 0.875rem);
  font-weight: 600;
  border-radius: var(--rc-radius-md, 8px);
  background: transparent;
  color: var(--rc-text-secondary, #5c5c5c);
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--rc-space-2);
}

.rc-student-tab:hover {
  background: var(--rc-surface-muted, #f6f5f0);
  color: var(--rc-text-primary, #1a1a1a);
}

.rc-student-tab.active {
  background: var(--rc-surface-card, #ffffff);
  color: var(--rc-gold-deep, #7d6124);
  border-color: var(--rc-gold-border, #d4bc78);
  box-shadow: var(--rc-shadow-sm);
}

.rc-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--rc-space-6);
}

.rc-grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--rc-space-4);
}
