/* Definindo as variáveis CSS */
:root {
    --primary-color: #2c3e50;  /* Cor primária */
    --secondary-color: #2980b9; /* Cor secundária */
    --accent-color: #e74c3c;    /* Cor de destaque */
    --background-color: #ecf0f1; /* Cor de fundo */
    --text-color: #34495e;      /* Cor de texto */
    --border-radius: 10px;      /* Raio de borda */
    --padding: 2%;              /* Padding padrão */
    --container-width: 90%;      /* Largura do container */
    --max-width: 100vw;        /* Largura máxima */
    --font-family: 'Arial', sans-serif;
}

/* Resetando margens e paddings padrão */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    width: 100%;
    height: 100%;
}

.container {
    width: 90%;
    margin: 0 auto;
  
}


.form-login
{
    display: flex;
    flex-direction: column;
    align-items: center;
}

.form-login input
{
    border-radius: 25px;
}

.form-login input[type=submit]
{
    
    margin-top: 11px;
}

.section-subtittle
{
    margin: 2% 0;
    font-weight: bold;
}

.header {
    background-color: var(--primary-color);
    color: #fff;
    padding: 2% 3%;
    margin-bottom: 3%;
    text-align: center;
}

.header h1 {
    font-size: 2em;
}

.error-message {
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 2%;
    text-align: center;
}

.form-loan {
    display: flex;
    flex-wrap: wrap;
    gap: 2%;
    background-color: #fff;
    padding: 2%;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.form-loan label {
    width: 100%;
    font-weight: bold;
    margin-bottom: 0.5em;
    color: var(--text-color);
}

.form-loan select,
.form-loan input[type="number"],
.form-loan input[type="date"],
.form-loan input[type="text"] {
    flex: 1 1 48%;
    min-width: 200px;
    padding: 0.8em;
    border-radius: var(--border-radius);
    border: 1px solid #ccc;
    margin-bottom: 1.5em;
    font-size: 1em;
    box-sizing: border-box;
}

.form-loan input[readonly] {
    background-color: #f2f2f2;
    border: 1px solid #bbb;
    color: #666;
    font-style: italic;
}

.form-loan input[type="submit"] {
    flex: 1 1 100%;
    background-color: var(--secondary-color);
    color: #fff;
    padding: 1em 2em;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.form-loan input[type="submit"]:hover {
    background-color: var(--accent-color);
}
/* Grupo do campo 'Dia de Vencimento' ocupa 2 colunas */
#dia_vencimento_group {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
}

.form-group:first-child
{
    grid-column: span 2;
    text-align: center;
    justify-items: center;
}


.btn {
    background-color: var(--secondary-color);
    color: #fff;
    padding: 1em 2em;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s;
    display: inline-block;
}

.btn:hover {
    background-color: var(--accent-color);
}

.back-link {
    text-decoration: none;
    color: var(--secondary-color);
    margin-bottom: 2%;
    margin-top: 2%;

    display: inline-block;
    font-weight: bold;
}

.formulario {
    display: flex;
    flex-direction: column;
    gap: 1em;
    background-color: #fff;
    padding: 2em;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    font-size: 1em;
    width: 100%;
    margin: 0 auto;
}

.formulario fieldset
{
    padding: 2%;
}

.formulario label {
    display: flex;
    flex-direction: column;
    font-weight: bold;
    color: var(--text-color);
    margin: 3% 0;
}

.formulario input,
.formulario select,
.formulario textarea {
    padding: 0.9em;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1em;
    margin-top: 0.3em;
    width: 100%;
}

.formulario button {
    background-color: var(--secondary-color);
    color: #fff;
    padding: 1em;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s;
}

.formulario button:hover {
    background-color: var(--accent-color);
}

.mensagem {
    background-color: #dff0d8;
    color: #3c763d;
    padding: 1em;
    border-radius: var(--border-radius);
    margin-bottom: 1em;
    text-align: center;
}

.btn-voltar {
    display: inline-block;
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 1em;
    transition: color 0.3s;
    font-size: 1em;
}

.btn-voltar::before {
    content: "← ";
    font-size: 1.2em;
}

.btn-voltar:hover {
    color: var(--accent-color);
}



/* Estilos para a tabela da dashboard */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2em;
    margin-top: 2em;
}

thead {
    background-color: var(--primary-color);
    color: #fff;
}

thead th {
    padding: 1em;
    text-align: left;
    font-weight: bold;
}

tbody td {
    padding: 1em;
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background-color: #f7f7f7;
}

tr.vencido {
    background-color: #ffe5e5;
    color: #b30000;
    font-weight: bold;
}


/* Dash Board com Cards */
.loan-section {
    padding: 1em 0;
    border-bottom: 2px solid #ccc;
    margin-bottom: 2em;
}

