/* ──────────────────────────────────────────────────────────────────────────────
   unifiedModals.css – Shared open/save/import modal system
   ──────────────────────────────────────────────────────────────────────────────
   The unified-* rules are shared by unifiedOpenModal.js and
   unifiedSaveModal.js. svgrepo-* rules support SVG search/import panels, and
   quick-save-toast provides feedback for quickSave.js.
────────────────────────────────────────────────────────────────────────────── */

/* ── Base modal overlay and shell ─────────────────────────────────────── */
.unified-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.unified-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.unified-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 0 0 / .5);
  backdrop-filter: blur(4px);
}
.unified-container {
  position: relative;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
}
.unified-modal.active .unified-container {
  transform: translateY(0);
}
.unified-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgb(255 255 255 / .9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  z-index: 10;
}
.unified-close:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / .1);
  transform: scale(1.1);
}
.unified-close svg {
  width: 20px;
  height: 20px;
  stroke: #6b7280;
}
/* ── Header, icon, title, and subtitle layout ────────────────────────── */
.unified-header {
  background: linear-gradient(135deg, #667eea 0, #764ba2 100%);
  padding: 40px 30px 30px;
  text-align: center;
  color: #fff;
  flex-shrink: 0;
}
.unified-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: rgb(255 255 255 / .2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.unified-icon svg {
  width: 50px;
  height: 50px;
}
.unified-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 10px 0;
  letter-spacing: -.5px;
}
.unified-subtitle {
  font-size: 16px;
  opacity: .95;
  margin: 0;
  font-weight: 500;
}
.unified-body {
  padding: 30px;
  background: #fff;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
/* ── Provider/action option rows shown inside unified modals ─────────── */
.unified-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 0;
}
.unified-option {
  display: flex;
  align-items: center;
  padding: 16px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
  flex-shrink: 0;
  animation: unified-fade-in .3s ease forwards;
}
.unified-option:first-child {
  animation-delay: 50ms;
}
.unified-option:nth-child(2) {
  animation-delay: .1s;
}
.unified-option:nth-child(3) {
  animation-delay: .15s;
}
.unified-option:nth-child(4) {
  animation-delay: .2s;
}
.unified-option:hover:not(.disabled) {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgb(102 126 234 / .15);
  transform: translateY(-2px);
}
.unified-option.disabled {
  opacity: .5;
  cursor: not-allowed;
  background: #f9fafb;
}
.unified-option-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  flex-shrink: 0;
}
.unified-option-icon svg {
  width: 24px;
  height: 24px;
}
.unified-option-content {
  flex: 1;
}
.unified-option-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 4px 0;
}
.unified-option-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}
.unified-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.unified-badge.new {
  background: #10b981;
  color: #fff;
}
/* ── Sign-in prompt displayed when cloud actions need authentication ─── */
.unified-auth-prompt {
  margin-top: 16px;
  padding: 20px;
  background: #fffbea;
  border-radius: 12px;
  text-align: center;
  border: 2px solid #fcd34d;
  flex-shrink: 0;
}
.unified-lock-icon {
  font-size: 32px;
  margin-bottom: 10px;
}
.unified-auth-prompt p {
  color: #92400e;
  font-weight: 500;
  margin: 0 0 16px 0;
}
.unified-signin-btn {
  padding: 10px 24px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}
