/* ==========================================================================
   Interactive Resume Builder Studio
   Matches visual spec: Dark teal slate theme (#2d3748 / #1e293b / #10b981),
   sidebar categories, section form cards, rich formatting, tag pills,
   and instant export/apply to all 4+ resume templates.
   ========================================================================== */

.resume-builder-overlay {
  position: fixed;
  inset: 0;
  z-index: 10500;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.resume-builder-window {
  width: 96vw;
  max-width: 1280px;
  height: 90vh;
  max-height: 860px;
  background: #334155;
  color: #f1f5f9;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header bar */
.rb-topbar {
  height: 52px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
}

.rb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #f8fafc;
}

.rb-brand i {
  color: #10b981;
  font-size: 1.2rem;
}

.rb-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.rb-btn-primary {
  background: #10b981;
  color: #ffffff;
}
.rb-btn-primary:hover {
  background: #059669;
}

.rb-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.rb-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.rb-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}
.rb-close-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* Main workspace area */
.rb-container {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Left Sidebar */
.rb-sidebar {
  width: 230px;
  background: #1e293b;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 14px 10px;
}

.rb-sidebar-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
}

.rb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 0.84rem;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.rb-nav-item i {
  width: 18px;
  color: #94a3b8;
  font-size: 0.95rem;
}

.rb-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.rb-nav-item.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-weight: 600;
}

.rb-nav-item.active i {
  color: #10b981;
}

.rb-sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 10px 6px;
}

/* Right Content Area */
.rb-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #283344;
  overflow: hidden;
}

/* Ribbon Toolbar matching screenshot */
.rb-toolbar {
  height: 52px;
  background: #242f3d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

.rb-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rb-add-item-btn {
  background: transparent;
  border: 1.5px solid #10b981;
  color: #10b981;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.rb-add-item-btn:hover {
  background: #10b981;
  color: #ffffff;
}

.rb-toolbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

.rb-fmt-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.12s ease;
}
.rb-fmt-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.rb-fmt-btn.active {
  background: #10b981;
  color: #ffffff;
}

