/* =========================
   BASE DA PÁGINA
========================= */
body {
    background-color: #e0e0e0;
    font-family: Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    padding-bottom: 60px;
}

.painel-container {
    max-width: 1100px;
    margin: auto;
}

.container {
    margin: 20px;
}


/* =========================
   HEADER / NAVEGAÇÃO
========================= */
header {
    background-color: #444;
    color: white;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header img.logo {
    height: 50px;
    margin-right: 15px;
}

header h1 {
    font-size: 24px;
    margin: 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #444;
    color: white;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-button {
    background-color: #ef4444;
    color: white;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 6px;
    transition: 0.2s;
}

.logout-button:hover {
    background-color: #dc2626;
}

.admin-button {
    background-color: #2563eb;
    color: white;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 6px;
    transition: 0.2s;
}

.admin-button:hover {
    background-color: #1d4ed8;
}

.add-button {
    display: inline-block;
    background-color: #28a745;
    color: #fff;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin: 20px;
    font-weight: bold;
}

.add-button:hover {
    background-color: #218838;
}

.session-timer {
    font-weight: bold;
    color: green;
}


/* =========================
   PERFIL / PROJETOS
========================= */
.perfil {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.foto-perfil {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

.perfil-info {
    max-width: 600px;
}

.titulo-projetos {
    margin-bottom: 20px;
}

.projetos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.projeto-box {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 10px;
    background: black;
    transition: 0.2s;
    color: white;
}

.projeto-box:hover {
    transform: translateY(-20px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.botao-projeto {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    background: #333;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}


/* =========================
   TABELAS
========================= */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 700px;
    margin: 0 auto 20px auto;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

table th,
table td {
    text-align: center;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #007bff;
    color: white;
    text-transform: uppercase;
    font-size: 14px;
    padding: 12px;
}

table td {
    padding: 10px;
}

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

table tr:hover {
    background-color: #e6f2ff;
}

td a {
    font-size: 18px;
    margin: 0 5px;
}

td a:hover {
    opacity: 0.7;
}


/* =========================
   FORMULÁRIOS
========================= */
.form-container {
    background-color: #fff;
    max-width: 500px;
    margin: 30px auto;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

form label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
}

form input[type="text"],
form input[type="date"],
form input[type="number"],
form input[type="password"],
form select,
form textarea {
    width: 100%;
    padding: 8px 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.submit-button {
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    margin-top: 20px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

.submit-button:hover {
    background-color: #218838;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

select#local {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    box-sizing: border-box;
    margin-top: 5px;
    margin-bottom: 15px;
}

select#local:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,255,0.5);
}


/* =========================
   DIÁLOGO DE CONFIRMAÇÃO
========================= */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

#custom-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px 35px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: center;
    min-width: 300px;
}

#custom-alert p {
    margin-bottom: 20px;
    font-size: 16px;
}

#custom-alert button {
    padding: 8px 18px;
    border: none;
    background-color: #d9534f;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

#custom-alert button:hover {
    background-color: #c9302c;
}


/* =========================
   CAIXA GLOBAL DE MENSAGEM
========================= */
#overlay-msg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

#custom-alert-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px 35px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: center;
    min-width: 300px;
}

#custom-alert-msg p,
#custom-alert-msg-text {
    margin-bottom: 20px;
    font-size: 16px;
}

#custom-alert-msg button,
#custom-alert-msg-ok {
    padding: 8px 18px;
    border: none;
    background-color: #2563eb;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

#custom-alert-msg button:hover,
#custom-alert-msg-ok:hover {
    background-color: #1d4ed8;
}


/* =========================
   FOOTER
========================= */
footer {
    background-color: #444;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    font-size: 14px;
    position: fixed;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

footer span {
    flex: 1;
    text-align: center;
}


/* =========================
   TEXTO / PRE
========================= */
pre {
    white-space: pre-wrap;
    word-break: break-word;
}


/* =========================
   EXTRAS / DÍVIDAS
========================= */
.right {
    text-align: right;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.badge.ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge.warn {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}
.badge.danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.filters {
    margin: 20px;
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}


/* =========================
   TOASTS
========================= */
.toast-container {
    position: fixed;
    top: 90px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    max-width: 360px;
    width: calc(100% - 36px);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    border-left: 6px solid #17a2b8;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: toastIn .18s ease-out;
}

.toast.success {
    border-left-color: #28a745;
}

.toast.danger {
    border-left-color: #dc3545;
}

.toast.info {
    border-left-color: #17a2b8;
}

.toast .title {
    font-weight: 800;
    font-size: 14px;
    margin: 0;
}

.toast .msg {
    font-size: 13px;
    margin: 2px 0 0 0;
}

.toast .close {
    margin-left: auto;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    color: #666;
}

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

@keyframes toastOut {
    to {
        transform: translateY(-6px);
        opacity: 0;
    }
}


/* =========================
   ALERTA DE SESSÃO
========================= */
#session-warning {
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 10px 12px;
    margin: 10px auto;
    max-width: 1100px;
    border: 1px solid #d6b100;
    background: #fff8cc;
    border-radius: 8px;
}

.session-warning-link {
    margin-left: 10px;
    font-weight: bold;
    text-decoration: none;
}


/* =========================
   KPI / DASHBOARD
========================= */
.kpi-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px auto;
    max-width: 1100px;
}

.kpi {
    background: white;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.15s ease;
}

.kpi:hover {
    transform: translateY(-3px);
}

.kpi-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 26px;
    font-weight: bold;
    color: #2c3e50;
}

.kpi-value.small {
    font-size: 18px;
}

.dashboard-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
}


