/* ==========================================================================
   Estilos Gerais & Container
   ========================================================================== */
.page-container {
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #334155;
    background-color: #f8fafc;
    border-radius: 8px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.page-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    width: 100%;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    text-align: center;
}

.page-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
}

.page-header .actions-nav {
    justify-content: center;
    width: 100%;
    margin-bottom: 16px;
}

.actions-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #ffffff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
    }

    .page-actions {
        width: 100%;
    }
}


/* ==========================================================================
   Título da Página e Ação Principal
   ========================================================================== */

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 16px;
}

.page-title h2 {
    margin: 0;
}

.page-title .btn {
    flex-shrink: 0;
}



/* Botões do Menu */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: #2563eb;
    color: #ffffff !important;
    border: 1px solid #2563eb;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-outline {
    background-color: #ffffff;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
}

.btn-outline:hover {
    background-color: #f1f5f9;
    color: #0f172a !important;
}

/* ==========================================================================
   Formulários Amigáveis (Add / Edit)
   ========================================================================== */
.form-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.custom-form fieldset {
    border: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.custom-form legend {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 20px;
    width: 100%;
}

/* Grid do Formulário Responsivo */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group.full-width {
    grid-column: span 2;
}

/*css para link ao lado da label*/
.form-group label a {
    margin-left: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
}

.form-group label a:hover {
    text-decoration: underline;
}

/* Campos de entrada gerados pelo CakePHP */
.custom-form .input {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.custom-form label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.custom-form input[type="text"],
.custom-form input[type="email"],
.custom-form input[type="password"],
.custom-form select,
.custom-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: #1e293b;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-form input:focus,
.custom-form select:focus,
.custom-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Botões do Formulário */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

.btn-success {
    background-color: #16a34a;
    color: #ffffff !important;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-cancel {
    background-color: #e2e8f0;
    color: #475569 !important;
}

.btn-cancel:hover {
    background-color: #cbd5e1;
}

/* Responsividade para Telas Pequenas */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }
}

/* ==========================================================================
   Tabela (Visão Index)
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.custom-table th {
    background-color: #f1f5f9;
    color: #475569;
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.custom-table th a {
    color: #475569;
    text-decoration: none;
}

.custom-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.custom-table tbody tr:hover {
    background-color: #f8fafc;
}

.table-actions {
    display: flex;
    gap: 6px;
}

.btn-action {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}

.btn-view { background-color: #e0f2fe; color: #0369a1 !important; }
.btn-edit { background-color: #fef3c7; color: #b45309 !important; }
.btn-delete { background-color: #fee2e2; color: #b91c1c !important; }
.btn-print { background-color: #dcfce7; color: #15803d !important; }
.btn-print:hover { background-color: #bbf7d0; color: #166534 !important; }



.btn-danger {
    background-color: #dc2626;
    color: #ffffff !important;
    border: 1px solid #dc2626;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

/* ==========================================================================
   Estilos Específicos para a View (Visualização de Detalhes)
   ========================================================================== */
.view-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item.full-width {
    grid-column: span 2;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.95rem;
    color: #0f172a;
}

/* Tabelas Relacionadas */
.related-section {
    margin-top: 32px;
}

.related-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
}

.empty-msg {
    background: #ffffff;
    padding: 16px;
    border-radius: 6px;
    color: #64748b;
    font-style: italic;
    border: 1px dashed #cbd5e1;
}

.btn-warning {
    background-color: #d97706;
    color: #ffffff !important;
    border: 1px solid #d97706;
}

.btn-warning:hover {
    background-color: #b45309;
}

code {
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #0f172a;
}

@media (max-width: 768px) {
    .details-grid {
        grid-template-columns: 1fr;
    }
    .detail-item.full-width {
        grid-column: span 1;
    }
}


/* ==========================================================================
   Tela de Login
   ========================================================================== */