.rb-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rb-filter-box {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* Scrollable Form Body */
.rb-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* White Form Card matching screenshot */
.rb-card {
  background: #ffffff;
  color: #1e293b;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  border: 1.5px solid transparent;
  position: relative;
  transition: all 0.15s ease;
}

.rb-card:focus-within {
  border-color: #10b981;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
}

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

.rb-tag-btn {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rb-tag-btn:hover {
  border-color: #10b981;
  color: #10b981;
}

.rb-card-delete {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.88rem;
  padding: 4px 6px;
  border-radius: 4px;
}
.rb-card-delete:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* Input fields matching screenshot line style */
.rb-input-title {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid #10b981;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  padding: 4px 0 6px;
  outline: none;
  background: transparent;
  margin-bottom: 8px;
}
.rb-input-title::placeholder {
  color: #94a3b8;
}

.rb-input-org {
  width: 100%;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  padding: 4px 0 6px;
  outline: none;
  background: transparent;
  margin-bottom: 8px;
}
.rb-input-org::placeholder {
  color: #94a3b8;
}

.rb-input-desc {
  width: 100%;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.85rem;
  font-style: italic;
  color: #64748b;
  padding: 4px 0 6px;
  outline: none;
  background: transparent;
  margin-bottom: 12px;
}

.rb-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.rb-pill-input {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: #334155;
  outline: none;
  width: 110px;
  text-align: center;
}
.rb-pill-input:focus {
  border-color: #10b981;
  background: #ffffff;
}

.rb-city-input {
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.8rem;
  color: #475569;
  padding: 4px 6px;
  outline: none;
  background: transparent;
  min-width: 160px;
}

.rb-subheading {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin: 10px 0 4px 0;
}

.rb-textarea {
  width: 100%;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.85rem;
  color: #1e293b;
  padding: 6px 0;
  outline: none;
  background: transparent;
  resize: vertical;
  min-height: 64px;
  font-family: inherit;
  line-height: 1.45;
}
.rb-textarea::placeholder {
  color: #94a3b8;
}

.rb-contact-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.rb-contact-input {
  flex: 1;
  border: none;
  border-bottom: 1px dashed #cbd5e1;
  font-size: 0.8rem;
  color: #334155;
  padding: 4px 0;
  outline: none;
  background: transparent;
}

/* Template Picker Modal in Builder */
.rb-apply-modal {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}

.rb-apply-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  width: 90%;
  max-width: 780px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.rb-apply-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.rb-tmpl-item {
  background: #334155;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rb-tmpl-item:hover {
  border-color: #10b981;
  background: #3b4b61;
  transform: translateY(-2px);
}
.rb-tmpl-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.rb-tmpl-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #f8fafc;
}


/* Responsive Grid Classes for Form Cards */
.rb-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

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

/* Mobile Sidebar Toggle Button (Hidden on Desktop) */
.rb-btn-mobile-sidebar {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  margin-right: 6px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.rb-btn-mobile-sidebar:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Mobile Swipeable Navigation Tabs (Hidden on Desktop) */
.rb-mobile-tabs {
  display: none;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.rb-mobile-tabs::-webkit-scrollbar {
  display: none;
}

.rb-mob-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
}
.rb-mob-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}
.rb-mob-tab.active {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

/* Mobile Sidebar Backdrop */
.rb-sidebar-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.rb-sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* Mobile Responsive Media Queries */
@media (max-width: 768px) {
  .resume-builder-overlay {
    padding: 0 !important;
  }

  .resume-builder-window {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .rb-topbar {
    height: 48px !important;
    padding: 0 10px !important;
  }

  .rb-btn-mobile-sidebar {
    display: inline-flex !important;
  }

  .rb-brand {
    font-size: 0.92rem !important;
    gap: 6px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .rb-brand i.rb-brand-icon {
    font-size: 1.05rem !important;
  }

  .rb-topbar-actions {
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  .rb-btn {
    padding: 5px 9px !important;
    font-size: 0.78rem !important;
  }

  .rb-btn-text-full {
    display: none !important;
  }

  .rb-btn-text-short {
    display: inline !important;
  }

  .rb-close-btn {
    font-size: 1.25rem !important;
    padding: 2px 6px !important;
  }

  .rb-container {
    position: relative !important;
    overflow: hidden !important;
  }

  /* Drawer Sidebar on Mobile */
  .rb-sidebar {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 260px !important;
    max-width: 80vw !important;
    z-index: 160 !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.45) !important;
  }

  .rb-sidebar.open {
    transform: translateX(0) !important;
  }

  /* Show horizontal category tabs */
  .rb-mobile-tabs {
    display: flex !important;
  }

  /* Toolbar adjustments */
  .rb-toolbar {
    height: auto !important;
    min-height: 42px !important;
    padding: 6px 10px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    justify-content: flex-start !important;
    gap: 8px !important;
  }
  .rb-toolbar::-webkit-scrollbar {
    display: none !important;
  }

  .rb-toolbar-left {
    flex-shrink: 0 !important;
  }

  .rb-toolbar-right {
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  .rb-add-item-btn {
    padding: 4px 12px !important;
    font-size: 0.78rem !important;
  }

  /* Body & Cards */
  .rb-body {
    padding: 12px 10px 40px 10px !important;
    gap: 12px !important;
  }

  .rb-card {
    padding: 14px 12px !important;
    border-radius: 8px !important;
    width: auto !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .rb-grid-2,
  .rb-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .rb-input-title {
    font-size: 1.02rem !important;
  }

  .rb-input-org {
    font-size: 0.88rem !important;
  }

  .rb-date-row {
    gap: 6px !important;
  }

  .rb-pill-input {
    width: 85px !important;
    padding: 4px 6px !important;
    font-size: 0.74rem !important;
  }

  .rb-city-input {
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 1 100% !important;
    margin-top: 4px !important;
  }

  .rb-contact-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .rb-contact-row span {
    display: none !important;
  }

  /* Apply Template Modal Responsive */
  .rb-apply-card {
    width: 95% !important;
    max-width: 440px !important;
    padding: 16px !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
  }

  .rb-apply-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .rb-tmpl-item {
    padding: 10px 8px !important;
  }

  .rb-tmpl-icon {
    font-size: 1.5rem !important;
    margin-bottom: 4px !important;
  }

  .rb-tmpl-name {
    font-size: 0.8rem !important;
  }
}
