/* === FILE: css/components.css === */
/* Style komponen UI: button, input, card, modal, toast, progress, badge, loader, animations */

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--accent-primary); border-color: var(--accent-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-light); }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--accent-primary); border: none; padding: 8px 12px; }
.btn-ghost:hover:not(:disabled) { background: var(--accent-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px; font-size: 16px; border-radius: var(--radius-sm); transition: background var(--transition); }
.btn-icon:hover { background: var(--bg-tertiary); }

/* === INPUTS === */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border var(--transition), box-shadow var(--transition);
}
.input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}
.input::placeholder { color: var(--text-tertiary); }
.input-sm { padding: 6px 10px; font-size: 12px; }
.input-mono { font-family: var(--font-mono); }
.input-title { font-size: 20px; font-weight: 600; border: none; border-bottom: 2px solid var(--border); border-radius: 0; padding: 8px 0; }
.input-title:focus { border-bottom-color: var(--accent-primary); box-shadow: none; }
textarea.textarea { resize: vertical; min-height: 80px; }
textarea.textarea-lg { min-height: 200px; }
select.select-sm { padding: 6px 10px; font-size: 12px; width: auto; }

.input-password-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.input-password-wrap .input { flex: 1; }

/* === FORM === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.form-row { display: flex; gap: 12px; }
.form-half { flex: 1; }
.form-third { flex: 1; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
.required { color: var(--error); }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio-label input { accent-color: var(--accent-primary); }
.checkbox-label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 14px; margin: 12px 0; }
.checkbox-label input { accent-color: var(--accent-primary); margin-top: 2px; }

/* === STRENGTH BAR === */
.strength-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.strength-fill { height: 100%; border-radius: 3px; transition: width 300ms ease, background 300ms ease; width: 0; }
.strength-bar-sm { height: 4px; background: var(--bg-tertiary); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.strength-fill-sm { height: 100%; border-radius: 2px; transition: width 300ms ease; }
.strength-mini { height: 3px; background: var(--bg-tertiary); border-radius: 2px; margin-top: 8px; }
.strength-mini-fill { height: 100%; border-radius: 2px; }
.strength-indicator { margin-top: 4px; }
.strength-text { font-size: 12px; }

/* === BADGE === */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; line-height: 1.4; }
.badge-red { background: var(--error); color: #fff; }
.badge-info { background: var(--info); color: #fff; }
.badge-success { background: var(--success); color: #fff; }
.badge-warning { background: var(--warning); color: #000; }

/* === MODAL === */
.modal-container { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; pointer-events: none; }
.modal-backdrop { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--transition); pointer-events: auto; padding: 16px; }
.modal-backdrop.show { opacity: 1; }
.modal { background: var(--bg-primary); border-radius: var(--radius-xl); padding: 0; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; transform: scale(0.95); transition: transform var(--transition); box-shadow: var(--shadow-lg); }
.modal.show { transform: scale(1); }
.modal-lg { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-tertiary); padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 16px 24px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px 20px; }

@media (max-width: 640px) {
  .modal { max-width: 100%; max-height: 100vh; border-radius: 0; height: 100%; }
  .modal-backdrop { padding: 0; }
}

/* === TOAST === */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); opacity: 0; transform: translateY(10px); transition: opacity var(--transition), transform var(--transition); font-size: 14px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--error); color: #fff; }
.toast-warning { background: var(--warning); color: #000; }
.toast-info { background: var(--info); color: #fff; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 18px; padding: 0 2px; opacity: 0.7; }
.toast-close:hover { opacity: 1; }

@media (max-width: 640px) {
  .toast-container { left: 16px; right: 16px; bottom: 16px; max-width: 100%; }
}

/* === LOADER === */
.loader-overlay { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: center; justify-content: center; z-index: 4000; opacity: 0; transition: opacity var(--transition); }
.loader-overlay.show { opacity: 1; }
.loader-content { text-align: center; color: #fff; }
.loader-spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
.loader-message { font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.app-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; gap: 16px; color: var(--text-secondary); }

/* === DROPDOWN / SEARCH RESULTS === */
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); max-height: 320px; overflow-y: auto; z-index: 100; }
.search-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; transition: background var(--transition); font-size: 14px; color: var(--text-primary); }
.search-item:hover { background: var(--accent-light); }
.search-empty { padding: 16px; text-align: center; color: var(--text-tertiary); font-size: 14px; }

/* === TABS === */
.tabs-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab-btn { background: none; border: none; padding: 10px 16px; font-size: 14px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all var(--transition); }
.tab-btn.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }

/* === TAGS === */
.tag { display: inline-block; padding: 2px 10px; background: var(--accent-light); color: var(--accent-primary); border-radius: 12px; font-size: 12px; margin: 2px; }
.tag-removable { cursor: default; }
.tag-remove { background: none; border: none; cursor: pointer; color: var(--accent-primary); font-size: 14px; margin-left: 2px; padding: 0; }
.tags-container { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tag-input { width: 120px; flex: none; border: none; background: transparent; padding: 4px 8px; }

/* === INFO/WARNING BOXES === */
.info-box { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 16px; }
.info-box summary { cursor: pointer; font-weight: 500; }
.info-box p { margin-top: 8px; color: var(--text-secondary); font-size: 14px; }
.warning-box { background: #FEF3C7; border: 1px solid var(--warning); border-radius: var(--radius-md); padding: 12px 16px; margin: 12px 0; }
[data-theme="dark"] .warning-box { background: #451a03; }
.warning-box p { color: #92400E; font-size: 14px; }
[data-theme="dark"] .warning-box p { color: #FDE68A; }
.info-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.info-card h3 { margin-bottom: 12px; }
.info-card p { color: var(--text-secondary); margin-bottom: 12px; font-size: 14px; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 48px; display: block; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 20px; font-size: 14px; }
.empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === ERROR STATE === */
.error-state { text-align: center; padding: 48px 24px; }
.error-state h2 { font-size: 20px; margin-bottom: 12px; }
.error-state p { color: var(--text-secondary); margin-bottom: 16px; }

/* === SHORTCUTS TABLE === */
.shortcuts-table { width: 100%; }
.shortcuts-table td { padding: 8px 12px; }
.shortcuts-table td:first-child { white-space: nowrap; }
kbd { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-family: var(--font-mono); font-size: 12px; }

/* === PROGRESS BAR === */
.progress-bar { height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-primary); border-radius: 4px; transition: width 300ms ease; }

/* === MNEMONIC === */
.mnemonic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.mnemonic-word { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; }
.mnemonic-idx { color: var(--text-tertiary); font-size: 12px; }

/* === RECOVERY CODES === */
.recovery-codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; }
.recovery-code { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-family: var(--font-mono); font-size: 15px; }
.rc-idx { color: var(--text-tertiary); font-size: 12px; margin-right: 4px; }