/* =========================
   PANELS
========================= */
.panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin: 25px auto;
    max-width: 1100px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.panel h2 {
    margin-bottom: 15px;
}


/* =========================
   RESPONSIVO
========================= */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }

    header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    header h1 {
        font-size: 20px;
    }

    header img.logo {
        height: 42px;
        margin-right: 10px;
    }

    .nav-container {
        width: 100%;
        padding: 0;
        margin-top: 8px;
        background: transparent;
    }

    .nav-right {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .nav-right span {
        width: 100%;
        margin-bottom: 4px;
    }

    .form-container {
        width: calc(100% - 24px);
        max-width: none;
        margin: 20px auto;
        padding: 18px;
    }

    input,
    select,
    textarea,
    button,
    a.admin-button,
    a.logout-button,
    a.add-button,
    a.back-link {
        font-size: 16px;
    }

    .submit-button,
    .admin-button,
    .logout-button,
    .add-button {
        display: inline-block;
        min-height: 44px;
        line-height: 1.2;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    table,
    table th,
    table td {
        font-size: 12px;
    }

    td a,
    .delete-form button {
        font-size: 18px;
    }

    .dashboard-actions {
        flex-direction: column;
        align-items: stretch;
        padding: 0 12px;
    }

    .dashboard-actions a {
        text-align: center;
    }

    .kpi-wrap {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 0 12px;
    }

    .panel {
        margin: 18px 12px;
        padding: 16px;
    }

    footer {
        padding: 8px 10px;
        font-size: 12px;
    }
}
.delete-form {
    display: inline;
}

.delete-form button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 8px;
}
.grafico-mensal-box {
    position: relative;
    width: 100%;
    height: 320px;
}

@media (max-width: 768px) {
    .grafico-mensal-box {
        height: 240px;
    }
}
.calendario-tabela {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}

.calendario-dia {
    vertical-align: top;
    height: 140px;
    text-align: left;
    padding: 8px;
}

.cal-dia-numero {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 16px;
}

.cal-evento {
    background: #f5f5f5;
    border-left: 4px solid #2563eb;
    border-radius: 6px;
    padding: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.3;
}
.calendario-tabela {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}

.calendario-dia {
    vertical-align: top;
    height: 140px;
    text-align: left;
    padding: 8px;
}

.cal-dia-numero {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 16px;
}

.cal-evento {
    border-radius: 6px;
    padding: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.3;
}
.tipo-ferias {
    background: #fef9c3;
	border-left: 4px solid #eab308;
}

.tipo-folga {
    background: #dcfce7;
    border-left: 4px solid #166534;
}

.tipo-fecho {
    background: #fee2e2;
    border-left: 4px solid #dc2626;
}

.tipo-semifecho {
    background: #ffedd5;
    border-left: 4px solid #ea580c;
}

.tipo-manha {
    background: #fde68a;
	border-left: 4px solid #ca8a04;
}

.tipo-tarde {
    background: #ede9fe;
    border-left: 4px solid #7c3aed;
}

.tipo-noite {
    background: #e5e7eb;
    border-left: 4px solid #374151;
}

.tipo-outro {
    background: #f3f4f6;
    border-left: 4px solid #9ca3af;
}
.badge-tipo {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
/* Dia atual */
.cal-hoje .cal-dia-numero {
    font-weight: bold;
    font-size: 26px;
    margin-bottom: 4px;
}

/* Fins de semana */
.cal-fim-semana {
    background: #e5e7eb;
}
.cal-dia-link {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

.cal-dia-link:hover {
    text-decoration: underline;
}
.cal-evento-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.grid-duas-colunas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

/* Tablet */
@media (max-width: 1024px) {
    .grid-tres-colunas {
        grid-template-columns: 1fr 1fr;
    }
}

/* Telemóvel */
@media (max-width: 768px) {
    .grid-tres-colunas {
        grid-template-columns: 1fr;
    }
}
.log-box {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-word;
}