/*
 * Copyright (c) 2024 Biovisuals Private Limited. All rights reserved.
 */

/* ── Backdrop ── */
.sf-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 110000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sf-fade-in 0.18s ease;
}

@keyframes sf-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes sf-fade-out { from { opacity: 1; } to { opacity: 0; } }

/* ── Panel ── */
.sf-panel {
  width: 540px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  background: #fff;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.07),
    0 8px 16px -4px rgba(0,0,0,0.1),
    0 24px 48px -8px rgba(0,0,0,0.16),
    0 48px 80px -16px rgba(0,0,0,0.1);
  animation: sf-panel-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sf-panel-in {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
@keyframes sf-panel-out {
  from { opacity: 1; transform: scale(1)    translateY(0); }
  to   { opacity: 0; transform: scale(0.96) translateY(8px); }
}

/* ── Header — rich branded top ── */
.sf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 20px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #fff8ee 0%, #fff3e0 60%, #fff 100%);
  border-bottom: 1px solid #ffe8c8;
  position: relative;
  overflow: hidden;
}

/* decorative circle in top-right */
.sf-header::after {
  content: '';
  position: absolute;
  top: -28px;
  right: -28px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,154,0,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.sf-header-left {
  display: flex;
  align-items: center;
  gap: 13px;
  position: relative;
  z-index: 1;
}

.sf-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff9a00 0%, #ff6a00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow:
    0 4px 12px rgba(255, 106, 0, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

.sf-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sf-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sf-header-sub {
  font-size: 13px;
  color: #b07030;
  line-height: 1.2;
  font-weight: 400;
}

.sf-close {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(0,0,0,0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #888;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.sf-close:hover { background: rgba(0,0,0,0.1); color: #222; }

/* ── Tabs — proper segmented control ── */
.sf-tabs {
  display: flex;
  padding: 14px 22px 0;
  flex-shrink: 0;
  background: #fff;
  gap: 0;
  border-bottom: 1px solid #f0f0f0;
}

.sf-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.sf-tab i { font-size: 13px; }
.sf-tab:hover { color: #555; }
.sf-tab.active {
  color: #ff6a00;
  border-bottom-color: #ff6a00;
  font-weight: 600;
}

/* ── Body ── */
.sf-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  background: #fafafa;
  scrollbar-width: thin;
  scrollbar-color: #e8e8e8 transparent;
}
.sf-body::-webkit-scrollbar { width: 4px; }
.sf-body::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }

/* ── Form ── */
.sf-row { display: flex; gap: 12px; }
.sf-field { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.sf-label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sf-optional {
  font-weight: 400;
  color: #bbb;
  font-size: 12px;
}

/* ── Select wrapper ── */
.sf-select-wrap { position: relative; }
.sf-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #bbb;
  pointer-events: none;
}

/* ── Inputs — white cards on grey body ── */
.sf-select,
.sf-input,
.sf-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 13px;
  border: 1.5px solid #e4e4e4;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.sf-select { padding-right: 32px; }

.sf-select:hover,
.sf-input:hover,
.sf-textarea:hover {
  border-color: #ccc;
}
.sf-select:focus,
.sf-input:focus,
.sf-textarea:focus {
  border-color: #ff9a00;
  box-shadow: 0 0 0 3px rgba(255, 154, 0, 0.13);
}

.sf-textarea {
  resize: vertical;
  min-height: 100px;
  max-height: 180px;
  line-height: 1.6;
}

.sf-char-count {
  font-size: 12px;
  color: #bbb;
  text-align: right;
  margin-top: -3px;
}
.sf-char-count.sf-over { color: #e53e3e; }

.sf-hint {
  font-size: 12px;
  color: #bbb;
  margin-top: -3px;
}

/* ── Dropzone ── */
.sf-dropzone {
  border: 1.5px dashed #ddd;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.sf-dropzone:hover,
.sf-dropzone.drag-over {
  border-color: #ff9a00;
  background: #fffbf5;
  box-shadow: 0 0 0 3px rgba(255, 154, 0, 0.1);
}
.sf-dropzone.has-file {
  border-color: #38a169;
  border-style: solid;
  background: #f6fffa;
}

.sf-dropzone-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #bbb;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sf-dropzone:hover .sf-dropzone-icon,
.sf-dropzone.drag-over .sf-dropzone-icon { background: #fff0d6; color: #ff9a00; }
.sf-dropzone.has-file .sf-dropzone-icon  { background: #d4f5e2; color: #38a169; }

.sf-dropzone-text { flex: 1; min-width: 0; }
.sf-dropzone-text strong {
  display: block;
  font-size: 14px;
  color: #222;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sf-dropzone-text span { font-size: 12.5px; color: #aaa; }

.sf-dropzone-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #bbb;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.sf-dropzone-remove:hover { background: #fee2e2; color: #e53e3e; }

/* ── Error banner ── */
.sf-error-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  background: #fff5f5;
  border: 1.5px solid #fecaca;
  border-radius: 9px;
  font-size: 13.5px;
  color: #c53030;
  animation: sf-shake 0.32s ease;
}
@keyframes sf-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

/* ── Footer ── */
.sf-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid #efefef;
  flex-shrink: 0;
  background: #fff;
}

.sf-btn-cancel {
  padding: 9px 20px;
  border: 1.5px solid #e4e4e4;
  border-radius: 9px;
  background: #fff;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.sf-btn-cancel:hover { background: #f5f5f5; border-color: #ccc; color: #333; }

.sf-btn-submit {
  padding: 10px 24px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff9a00 0%, #ff6200 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 3px 10px rgba(255, 98, 0, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.01em;
}
.sf-btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 98, 0, 0.46);
}
.sf-btn-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 98, 0, 0.3);
}
.sf-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Success ── */
.sf-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 32px;
  text-align: center;
  gap: 14px;
  background: #fafafa;
  animation: sf-success-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sf-success-in {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.sf-success-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c6f6d5 0%, #68d391 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 10px rgba(104, 211, 145, 0.15);
  animation: sf-ring-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
@keyframes sf-ring-pop {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.sf-success-icon { font-size: 28px; color: #22543d; }

.sf-success-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
}

.sf-success-body {
  font-size: 14px;
  color: #777;
  line-height: 1.7;
  max-width: 300px;
}

.sf-success-body code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  background: #f0f0f0;
  border: 1px solid #e4e4e4;
  padding: 2px 8px;
  border-radius: 5px;
  color: #333;
}

/* ── Shortcuts Panel ── */
.sf-sc-panel { width: 460px; }

.sf-sc-body {
  padding: 6px 22px 22px;
  gap: 0;
}

.sf-sc-group {
  font-size: 11px;
  font-weight: 700;
  color: #bbb;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 16px 0 7px;
  border-bottom: 1px solid #efefef;
  margin-bottom: 2px;
}
.sf-sc-group:first-child { padding-top: 8px; }

.sf-sc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f7f7f7;
}
.sf-sc-row:last-child { border-bottom: none; }

.sf-sc-label { font-size: 14px; color: #333; font-weight: 400; }

.sf-sc-keys { display: flex; align-items: center; gap: 4px; }
.sf-sc-sep  { font-size: 11px; color: #ccc; }

kbd {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-bottom: 2px solid #ccc;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: #444;
  white-space: nowrap;
  line-height: 1.4;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

/* ── About Panel ── */
.sf-about-panel { width: 460px; }

.sf-about-body {
  padding: 0 22px 24px;
  gap: 0;
  background: #fafafa;
}

.sf-about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 0 24px;
  gap: 7px;
  border-bottom: 1px solid #efefef;
}

.sf-about-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 16px;
  box-shadow:
    0 4px 16px rgba(255,106,0,0.22),
    0 0 0 1px rgba(255,106,0,0.1);
  margin-bottom: 4px;
}

.sf-about-name {
  font-size: 19px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
}

.sf-about-tagline { font-size: 14px; color: #888; }

.sf-about-version {
  display: inline-block;
  font-size: 11.5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: #f0f0f0;
  border: 1px solid #e4e4e4;
  color: #666;
  padding: 3px 12px;
  border-radius: 20px;
  margin-top: 2px;
}

.sf-about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 20px 0;
  border-bottom: 1px solid #efefef;
}

.sf-about-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid #efefef;
  border-radius: 10px;
  font-size: 13.5px;
  color: #444;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.sf-about-card i {
  font-size: 15px;
  color: #ff9a00;
  flex-shrink: 0;
  margin-top: 2px;
}

.sf-about-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding-top: 20px;
  font-size: 12.5px;
  color: #bbb;
  text-align: center;
}
