/* =========================================================
   COMPONENTS.CSS
   Componentes reutilizáveis
   ========================================================= */

/* =========================
   FAIXA INSTITUCIONAL
========================= */

.gov-topbar {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.9);

    border-bottom: 3px solid var(--accent);
}

.gov-topbar-content {
    min-height: 34px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    font-size: 0.78rem;
    font-weight: 600;
}

.gov-topbar-content span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================
   HEADER
========================= */

.header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}

.header-content {
    min-height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 25px;
}

/* =========================
   LOGO
========================= */

.logo {
    display: flex;
    align-items: center;
    gap: 12px;

    flex-shrink: 0;

    color: var(--text);
    font-weight: 800;
    font-size: 1.15rem;
}

.logo-icon {
    width: 42px;
    height: 42px;

    border-radius: var(--radius-sm);

    display: grid;
    place-items: center;

    color: white;

    background: var(--primary);
}

/* =========================
   NAV
========================= */

.nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    flex: 1;
}

.nav a {
    padding: 9px 14px;

    border-radius: var(--radius-sm);

    color: var(--text-light);

    font-size: 0.92rem;
    font-weight: 600;

    transition: var(--transition);

    border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a.active {
    color: var(--primary);
    background: rgba(19, 81, 180, 0.08);
    border-bottom-color: var(--primary);
}

/* =========================
   BUSCA DO CABEÇALHO
========================= */

.header-search {
    display: flex;
    align-items: center;
    gap: 10px;

    flex: 1;
    min-width: 0;
    max-width: 380px;

    height: 42px;
    padding: 0 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    background: var(--surface-2);

    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary);
    background: var(--surface);

    box-shadow: 0 0 0 3px rgba(19, 81, 180, 0.15);
}

.header-search i {
    color: var(--text-light);
    font-size: 0.9rem;
}

.header-search input {
    flex: 1;
    min-width: 0;

    border: none;
    outline: none;
    background: transparent;

    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.header-search input::placeholder {
    color: var(--text-light);
}

/* =========================
   HEADER ACTIONS
========================= */

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    flex-shrink: 0;
}

/* =========================
   BUTTON
========================= */

.btn {
    border: none;

    padding: 12px 18px;

    border-radius: var(--radius-sm);

    font-weight: 700;

    transition: var(--transition);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;
}

.btn-primary {
    color: white;

    background: var(--primary);
}

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

.btn-secondary {
    color: var(--text);

    background: var(--surface);

    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    color: white;
    background: var(--danger);
}

/* =========================
   ICON BUTTON
========================= */

.icon-btn {
    width: 42px;
    height: 42px;

    border-radius: var(--radius-sm);

    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text);

    display: grid;
    place-items: center;

    transition: var(--transition);
}

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

.icon-btn.voted {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

/* =========================
   CARDS
========================= */

.card {
    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow-sm);

    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

/* =========================
   BADGES
========================= */

.badge {
    display: inline-flex;

    padding: 5px 10px;

    border-radius: var(--radius-sm);

    font-size: 0.75rem;

    font-weight: 800;
}

.badge-success {
    color: #0b5d16;
    background: #d9f2dc;
}

.badge-warning {
    color: #7a4c00;
    background: #fff1c2;
}

.badge-danger {
    color: #9c1c05;
    background: #fbdcd4;
}

.badge-info {
    color: #0b2c6b;
    background: #dbe6fa;
}

/* =========================
   FORM
========================= */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 700;
}

.form-control {
    width: 100%;

    padding: 13px 15px;

    border: 1px solid var(--border);

    border-radius: var(--radius-sm);

    background: var(--surface);

    color: var(--text);

    outline: none;

    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(19, 81, 180, 0.15);
}

/* =========================
   FOTO DA DEMANDA (preview e card)
========================= */

.photo-preview {
    margin-top: 12px;

    display: none;

    position: relative;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    overflow: hidden;
}

.photo-preview.show {
    display: block;
}

.photo-preview img {
    width: 100%;
    max-height: 260px;

    object-fit: cover;
}

.photo-preview button {
    position: absolute;

    top: 8px;
    right: 8px;

    width: 32px;
    height: 32px;

    border: none;
    border-radius: var(--radius-sm);

    background: rgba(29, 29, 29, 0.65);
    color: white;

    display: grid;
    place-items: center;
}

.photo-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.photo-actions .btn-secondary {
    padding: 10px 14px;
    font-size: 0.85rem;
}

.demand-photo {
    margin: -22px -22px 16px;

    height: 160px;

    overflow: hidden;

    border-bottom: 1px solid var(--border);
}

.demand-photo img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.demand-photo-placeholder {
    display: flex;

    align-items: center;
    justify-content: center;

    background: var(--surface-2);
    background: color-mix(in srgb, var(--cor-categoria, var(--text-light)) 16%, var(--surface-2));
}

.demand-photo-placeholder i {
    font-size: 2.6rem;

    color: var(--cor-categoria, var(--text-light));
    opacity: 0.9;
}

/* =========================
   ESTADO VAZIO
========================= */

.empty-state {
    grid-column: 1 / -1;

    padding: 50px 20px;

    text-align: center;

    color: var(--text-light);

    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 8px;
}

/* =========================
   NOTIFICAÇÃO (TOAST)
========================= */

.toast-wrap {
    position: fixed;

    right: 20px;
    bottom: 20px;

    z-index: 3000;

    display: flex;
    flex-direction: column;
    gap: 10px;

    width: min(380px, 92vw);
}

.toast {
    background: var(--surface);

    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    padding: 16px 18px;

    animation: toastIn 0.25s ease;
}

.toast.closing {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(14px); }
}

.toast-header {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 6px;
}

.toast-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;

    border-radius: 50%;

    color: white;

    display: grid;
    place-items: center;

    font-size: 0.8rem;
}

.toast-title {
    flex: 1;

    font-weight: 800;
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;

    color: var(--text-light);

    cursor: pointer;

    font-size: 0.9rem;

    padding: 2px;
}

.toast-close:hover {
    color: var(--text);
}

.toast-message {
    color: var(--text-light);

    font-size: 0.85rem;
    line-height: 1.55;

    margin-bottom: 12px;
}

.toast-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toast-actions .btn {
    padding: 9px 14px;
    font-size: 0.82rem;
}

/* =========================
   FOOTER
========================= */

.footer {
    margin-top: 70px;

    padding: 40px 0;

    border-top: 1px solid var(--border);

    background: var(--surface);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 30px;
}

.footer p {
    color: var(--text-light);
}
