﻿/* ===============================
   BASE GLOBAL DO SISTEMA
   =============================== */

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

body {
    background-color: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
}

.link-tabela,
.link-tabela:visited {
    color: inherit;
    text-decoration: none;
}

.link-tabela:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* ===============================
   LAYOUT PADRÃO
   =============================== */

.wrap {
    padding: 2px 20px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 24px;
    margin: 14px 0 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
    margin-bottom: 8px;
    color: #111;
    font-size: 1.5rem;
    font-weight: 700;
}

th {
    color: #111;
    font-weight: 700;
}

td.num,
th.num {
    text-align: right;
}

/* ===============================
   FORMULÁRIOS LEGADOS
   =============================== */

form input[type="radio"] {
    width: auto;
    margin-right: 5px;
    vertical-align: middle;
}

form label {
    vertical-align: middle;
    margin-right: 15px;
}

/* ===============================
   FILTROS DE RELATÓRIOS
   =============================== */

.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.campo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.campo label {
    font-weight: 600;
    margin-right: 0;
}

.campo input,
.campo select,
.campo textarea {
    min-width: 180px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* ===============================
   BOTÕES
   =============================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    box-sizing: border-box;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
}

.btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
    background: #e5e7eb;
}

.btn-danger {
    background: #fff0f3;
    border-color: #fca5a5;
    color: #b91c1c;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #991b1b;
}

.btn-secondary {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #6b7280;
}

.btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.btn-csv {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #111827;
}

.btn-csv:hover {
    background: #eef2ff;
}

.acoes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.tag-status.ativo {
    background: #dcfce7;
    color: #166534;
}

.tag-status.bloqueado {
    background: #fee2e2;
    color: #991b1b;
}

.tag-status.cancelado {
    background: #e5e7eb;
    color: #374151;
}

.tag-status.trancado {
    background: #fef3c7;
    color: #92400e;
}

.tag-status.concluido {
    background: #dbeafe;
    color: #1d4ed8;
}

.linha-clicavel {
    cursor: pointer;
}

.linha-clicavel:hover {
    background: #f5f7fb;
}

/* ===============================
   FORMULÁRIOS ADMIN
   =============================== */

form.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
    background: transparent;
}

.muted {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 18px;
}

.grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px 16px;
    align-items: center;
}

.grid label {
    font-weight: bold;
    color: #333;
    margin-right: 0;
}

.grid input[type="text"],
.grid input[type="password"],
.grid input[type="number"],
.grid input[type="email"],
.grid input[type="date"],
.grid select,
.grid textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.grid textarea {
    min-height: 100px;
    resize: vertical;
}

.grid input:focus,
.grid select:focus,
.grid textarea:focus {
    outline: none;
    border-color: #0c043d;
    box-shadow: 0 0 0 3px rgba(12, 4, 61, 0.12);
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fafafa;
}

.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin: 0;
}

.checks input[type="checkbox"] {
    width: auto;
}

/* ===============================
   TABELAS PADRÃO
   =============================== */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    border: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
}

th {
    background: #0c043d;
    color: #fff;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.10);
}

table tr:nth-child(even) {
    background: #f9f9f9;
}

/* ===============================
   UTILIDADES
   =============================== */

.alerta {
    color: #b91c1c;
    font-weight: 700;
}

.bloco-titulo {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
}

.sem-dados {
    color: #666;
    font-style: italic;
}

.obs {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

/* ===============================
   FORM-GRID — GRID DE FORMULÁRIO
   Grid de 6 colunas para formulários de cadastro.
   Use .span-1 a .span-6 nos .campo filhos.
   =============================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px 18px;
}

.form-grid .campo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-grid .campo input,
.form-grid .campo select,
.form-grid .campo textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-grid .campo textarea {
    min-height: 80px;
    resize: vertical;
}

.form-grid .campo input:focus,
.form-grid .campo select:focus,
.form-grid .campo textarea:focus {
    outline: none;
    border-color: #0c043d;
    box-shadow: 0 0 0 3px rgba(12, 4, 61, 0.12);
}

.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.span-1 { grid-column: span 1; }

/* ===============================
   RESPONSIVO
   =============================== */

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .grid label {
        margin-bottom: -4px;
    }

    .filtros {
        flex-direction: column;
        align-items: stretch;
    }

    .campo input,
    .campo select,
    .campo textarea {
        min-width: 100%;
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .span-6, .span-5, .span-4, .span-3, .span-2, .span-1 {
        grid-column: span 2;
    }
}

/* ===============================
   MENSAGENS DO SISTEMA (CRUD)
   =============================== */

.crud-msg {
    position: relative;
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-style: italic;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Texto */
.crud-msg-text {
    display: block;
    padding-right: 24px;
}

/* Botão fechar */
.crud-msg-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.crud-msg-close:hover {
    opacity: 1;
}

/* Tipos */

.crud-msg-ok {
    background: #e6f4ea;
    border-color: #b7e1c1;
    color: #1e7e34;
}

.crud-msg-success {
    background: #e6f4ea;
    border-color: #b7e1c1;
    color: #1e7e34;
}

.crud-msg-error {
    background: #fdecea;
    border-color: #f5c6cb;
    color: #a71d2a;
}

.crud-msg-warning {
    background: #fff4e5;
    border-color: #ffeeba;
    color: #8a6d3b;
}

.crud-msg-info {
    background: #e7f3fe;
    border-color: #b8daff;
    color: #0c5460;
}

/* ===============================
   AUTOCOMPLETE DE ALUNO
   =============================== */

.autocomplete-wrap {
    position: relative;
}

.autocomplete-wrap .autocomplete-input {
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 260px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,.12);
}

.autocomplete-dropdown li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-dropdown li:last-child {
    border-bottom: none;
}

.autocomplete-dropdown li:hover,
.autocomplete-dropdown li.ativo {
    background: #0c043d;
    color: #fff;
}

.autocomplete-dropdown li.autocomplete-vazio {
    color: #999;
    cursor: default;
    font-style: italic;
}

.autocomplete-dropdown li.autocomplete-vazio:hover {
    background: #fff;
    color: #999;
}

/* ===============================
   DROPDOWN DE AÇÕES
   =============================== */

.dropdown-acoes {
    position: relative;
    display: inline-block;
}

.dropdown-acoes-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 300;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 140px;
    padding: 4px 0;
    list-style: none;
    margin: 2px 0 0;
}

.dropdown-acoes.open .dropdown-acoes-menu {
    display: block;
}

.dropdown-acoes-menu li a,
.dropdown-acoes-menu li button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
}

.dropdown-acoes-menu li a:hover,
.dropdown-acoes-menu li button:hover {
    background: #f3f4f6;
    color: #111827;
}

.dropdown-acoes-menu li button.btn-danger-text {
    color: #b91c1c;
}

.dropdown-acoes-menu li button.btn-danger-text:hover {
    background: #fee2e2;
    color: #991b1b;
}

.dropdown-acoes-menu li + li {
    border-top: 1px solid #f3f4f6;
}