/* ── Imagem de fundo do header ── */
:root {
  --header-bg: url('assets/images/baralho-header.jpg');
  --header-overlay: rgba(0, 0, 0, 0.50);
  --primary:  #0f3c46;
  --secondary:#1f6f78;
  --bg:       #f2f2f2;
  --danger:   #e74c3c;
}

* { margin:0; padding:0; box-sizing:border-box; font-family:"Segoe UI",Arial,sans-serif; }

body { background:var(--bg); color:#333; overflow-x:hidden; }

/* ── Barra de ações (busca + botão) ── */
.toolbar-bar {
  max-width: 1060px;
  margin: 28px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.deck-count {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
  font-weight: 600;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 340px;
}

.search-icon {
  position: absolute;
  left: 11px;
  font-size: 14px;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 9px 36px 9px 34px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(31,111,120,0.12);
}

.search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.search-clear:hover { background: #eee; color: #555; }

#newDeckBtn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
}
#newDeckBtn:hover { background: var(--secondary); transform: translateY(-1px); }

/* ── Grid de baralhos ── */
.deck-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1060px;
  margin: 20px auto 60px;
  padding: 0 20px;
  overflow: visible;
}

/* ── Card ── */
.deck-card {
  background: white;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.09);
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: visible;
}
.deck-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,0.13); z-index: 1; }

.deck-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:10px; }
.deck-title-group { flex:1; }
.deck-title-group h3 { font-size:17px; color:var(--primary); margin-bottom:4px; }

.deck-lang {
  display: inline-block;
  font-size: 11px;
  background: #e8f4f6;
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.deck-description { font-size:13px; color:#777; line-height:1.5; min-height:18px; }

/* ── Skeleton loader ── */
.skeleton { pointer-events:none; }
.sk-line {
  background: linear-gradient(90deg,#eee 25%,#f5f5f5 50%,#eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  margin-bottom: 10px;
}
.sk-title  { height:18px; width:60%; }
.sk-short  { height:13px; width:35%; }
.sk-long   { height:13px; width:80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Estados (vazio / erro / sem resultados) ── */
.feedback-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
}
.state-icon  { font-size:44px; display:block; margin-bottom:12px; }
.state-title { font-size:16px; font-weight:600; color:#555; margin-bottom:6px; }
.state-sub   { font-size:14px; }

.retry-btn {
  margin-top: 16px;
  padding: 9px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.retry-btn:hover { background: var(--secondary); }

/* ── Menu 3 pontinhos ── */
.menu { position:relative; }

.menu-btn {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; width:32px; height:32px;
  background:transparent; border:none; border-radius:8px;
  cursor:pointer; transition:background 0.15s; padding:0;
}
.menu-btn:hover { background:#f0f0f0; }
.menu-btn .dot { width:4px; height:4px; background:#888; border-radius:50%; transition:background 0.15s; }
.menu-btn:hover .dot { background:var(--primary); }

.dropdown {
  position:absolute; top:calc(100% + 6px); right:0;
  background:white; border-radius:12px;
  box-shadow:0 8px 28px rgba(0,0,0,0.16);
  padding:6px; z-index:1000; min-width:200px;
  animation:fadeIn 0.12s ease;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }

.dropdown-item {
  display:flex; align-items:center; gap:10px;
  width:100%; padding:10px 12px;
  background:none; border:none; border-radius:8px;
  font-size:14px; font-weight:500; color:#333;
  cursor:pointer; text-align:left; transition:background 0.12s;
}
.dropdown-item:hover { background:#f5f5f5; }
.dropdown-item.danger { color:var(--danger); }
.dropdown-item.danger:hover { background:#fdf0ef; }
.item-icon { font-size:15px; width:20px; text-align:center; }
.dropdown-divider { height:1px; background:#eee; margin:4px 0; }

.hidden { display:none !important; }

/* ── Modais ── */
.modal {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.45);
  display:none; align-items:center; justify-content:center;
  z-index:200; padding:20px;
}
.modal.show { display:flex; }

.modal-content {
  background:white; padding:30px; border-radius:18px;
  width:100%; max-width:400px;
  box-shadow:0 20px 50px rgba(0,0,0,0.2);
  animation:modalIn 0.2s ease;
}
@keyframes modalIn { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }

.modal-content h2  { font-size:20px; color:var(--primary); margin-bottom:18px; }
.modal-content label { display:block; font-size:13px; font-weight:600; color:#555; margin-bottom:5px; margin-top:14px; }
.required { color:var(--danger); }

.field-wrapper { position:relative; }
.field-error   { display:block; font-size:12px; color:var(--danger); margin-top:3px; min-height:16px; }

.modal-content input,
.modal-content textarea {
  width:100%; padding:10px 12px;
  border-radius:8px; border:1px solid #ddd;
  font-size:14px; outline:none; transition:border-color 0.2s;
}
.modal-content input:focus,
.modal-content textarea:focus { border-color:var(--secondary); }
.modal-content input.input-error { border-color:var(--danger); }
.modal-content textarea { min-height:80px; resize:vertical; }
.modal-content select {
  width:100%; padding:10px 12px;
  border:1.5px solid #dde3e5; border-radius:8px;
  font-size:14px; font-family:'Poppins',sans-serif;
  color:#333; background:#f8fbfc;
  outline:none; cursor:pointer;
  transition:border-color 0.15s, background 0.15s;
  appearance:none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center;
  padding-right:32px;
}
.modal-content select:focus { border-color:var(--secondary); background-color:#fff; }
.modal-content select.input-error { border-color:var(--danger); }

.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }

.primary  { background:var(--primary);  color:#fff; border:none; padding:10px 20px; border-radius:8px; font-weight:600; cursor:pointer; transition:background 0.2s; }
.primary:hover  { background:var(--secondary); }
.primary:disabled { opacity:0.6; cursor:not-allowed; }

.secondary { background:transparent; color:#555; border:1px solid #ccc; padding:10px 20px; border-radius:8px; font-weight:600; cursor:pointer; transition:all 0.2s; }
.secondary:hover { border-color:#999; color:#333; }

.danger   { background:var(--danger); color:#fff; border:none; padding:10px 20px; border-radius:8px; font-weight:600; cursor:pointer; transition:background 0.2s; }
.danger:hover   { background:#c0392b; }
.danger:disabled { opacity:0.6; cursor:not-allowed; }

/* Modal exclusão */
.modal-delete { text-align:center; }
.delete-icon  { font-size:40px; margin-bottom:12px; }
.modal-delete p { font-size:15px; color:#444; margin-bottom:8px; line-height:1.5; }
.delete-warning { font-size:13px !important; color:#e67e22 !important; background:#fff8f0; border-radius:8px; padding:10px 12px !important; margin-top:10px !important; }

/* ── Toasts ── */
#toastContainer {
  position:fixed; bottom:24px; right:24px;
  display:flex; flex-direction:column; gap:10px;
  z-index:9999;
}

.toast {
  padding:12px 18px; border-radius:10px;
  font-size:14px; font-weight:500; color:#fff;
  max-width:320px; box-shadow:0 6px 20px rgba(0,0,0,0.18);
  opacity:0; transform:translateY(10px);
  transition:opacity 0.25s, transform 0.25s;
}
.toast.show { opacity:1; transform:translateY(0); }
.toast.success { background:#1a6b3a; }
.toast.error   { background:#c0392b; }
.toast.warning { background:#d4730a; }
.toast.info    { background:#0b3a42; }
/* ── Rodapé do card com contador de flashcards ── */
.deck-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
}

.deck-card-count {
  font-size: 12px;
  color: #999;
  font-weight: 600;
}