/* ==========================================================================
   DYNAMIC CONTENT MANAGEMENT SYSTEM (CMS STUDIO) STYLES
   ========================================================================== */

/* Floating CMS Trigger Button in Header & Hero */
.cms-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 50px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-blue), #6366f1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 10;
}

.cms-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.cms-launch-btn svg {
  width: 17px;
  height: 17px;
  animation: rotateGear 12s linear infinite;
}

@keyframes rotateGear {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Master CMS Modal Overlay */
.cms-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cms-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cms-container {
  width: 95%;
  max-width: 1240px;
  height: 90vh;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cmsSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cmsSlideUp {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* CMS Header */
.cms-header {
  padding: 1.2rem 1.8rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cms-title-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.cms-title-group h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cms-title-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: rgba(14, 165, 233, 0.15);
  color: var(--brand-cyan);
  border: 1px solid rgba(14, 165, 233, 0.3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cms-header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* CMS Main Layout (Sidebar Tabs + Content Workspace) */
.cms-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.cms-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 1rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.cms-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.cms-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.cms-tab-btn.active {
  background: var(--brand-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.cms-tab-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Workspace Panels */
.cms-content-workspace {
  flex: 1;
  padding: 1.8rem;
  overflow-y: auto;
  background: var(--bg-card);
}

.cms-panel {
  display: none;
}

.cms-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

.cms-panel-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.cms-panel-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Form controls inside CMS */
.cms-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.cms-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cms-form-group.full-width {
  grid-column: 1 / -1;
}

.cms-label {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cms-input, .cms-select, .cms-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.92rem;
  transition: border-color 0.2s ease;
}

.cms-input:focus, .cms-select:focus, .cms-textarea:focus {
  outline: none;
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.cms-textarea {
  min-height: 110px;
  resize: vertical;
}

/* Drag & Drop Image Uploader Dropzone */
.image-uploader-box {
  border: 2px dashed var(--border-color);
  border-radius: 14px;
  padding: 1.2rem;
  text-align: center;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.image-uploader-box:hover, .image-uploader-box.dragover {
  border-color: var(--brand-cyan);
  background: rgba(14, 165, 233, 0.05);
}

.image-preview-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.8rem;
}

.image-preview-thumb {
  width: 90px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.image-preview-thumb.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

/* Section Active / Disable Toggle Cards */
.toggle-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.toggle-card {
  padding: 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.toggle-card:hover {
  border-color: var(--brand-cyan);
}

.toggle-card-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.toggle-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* iOS-style Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #64748b;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: #10b981;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Profession Preset Cards */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
}

.preset-card {
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.preset-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-cyan);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
}

.preset-card.active-preset {
  border: 2px solid var(--brand-cyan);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
}

.preset-card-cover {
  height: 90px;
  width: 100%;
  object-fit: cover;
}

.preset-card-content {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preset-card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-cyan);
}

.preset-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.preset-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Items Management List (Videos, Projects, Articles, etc.) */
.cms-items-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cms-item-card {
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cms-item-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cms-item-thumb {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.cms-item-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.cms-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cms-item-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Active / Disabled Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-pill.active-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.disabled-pill {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* CMS Footer Action Bar */
.cms-footer {
  padding: 1.1rem 1.8rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Responsive adjust */
@media (max-width: 868px) {
  .cms-body {
    flex-direction: column;
  }
  .cms-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .cms-tab-btn {
    white-space: nowrap;
  }
}

/* ==========================================================================
   SECURE CMS AUTHENTICATION MODAL STYLES
   ========================================================================== */
.cms-auth-card {
  width: 90%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  animation: authScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

@keyframes authScaleIn {
  from { opacity: 0; transform: scale(0.92) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.cms-auth-card.shake {
  animation: authShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes authShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

.cms-auth-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.cms-auth-icon-badge {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.2rem auto;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-blue);
}

.cms-auth-icon-badge svg {
  width: 30px;
  height: 30px;
}

.cms-auth-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.cms-auth-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.cms-auth-error-msg {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
}

/* ==========================================================================
   INLINE EDIT PANELS (expand inside item cards)
   ========================================================================== */

.cms-inline-edit {
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.75rem;
  padding-top: 0.9rem;
  animation: fadeInEdit 0.2s ease;
}

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

.cms-inline-edit .cms-form-grid {
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.cms-inline-edit .cms-form-group.full-width {
  grid-column: 1 / -1;
}

/* Color picker row */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.color-picker-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px 3px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  cursor: pointer;
  flex-shrink: 0;
}

/* Select inside cms inline edit */
.cms-inline-edit select.cms-input,
select.cms-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

/* Theme color preview swatches */
.theme-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.theme-color-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.theme-color-item .cms-label {
  font-size: 0.78rem;
}

.theme-color-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-color-input-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px 3px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-color-input-row input[type="text"] {
  flex: 1;
}

/* Skill add form at top of skills panel */
.cms-add-skill-form {
  background: var(--bg-glass);
  border: 1px dashed var(--border-medium);
  border-radius: var(--border-radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: none;
}

.cms-add-skill-form.open {
  display: block;
  animation: fadeInEdit 0.2s ease;
}

/* Enhanced cms-item-card actions wrapping on smaller screens */
.cms-item-actions {
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Ensure inline edit textareas readable */
.cms-inline-edit .cms-textarea {
  min-height: 80px;
  resize: vertical;
}