.login-container {
    min-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 16px;
    box-sizing: border-box;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    padding: 32px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.login-header p {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
}

.login-card .form-group {
    margin-bottom: 16px;
}

.login-card .input {
    margin-bottom: 0;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    background-color: #f8fafc;
}

.login-actions {
    margin-top: 24px;
    border-top: none;
    padding-top: 0;
}

.login-button {
    width: 100%;
    padding: 11px 16px;
    font-size: 0.95rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .login-container {
        padding: 20px 12px;
    }

    .login-card {
        padding: 24px 20px;
    }
}

/* ==========================================================================
   MENU de cursos ressaltando o controller ativo
   ========================================================================== */
.btn-active {
    background-color: #2563eb;
    color: #ffffff !important;
    border-color: #2563eb;
    font-weight: 600;
}

.btn-active:hover {
    background-color: #1d4ed8;
    color: #ffffff !important;
}

/* =========================================================
   CAMPOS DE DATA DO CAKEPHP
   Mantém DIA / MÊS / ANO na mesma linha
   ========================================================= */

.custom-form .input.date,
.custom-form .input.datetime {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
}

/* Os três selects da data */
.custom-form .input.date select,
.custom-form .input.datetime select {
    flex: 1;
    width: auto;
    min-width: 0;
}

/* Ajuste específico para os campos de data */
.custom-form .input.date select:first-child,
.custom-form .input.datetime select:first-child {
    flex: 1;
}

.custom-form .input.date select:nth-child(2),
.custom-form .input.datetime select:nth-child(2) {
    flex: 1.5;
}

.custom-form .input.date select:nth-child(3),
.custom-form .input.datetime select:nth-child(3) {
    flex: 1;
}

/* =========================================================
   CAMPOS NUMÉRICOS
   ========================================================= */

.custom-form input[type="number"] {
    width: 100%;
    height: 42px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #f8fafc;
    color: #0f172a;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-form input[type="number"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    background-color: #ffffff;
}

/* Mantém o comportamento visual dos outros campos */
.custom-form input[type="number"]:hover {
    border-color: #94a3b8;
}


.related-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.related-section-header h3 {
    margin: 0;
}

.related-section-header .btn {
    flex-shrink: 0;
}



/* =========================================================
   MENSAGENS DE ERRO / VALIDAÇÃO
   ========================================================= */

.error-message {
    display: block;
    width: 100%;
    margin: 20px 0;
    padding: 16px 20px;

    background: #fff1f1;
    border: 1px solid #e0a0a0;
    border-left: 6px solid #c62828;
    border-radius: 7px;

    color: #9b1c1c;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;

    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.10);
}

.error-message::before {
    content: "⚠";
    display: inline-block;
    margin-right: 10px;

    color: #c62828;
    font-size: 20px;
    vertical-align: -2px;
}

/* =========================================================
   MENSAGENS DO SISTEMA
   ========================================================= */

.message.error {
    display: block;
    width: 100%;
    margin: 20px 0;
    padding: 15px 20px;

    background-color: #fde8e8;
    border: 1px solid #f1b5b5;
    border-left: 5px solid #d93025;
    border-radius: 6px;

    color: #a61b1b;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;

    cursor: pointer;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);

    transition: opacity 0.2s ease,
                transform 0.2s ease;
}

/* Ícone de erro */
.message.error::before {
    content: "⚠";
    display: inline-block;
    margin-right: 10px;

    color: #d93025;
    font-size: 18px;
    font-weight: bold;
    vertical-align: middle;
}

/* Efeito ao passar o mouse */
.message.error:hover {
    background-color: #fbe0e0;
}

/* Classe adicionada pelo onclick */
.message.error.hidden {
    display: none;
}

.message.error::after {
    content: "Clique para fechar";
    float: right;

    margin-left: 20px;

    color: #b33a3a;
    font-size: 12px;
    font-weight: normal;
    opacity: 0.75;
}

/* Mensagem de Aviso (Warning) */
.message.warning {
    display: block;
    width: 100%;
    margin: 20px 0;
    padding: 15px 20px;

    background-color: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 5px solid #d97706;
    border-radius: 6px;

    color: #92400e;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;

    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.message.warning::before {
    content: "⚠️";
    display: inline-block;
    margin-right: 10px;
    font-size: 18px;
    vertical-align: middle;
}

.message.warning:hover {
    background-color: #fef3c7;
}

.message.warning.hidden {
    display: none;
}

.message.warning::after {
    content: "Clique para fechar";
    float: right;
    margin-left: 20px;
    color: #92400e;
    font-size: 12px;
    font-weight: normal;
    opacity: 0.75;
}

/* Mensagem de Sucesso (Success) */
.message.success {
    display: block;
    width: 100%;
    margin: 20px 0;
    padding: 15px 20px;

    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 5px solid #059669;
    border-radius: 6px;

    color: #065f46;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;

    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.message.success::before {
    content: "✓";
    display: inline-block;
    margin-right: 10px;
    color: #059669;
    font-size: 18px;
    font-weight: bold;
    vertical-align: middle;
}

.message.success:hover {
    background-color: #d1fae5;
}

.message.success.hidden {
    display: none;
}

.message.success::after {
    content: "Clique para fechar";
    float: right;
    margin-left: 20px;
    color: #065f46;
    font-size: 12px;
    font-weight: normal;
    opacity: 0.75;
}


/* =========================================================
   CAMPOS DE BUSCA
   ========================================================= */

.search {
    width: 100%;
    margin-top: 15px;
}

.search .input {
    width: 100%;
}

.search input[type="text"] {
    width: 100%;
    height: 48px;
    padding: 10px 15px;

    border: 1px solid #ced4da;
    border-radius: 6px;

    background-color: #ffffff;
    color: #333333;

    font-size: 16px;
    line-height: 1.5;

    box-sizing: border-box;

    transition: border-color 0.2s ease,
                box-shadow 0.2s ease;
}

.search input[type="text"]:focus {
    border-color: #80bdff;
    outline: none;

    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.search input[type="text"]::placeholder {
    color: #888888;
    font-size: 14px;
}