.unified-signin-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(245 158 11 / .3);
}
.unified-body::-webkit-scrollbar {
  width: 8px;
}
.unified-body::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}
.unified-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
.unified-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
@keyframes unified-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.unified-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: unified-spin .8s linear infinite;
}
@keyframes unified-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes unified-success {
  0% {
    transform: scale(.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.unified-success {
  animation: unified-success .5s ease forwards;
}
#unified-import-modal .unified-header {
  background: linear-gradient(135deg, #10b981 0, #059669 100%);
}
.unified-security-notice {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #166534;
}
.security-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.unified-security-notice p {
  margin: 0;
  font-weight: 500;
}
/* ── Cloud/import file browser list and item states ─────────────────── */
.unified-files-list {
  margin-top: 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}
.unified-files-list.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-style: italic;
  color: #6b7280;
}
.unified-files-list.empty {
  padding: 40px;
  text-align: center;
  color: #6b7280;
  font-style: italic;
}
.unified-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s ease;
}
.unified-file-item:last-child {
  margin-bottom: 0;
}
.unified-file-item:hover {
  border-color: #10b981;
  box-shadow: 0 2px 8px rgb(16 185 129 / .15);
  transform: translateY(-1px);
}
.unified-file-item:focus {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}
.unified-file-meta {
  flex: 1;
}
.unified-file-name {
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 4px 0;
  font-size: 14px;
}
.unified-file-details {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}
.unified-file-actions {
  display: flex;
  gap: 8px;
}
.unified-import-btn {
  padding: 6px 12px;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}
.unified-import-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}
.unified-import-btn:focus {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}
.drag-hint {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #6b7280;
  margin: 16px 0;
  transition: all .2s ease;
}
.drag-hint.drag-over {
  border-color: #10b981;
  background: #f0fdf4;
  color: #166534;
}
.drag-hint-icon {
  font-size: 24px;
  margin-bottom: 8px;
}
.file-preview {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  border: 1px solid #e5e7eb;
}
.file-preview img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}
.file-preview-placeholder {
  color: #9ca3af;
  font-size: 20px;
}
@media (max-width: 640px) {
  .unified-container {
    width: 95%;
    max-height: 95vh;
    margin: 10px;
  }
  .unified-header {
    padding: 30px 20px 20px;
  }
  .unified-title {
    font-size: 24px;
  }
  .unified-subtitle {
    font-size: 14px;
  }
  .unified-body {
    padding: 20px;
  }
  .unified-option {
    padding: 12px;
  }
  .unified-option-icon {
    width: 40px;
    height: 40px;
    margin-right: 12px;
  }
  .unified-option-title {
    font-size: 15px;
  }
  .unified-option-subtitle {
    font-size: 13px;
  }
  .unified-auth-prompt {
    margin-top: 12px;
    padding: 16px;
  }
  .unified-files-list {
    max-height: 250px;
  }
  .unified-file-item {
    padding: 10px;
  }
  .unified-file-name {
    font-size: 13px;
  }
  .unified-file-details {
    font-size: 11px;
  }
  .unified-import-btn {
    padding: 5px 10px;
    font-size: 11px;
  }
  .unified-security-notice {
    padding: 10px 12px;
    font-size: 12px;
  }
}
@media (max-height: 700px) {
  .unified-header {
    padding: 30px 25px 20px;
  }
  .unified-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
  }
  .unified-icon svg {
    width: 40px;
    height: 40px;
  }
  .unified-title {
    font-size: 24px;
  }
  .unified-subtitle {
    font-size: 14px;
  }
  .unified-body {
    padding: 20px;
  }
  .unified-option {
    padding: 12px;
  }
  .unified-option-icon {
    width: 40px;
    height: 40px;
  }
}
.import-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px;
  color: #6b7280;
  font-size: 14px;
}
.import-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e5e7eb;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: unified-spin .7s linear infinite;
  flex-shrink: 0;
}
.import-error {
  padding: 20px;
  text-align: center;
  color: #dc2626;
  background: #fef2f2;
  border-radius: 8px;
  font-size: 14px;
}
/* ── SVG Repo search/import panel embedded in the import modal ───────── */
#svgrepo-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.svgrepo-search-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.svgrepo-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: 0 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  transition: all .15s;
  width: fit-content;
}
.svgrepo-back-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #1f2937;
}
.svgrepo-back-btn svg {
  width: 13px;
  height: 13px;
}
.svgrepo-search-row {
  display: flex;
  gap: 8px;
}
.svgrepo-search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 13px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
  color: #1f2937;
  background: #fff;
}
.svgrepo-search-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgb(245 158 11 / .12);
}
.svgrepo-find-btn {
  padding: 9px 20px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.svgrepo-find-btn:hover {
  background: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(245 158 11 / .3);
}
.svgrepo-find-btn:active {
  transform: none;
  box-shadow: none;
}
.svgrepo-results {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  min-height: 90px;
  overflow-y: auto;
  max-height: 285px;
  padding: 10px;
}
.svgrepo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: #6b7280;
  font-size: 14px;
}
.svgrepo-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e5e7eb;
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: unified-spin .7s linear infinite;
  flex-shrink: 0;
}
.svgrepo-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  color: #9ca3af;
  text-align: center;
  font-size: 13px;
}
.svgrepo-hint span {
  font-size: 22px;
}
.svgrepo-hint p {
  margin: 0;
  line-height: 1.5;
}
.svgrepo-hint strong {
  color: #6b7280;
}
.svgrepo-empty,
.svgrepo-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  text-align: center;
  font-size: 14px;
}
.svgrepo-empty span,
.svgrepo-error span {
  font-size: 22px;
}
.svgrepo-empty p,
.svgrepo-error p {
  margin: 0;
  color: #6b7280;
  line-height: 1.5;
}
.svgrepo-blocked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  text-align: center;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
}
.svgrepo-blocked span {
  font-size: 28px;
}
.svgrepo-blocked p {
  margin: 0;
  color: #92400e;
  font-size: 13px;
  line-height: 1.5;
}
.svgrepo-blocked strong {
  color: #78350f;
}
.svgrepo-open-link {
  display: inline-block;
  margin-top: 8px;
  color: #3b82f6;
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}
.svgrepo-open-link:hover {
  text-decoration: underline;
}
.svgrepo-count {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
}
.svgrepo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.svgrepo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
  transition: all .15s;
}
.svgrepo-item:hover {
  border-color: #f59e0b;
  box-shadow: 0 2px 8px rgb(245 158 11 / .18);
  background: #fffbf0;
}
.svgrepo-thumb {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 6px;
  padding: 3px;
  overflow: hidden;
}
.svgrepo-thumb img {
  max-width: 44px;
  max-height: 44px;
  object-fit: contain;
}
.svgrepo-item-name {
  font-size: 9px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  line-height: 1.2;
  display: block;
}
.svgrepo-import-btn {
  padding: 3px 8px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.svgrepo-import-btn:hover {
  background: #d97706;
}
.svgrepo-attrib {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  padding: 2px;
}
.svgrepo-attrib a {
  color: #6b7280;
  text-decoration: none;
  font-weight: 500;
}
.svgrepo-attrib a:hover {
  text-decoration: underline;
}
@media (max-width: 420px) {
  .svgrepo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}
/* ── Quick-save toast notifications ─────────────────────────────────── */
.quick-save-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
  z-index: 10002;
  animation: slideInRight .3s ease;
}
