/* ================================================
   FIMF CLOUD - COMPONENT LIBRARY
   ================================================ */

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-md);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.4;
  transition: var(--tr-all); white-space: nowrap; user-select: none;
  border: 1px solid transparent; position: relative; overflow: hidden;
  min-height: 36px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: var(--accent); color: var(--text-inverse);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-surface); color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); box-shadow: var(--shadow-md); }
.btn-ghost { color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); min-height: 30px; }
.btn-lg { padding: var(--sp-3) var(--sp-6); font-size: var(--fs-md); min-height: 44px; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: 1.4;
}
.badge-primary { background: var(--accent-muted); color: var(--accent); }
.badge-success { background: var(--success-muted); color: var(--success); }
.badge-danger { background: var(--danger-muted); color: var(--danger); }
.badge-warning { background: var(--warning-muted); color: var(--warning); }
.badge-info { background: var(--info-muted); color: var(--info); }

/* INPUTS */
.form-group { display: flex; flex-direction: column; gap: var(--sp-1); }
.form-label { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: var(--sp-2) var(--sp-3);
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: var(--fs-sm); transition: var(--tr-colors);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-ring);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.form-error { font-size: var(--fs-xs); color: var(--danger); }

/* CARDS */
.card {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: var(--sp-5);
  transition: var(--tr-all);
}
.card-hover:hover { border-color: var(--border-default); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.card-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.card-subtitle { font-size: var(--fs-xs); color: var(--text-muted); }

/* MODAL */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn var(--dur-fast) var(--ease);
  padding: var(--sp-4);
}
.modal {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); width: 100%; max-width: 480px;
  box-shadow: var(--shadow-xl); animation: scaleIn var(--dur-normal) var(--ease);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-muted); transition: var(--tr-colors); }
.modal-close:hover { background: var(--surface-hover); color: var(--text-primary); }
.modal-body { padding: 0 var(--sp-5) var(--sp-4); }
.modal-footer { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-3) var(--sp-5) var(--sp-5); }

/* TOAST */
.toast-container { position: fixed; top: var(--sp-4); right: var(--sp-4); z-index: 2000; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.toast {
  pointer-events: auto; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md);
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg); animation: slideDown var(--dur-normal) var(--ease);
  font-size: var(--fs-sm); min-width: 280px; max-width: 420px;
  display: flex; align-items: center; gap: var(--sp-3);
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-dismiss { margin-left: auto; color: var(--text-muted); padding: 2px; }

/* AVATAR */
.avatar {
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full); font-weight: var(--fw-bold);
  color: #fff; flex-shrink: 0; text-transform: uppercase;
}
.avatar-xs { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar-md { width: 40px; height: 40px; font-size: var(--fs-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--fs-2xl); }

/* PROGRESS BAR */
.progress { height: 6px; background: var(--bg-muted); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width .6s var(--ease); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.default { background: var(--accent); }

/* SEARCH */
.search-wrapper { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-icon svg { width: 16px; height: 16px; }
.search-input { padding-left: 36px !important; }

/* TABS */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border-subtle); padding-bottom: 0; }
.tab {
  padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: var(--tr-colors); margin-bottom: -1px;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* CHIP / TAG */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-full);
  background: var(--bg-muted); font-size: var(--fs-xs); color: var(--text-secondary);
}

/* DROPDOWN */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 180px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  z-index: 100; padding: var(--sp-1); animation: slideDown var(--dur-fast) var(--ease);
}
.dropdown-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  font-size: var(--fs-sm); color: var(--text-secondary); transition: var(--tr-colors);
}
.dropdown-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--sp-1) 0; }

/* EMPTY STATE */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-12) var(--sp-4); text-align: center; }
.empty-state svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: var(--sp-4); opacity: .5; }
.empty-state-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-primary); margin-bottom: var(--sp-1); }
.empty-state-text { font-size: var(--fs-sm); color: var(--text-muted); max-width: 300px; }

/* TOGGLE */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--bg-muted);
  border-radius: var(--radius-full); transition: var(--tr-all);
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: var(--tr-transform);
  box-shadow: var(--shadow-xs);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* DROP ZONE */
.drop-zone {
  border: 2px dashed var(--border-default); border-radius: var(--radius-lg);
  padding: var(--sp-8); text-align: center; cursor: pointer;
  transition: var(--tr-all);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: var(--accent-muted);
}
.drop-zone.drag-over { animation: pulse 1s infinite; }

/* CONTEXT MENU */
.context-menu {
  position: fixed; background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 500;
  padding: var(--sp-1); min-width: 180px; animation: scaleIn var(--dur-fast) var(--ease);
}

/* TOOLTIP */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); padding: 4px 8px; background: var(--bg-overlay);
  color: var(--text-primary); font-size: var(--fs-xs); border-radius: var(--radius-sm);
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-md); z-index: 200;
}
[data-tooltip]:hover::after { opacity: 1; }

/* LOADER */
.loader { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border-default); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
.loader-lg { width: 32px; height: 32px; border-width: 3px; }

/* DIVIDER */
.divider { height: 1px; background: var(--border-subtle); margin: var(--sp-3) 0; }

/* SKELETON */
.skeleton { background: var(--bg-muted); border-radius: var(--radius-sm); animation: pulse 1.5s infinite; }

/* WINDOWS 11 CONTEXT MENU */
.win11-context-menu,
.win11-ctx {
  position: fixed; z-index: 9999; min-width: 220px; max-width: 280px;
  background: var(--bg-raised); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.24), 0 2px 8px rgba(0,0,0,.12);
  backdrop-filter: blur(20px); animation: ctxFadeIn .12s ease-out;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px; border: none; background: none; color: var(--text-primary);
  font-size: var(--fs-sm); border-radius: var(--radius-md); cursor: pointer;
  transition: background .1s; text-align: left;
}
.ctx-item:hover { background: var(--surface-hover); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: rgba(239,68,68,.1); }
.ctx-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; }
.ctx-icon svg { width: 16px; height: 16px; }
.ctx-div { height: 1px; background: var(--border-subtle); margin: 4px 8px; }

@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

/* STORAGE TREE */
.storage-tree { display: flex; flex-direction: column; }
.tree-item {
  display: flex; align-items: center; gap: var(--sp-2); padding: 8px 12px;
  border-radius: var(--radius-md); cursor: pointer; transition: background .1s;
  user-select: none;
}
.tree-item:hover { background: var(--surface-hover); }
.tree-child { padding-left: 36px; }
.tree-grandchild { padding-left: 60px; }
.tree-toggle {
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease; flex-shrink: 0;
}
.tree-toggle.expanded { transform: rotate(90deg); }
.tree-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tree-info { display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0; }
.tree-name { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.tree-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-left: auto; }
.tree-children { animation: treeExpand .15s ease-out; }

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