/* === GERAL E RESET === */
:root {
    --primary-color: #34495e;
    --secondary-color: #7f8c8d;
    --background-color: #f4f7fa;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-color-light: #6c757d;
    --border-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}


/* === PÁGINAS DE AUTENTICAÇÃO (LOGIN E REGISTO) === */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    display: flex;
    width: 100%;
    max-width: 950px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.auth-info-panel {
    background-color: var(--primary-color);
    color: white;
    padding: 50px;
    width: 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-info-panel .info-logo {
    max-width: 180px;
    margin-bottom: 25px;
}

.auth-info-panel h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.auth-info-panel p {
    font-size: 1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.features-list {
    list-style: none;
    padding: 0;
}

.features-list li {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.features-list li i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.auth-form-panel {
    padding: 50px;
    width: 55%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form-panel h2 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.auth-form-panel .subtitle {
    color: var(--text-color-light);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.btn {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: #2c3e50; }
.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-success { background-color: #27ae60; color: white; }
.btn-warning { background-color: #f39c12; color: white; }
.btn-danger { background-color: #e74c3c; color: white; }
.btn-info { background-color: #3498db; color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }


.error-message {
    background-color: #fdeeee;
    color: #e74c3c;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.auth-switch-link {
    text-align: center;
    margin-top: 20px;
}


/* === LAYOUT PRINCIPAL DA APLICAÇÃO === */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-logo {
    padding: 0 25px 30px 25px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar-logo h1 { font-size: 1.5rem; color: var(--primary-color); }
.sidebar-logo p { font-size: 0.8rem; color: var(--text-color-light); }

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: #555;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-nav ul li a:hover,
.sidebar-nav ul li.active a {
    background-color: #f0f2ff;
    color: var(--primary-color);
}
.sidebar-nav ul li a i { margin-right: 15px; width: 20px; text-align: center; font-size: 1.1rem; }
.sidebar-subtitle { padding: 15px 25px 5px; font-size: 0.7rem; font-weight: 600; color: #adb5bd; text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-footer { margin-top: auto; }

.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.main-header {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: none; /* Escondido por defeito, só aparece em mobile */
}

#menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

.main-content {
    flex-grow: 1;
    padding: 30px;
}

.content-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.card-header h1 { margin: 0; font-size: 1.5rem; }

/* === RESPONSIVIDADE === */
@media (max-width: 992px) {
    .auth-info-panel {
        display: none;
    }
    .auth-form-panel {
        width: 100%;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .main-header {
        display: flex;
    }
}


/* --- Tabelas Responsivas --- */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table th, .table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  white-space: nowrap;
}
.table thead th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
}
.table tbody tr:hover {
  background-color: #f1f3f5;
}


/* Ajuste no cabeçalho do cartão para ecrãs pequenos */
.card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
}

@media (min-width: 768px) {
    .card-header {
        flex-direction: row;
        align-items: center;
    }
}

.card-header-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.card-header-actions .btn {
    flex-grow: 1;
}

@media (min-width: 768px) {
    .card-header-actions {
        width: auto;
    }
    .card-header-actions .btn {
        flex-grow: 0;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1010;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
}
.modal-header {
    padding: 0 0 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}
.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

