@charset "utf-8";

/* ==========================================================================
   BOTÕES — BASE
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 16px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s, opacity .15s, transform .1s;
}
.btn:active   { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn i        { font-size: 13px; }

/* ==========================================================================
   BOTÕES — VARIANTES
   ========================================================================== */
.btn-primary   { background: var(--accent);      color: #fff; }
.btn-primary:hover   { background: var(--accent2); }

.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--bg5); }

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

.btn-danger    { background: transparent; color: var(--red);   border: 1px solid var(--red); }
.btn-danger:hover    { background: var(--red);   color: #fff; }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover   { opacity: .88; }

.btn-warning   { background: var(--amber); color: #fff; }
.btn-warning:hover   { opacity: .88; }

/* ==========================================================================
   BOTÕES — APENAS ÍCONE
   ========================================================================== */
.btn-icon {
    background: var(--bg3);
    color: var(--text2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 13px;
}
.btn-icon:hover          { background: var(--bg5);   color: var(--text); }
.btn-icon.danger:hover   { background: var(--red);   color: #fff; border-color: var(--red); }
.btn-icon.success:hover  { background: var(--green); color: #fff; border-color: var(--green); }
.btn-icon.warning:hover  { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn-icon.accent:hover   { background: var(--accent);color: #fff; border-color: var(--accent); }

/* ==========================================================================
   BOTÕES — TAMANHOS
   ========================================================================== */
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-sm.btn-icon { width: 28px; height: 28px; font-size: 11px; }

.btn-lg { padding: 10px 22px; font-size: 14px; }
.btn-lg.btn-icon { width: 40px; height: 40px; font-size: 15px; }

/* ==========================================================================
   BOTÕES — FECHAR / VOLTAR POPUP
   ========================================================================== */
.btn-close, .close-popup {
    position: absolute;
    right: 16px;
    top: 16px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius);
    transition: color .15s, background .15s;
}
.btn-close:hover, .close-popup:hover {
    color: var(--red);
    background: rgba(220, 38, 38, .08);
}

.btn-back, .back-popup {
    position: absolute;
    right: 48px;
    top: 16px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius);
    transition: color .15s, background .15s;
}
.btn-back:hover, .back-popup:hover {
    color: var(--accent);
    background: rgba(59, 130, 246, .08);
}

/* ==========================================================================
   BADGES / STATUS
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}
.badge i { font-size: 8px; }

.badge-green  { background: rgba(22,  163, 74,  .12); color: var(--green); }
.badge-red    { background: rgba(220, 38,  38,  .12); color: var(--red); }
.badge-amber  { background: rgba(217, 119, 6,   .12); color: var(--amber); }
.badge-accent { background: rgba(59,  130, 246, .12); color: var(--accent); }
.badge-teal   { background: rgba(13,  148, 136, .12); color: var(--teal); }
.badge-gray   { background: var(--bg5); color: var(--text2); }

/* ==========================================================================
   FORMULÁRIOS — GRUPOS E LABELS
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
}
.form-label small {
    font-weight: 400;
    font-size: 11px;
    color: var(--text3);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

/* ==========================================================================
   INPUTS, SELECTS E TEXTAREA
   ========================================================================== */
.campo-input,
.campo-select,
.campo-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    background: var(--bg3);
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    line-height: 1.4;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.campo-input::placeholder,
.campo-textarea::placeholder { color: var(--text3); }

.campo-input:hover,
.campo-select:hover,
.campo-textarea:hover { border-color: var(--accent); }

.campo-input:focus,
.campo-select:focus,
.campo-textarea:focus {
    border-color: var(--accent);
    background: var(--bg4);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.campo-input.error,
.campo-select.error,
.campo-textarea.error {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .10);
}

.campo-input.success,
.campo-select.success,
.campo-textarea.success {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .10);
}

.campo-input.number {
    text-align: right;
    font-family: var(--mono);
}


.campo-select {
    appearance: none;
    -webkit-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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    cursor: pointer;
}

.campo-textarea {
    min-height: 90px;
    resize: vertical;
}

/* ==========================================================================
   UPLOAD COM PREVIEW
   ========================================================================== */
.upload-wrapper    { width: 100%; }
.upload-input-file { display: none; }

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 130px;
    border: 2px dashed var(--border2);
    border-radius: var(--radius-lg);
    background: var(--bg3);
    cursor: pointer;
    padding: 20px;
    text-align: center;
    transition: border-color .2s, background .2s;
}
.upload-area:hover {
    border-color: var(--accent);
    background: rgba(59, 130, 246, .04);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text2);
}
.upload-placeholder i    { font-size: 26px; color: var(--text3); }
.upload-placeholder span { font-size: 13px; }

.upload-preview-image {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius);
    object-fit: contain;
    display: none;
}

.upload-file-info {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.upload-file-info i    { font-size: 34px; }
.upload-file-info span { font-size: 13px; color: var(--text); font-weight: 500; word-break: break-all; }

.file-icon-pdf     { color: #e74c3c; }
.file-icon-doc     { color: #3498db; }
.file-icon-xls     { color: #27ae60; }
.file-icon-zip     { color: var(--amber); }
.file-icon-default { color: var(--text3); }

/* ==========================================================================
   TOAST / ALERTA FLUTUANTE
   ========================================================================== */
#toast-container {
    position: fixed;
    top: calc(var(--top-h) + 10px);
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.toast-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 280px;
    max-width: 360px;
    background: var(--bg2);
    color: var(--text);
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border2);
    border-left: 4px solid var(--border2);
    box-shadow: var(--shadow);
    pointer-events: all;
    opacity: 0;
    transform: translateX(16px);
    animation: toastIn .3s cubic-bezier(.22, 1, .36, 1) forwards;
}
.toast-message.hide {
    animation: toastOut .25s ease-in forwards;
}

.toast-message.success { border-left-color: var(--green); }
.toast-message.error   { border-left-color: var(--red); }
.toast-message.warning { border-left-color: var(--amber); }
.toast-message.info    { border-left-color: var(--accent); }

.toast-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.toast-message.success .toast-icon { color: var(--green); }
.toast-message.error   .toast-icon { color: var(--red); }
.toast-message.warning .toast-icon { color: var(--amber); }
.toast-message.info    .toast-icon { color: var(--accent); }

.toast-content       { flex: 1; }
.toast-content p     { font-size: 13px; font-weight: 500; line-height: 1.4; }
.toast-content small { font-size: 11px; color: var(--text2); display: block; margin-top: 2px; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    font-size: 12px;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
    transition: color .15s;
}
.toast-close:hover { color: var(--text); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(16px); }
}

/* ==========================================================================
   MODAL AGUARDE
   Ativar via JS: document.getElementById('modal-aguarde').style.display = 'flex'
   ========================================================================== */
#modal-aguarde {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    color: #fff;
    font-family: var(--font);
    font-size: 14px;
}

.spinner-loading {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.af-topbar {
    padding: 8px 16px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.af-topbar-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
}

/* container de cada item */
.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

/* botão clicável */
.crumb-link {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.crumb-link:hover {
    background: #eaeaea;
    color: #111;
}

/* item atual */
.crumb-current {
    font-weight: 600;
    color: #111;
}

/* separador */
.crumb-separator {
    color: #bbb;
    margin: 0 4px;
}

.crumb-link {
    position: relative;
}

.crumb-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background: #333;
    transition: width 0.2s ease;
}

.crumb-link:hover::after {
    width: 100%;
}