/* ============================================================
   VELTRO WMS — Components
   Botões, badges, forms, modal, spinner, paginação, tabelas
   ============================================================ */

/* ── Card ── */
.card {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 32px;
    border-radius: 12px;
}

.card--wide {
    max-width: 720px;
}

@media (min-width: 1024px) {
    .card--wide {
        max-width: 900px;
    }
}

.card--panel {
    width: 100%;
    min-height: calc(100vh - 100px);
}

@media (min-width: 760px) {
    .card--panel {
        max-width: 100%;
        margin: 0;
        border-radius: 16px;
    }
}

.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.card__title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 6px;
}

.card__subtitle {
    font-size: 14px;
    color: var(--muted);
}

/* ── Formulário ── */
.form__group {
    margin-bottom: 16px;
}

.form__label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}

.form__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form__show-password {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.form__show-password input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.form__group--full {
    grid-column: 1 / -1;
}

select.form__input {
    background-color: #fff;
    cursor: pointer;
}

textarea.form__input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ── Botões ── */
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn--auto {
    width: auto;
    display: inline-block;
    padding: 12px 32px;
    margin-top: 24px;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn--ghost:hover {
    background: var(--border);
}

.btn--success {
  background: var(--success);
  color: white;
  border: none;
}

.btn--success:hover {
  background: #16a34a;
}

.btn--warning {
  background: var(--warning);
  color: white;
  border: none;
}

.btn--warning:hover {
  background: #ea6c00;
}

.btn--danger {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--danger);
    color: white;
}

.btn--danger:hover {
    opacity: 0.9;
}

.btn--resolve {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--primary);
    color: white;
}

.btn--resolve:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn--icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text);
}

.btn--icon:hover { border-color: var(--primary); color: var(--primary); }
.btn--icon--danger:hover { border-color: var(--danger); color: var(--danger); }
.btn--icon--success:hover { border-color: var(--success); color: var(--success); }
.btn--icon--primary:hover { border-color: var(--primary); color: var(--primary); }

/* ── Status Badges ── */
.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge--pending {
    background: #fff7ed;
    color: #9a3412;
}

.status-badge--resolved {
    background: #dcfce7;
    color: #166534;
}

.status-badge--critico {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge--alto {
    background: #fff7ed;
    color: #9a3412;
}

.status-badge--medio {
    background: #fefce8;
    color: #854d0e;
}

/* ── Status Dot ── */
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot--active::before { background: var(--success); }
.status-dot--inactive::before { background: var(--danger); }

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal--hidden {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.modal__content {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100vw - 32px));
    background: var(--card-bg);
    color: var(--text);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    opacity: 0;
    animation: modalFadeIn 120ms ease-out forwards;
}

.modal__title {
    font-size: 18px;
    margin-bottom: 8px;
}

.modal__text {
    color: var(--muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.modal__actions {
    display: flex;
    gap: 10px;
}

.no-scroll {
    overflow: hidden;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Spinner ── */
.spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.spinner__circle {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Paginação ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pagination__button {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
}

.pagination__button--active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
}

.pagination__button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f5f9;
}

/* ── Tabela base ── */
.table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    min-width: 0;
}

.table__body {
    display: flex;
    flex-direction: column;
}

.table__header {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

.table__row {
    border-top: 1px solid var(--border);
    background: white;
    font-size: 14px;
}

.table__row:nth-child(even) {
    background: #f8f9fc;
}

.table__empty {
    padding: 20px 16px;
    color: var(--muted);
}

.table__header span,
.table__row span {
    text-align: left;
}

.table__row--clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.table__row--clickable:hover {
    background: #f0f9ff !important;
}

/* ── Link ── */
.link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.helper {
    margin-top: 16px;
    text-align: center;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .card {
        padding: 24px;
    }

    .btn {
        padding: 14px;
        font-size: 16px;
    }

    .form__input {
        font-size: 16px;
    }
}

/* ── Filtros ── */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select,
.filters input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--card-bg);
  min-width: 180px;
  max-width: 100%;
  flex: 1;
}

.filters select:focus,
.filters input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Botões de ação (cards, tabelas, modais) ── */
.table-actions {
  display: flex;
  gap: 8px;
}

.btn-action {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--surface-hover, #f5f5f5);
}

.btn-action--success {
  color: #16a34a;
  border-color: #86efac;
}

.btn-action--success:hover {
  background: #dcfce7;
}

.btn-action--warning {
  color: var(--warning);
  border-color: #fdba74;
}

.btn-action--warning:hover {
  background: #fff7ed;
}

.btn-action--danger {
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-action--danger:hover {
  background: #fee2e2;
}