.cards-container {
    display: flex;
    gap: 1rem;
    padding: 0;
    flex-wrap: wrap;
    
}

.loan-card {
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 18%;
    align-items: center;
    transition: 0.3s ease;
    border: 2px solid #3973b0;
}

.loan-card:hover
{
    background: #d5d5d5;
}

.loan-card .header {
    font-weight: bold;
    font-size: 1.1rem;
    width: 100%;
    border-radius: 8px;
}

.loan-card .info {
    font-size: 0.95rem;
    color: #333;
}

.loan-card .actions {
    margin-top: 0.5rem;
}

.loan-card.overdue {
    border-left: 5px solid red;
    background: #fff4f4;
}

.loan-card.today {
    border-left: 5px solid orange;
    background: #fffbe6;
}

.loan-card.finished {
    border-left: 5px solid green;
    background: #f0fff0;
}

.submit-container {
    margin-top: 20px;
    text-align: center;
}

.btn.btn-small {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.loan-card form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.loan-card label {
    font-weight: 500;
    color: #444;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.loan-card input[type="number"],
.loan-card input[type="text"] {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.loan-card input[type="number"]:focus,
.loan-card input[type="text"]:focus {
    border-color: #3973b0;
    box-shadow: 0 0 0 2px rgba(57, 115, 176, 0.2);
    outline: none;
}

.loan-card input[type="submit"] {
    background-color: #3973b0;
    color: white;
    padding: 0.6rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.loan-card input[type="submit"]:hover {
    background-color: #2d5e90;
}

.section-total {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #ccc;
    font-weight: bold;
    text-align: left;
}

h2 {
    margin-top: 2rem;
}




/* Estilo para os botões pequenos (Ver Parcelas) */
.btn-small {
    padding: 0.5em 1em;
    font-size: 0.9em;
    border-radius: var(--border-radius);
}

.loan-info p {
    font-size: 16px;
    margin: 8px 0;
    color: #444;
    line-height: 1.6;
}

.loan-info strong {
    color: #222;
    font-weight: 600;
    margin-right: 6px;
}

/* Espaçamento entre os links do header */
.header nav {
    margin-top: 1em;
}

.header nav a {
    color: #fff;
    margin: 0 0.5em;
    text-decoration: none;
    font-weight: bold;
    padding: 0.5em 1em;
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
}

.header nav a:hover {
    background-color: var(--accent-color);
}


.checkbox-wrapper {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    user-select: none;
    font-weight: 500;
}

.checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-wrapper .checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: #e6e6e6;
    border: 2px solid #ccc;
    border-radius: 4px;
    transition: all 0.3s;
}

.checkbox-wrapper input:checked ~ .checkmark {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.checkbox-wrapper .checkmark::after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-wrapper input:checked ~ .checkmark::after {
    display: block;
}

.checkbox-wrapper .checkmark::after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Título da seção de conteúdo */
.content h2 {
    margin-bottom: 1em;
    color: var(--text-color);
}


/* popup sucesso */
.popup-success {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4BB543;
    color: white;
    padding: 1em 2.5em 1em 1.2em;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 9999;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 0.7em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out, transform 0.3s ease;
}

.popup-success.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-icon {
    font-size: 1.3em;
}

.popup-text {
    flex-grow: 1;
}

.popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
}


/*Notificações*/
.internal-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #3973b0;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 9999;
    font-size: 0.95rem;
    animation: fadein 0.4s ease, fadeout 0.4s ease 4.6s;
}

@keyframes fadein {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeout {
    to { opacity: 0; transform: translateY(10px); }
}

@media screen and (max-width: 768px) {
   
    
    .header
    {
        width: 100%;
    }
    
    .header nav
    {
        margin-top: 1em;
        display: flex;
        align-content: center;
        gap: 10px;
        flex-wrap: wrap;
        flex-direction: column;
    }
    
    .header h1 {
        font-size: 1.5em;
    }

   .form-loan select,
    .form-loan input[type="number"],
    .form-loan input[type="date"],
    .form-loan input[type="text"] {
        flex: 1 1 100%;
    }
    
    #dia_vencimento_group {
        grid-column: span 1;
    }
    
    .loan-card
    {
        width: 47%;
    }
    
    .back-link
    {
        margin: 6% auto;
        text-align: center;
        display: block;
    }
    
    .section-subtittle 
    {
        margin: 6% auto;
        text-align: center;
    }
    
    /*pop up*/
    .popup-success {
        width: 90%;
        font-size: 0.95em;
        padding: 1em;
    }

}

@media screen and (min-width: 769px) and (max-width: 1023px) 
{
    .loan-card
    {
        width: 28%;
    }
}
