/* Estilos Personalizados - Sistema de Gestão RH */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Layout Base */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem;
    min-height: calc(100vh - 221px); /* Altura ajustada para navbar + footer */
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.4rem 0;
    min-height: 55px;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.2;
}

.navbar-nav {
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.navbar-nav::-webkit-scrollbar {
    display: none;
}

.navbar-nav .nav-item {
    flex-shrink: 0;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    margin: 0 0.1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

/* Ajuste específico para navbar com muitos itens */
@media (max-width: 1600px) {
    .navbar-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .navbar-nav::-webkit-scrollbar {
        display: none;
    }
    
    .navbar-nav .nav-item {
        flex-shrink: 0;
    }
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white !important;
}

.navbar-nav .nav-link i {
    margin-right: 0.3rem;
    font-size: 0.9rem;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
    min-width: 180px;
    /* max-width removido - definido especificamente por contexto */
}

/* Max-width para dropdowns normais (não menus de navegação) */
.navbar-user .dropdown-menu,
.main-content .dropdown-menu,
.card .dropdown-menu,
.btn-group .dropdown-menu {
    max-width: 250px;
}

/* Override para menus de nível 3 - largura automática */
.navbar-navigation .dropdown-submenu > .dropdown-menu {
    max-width: 400px !important;
    width: auto !important;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.dropdown-item {
    padding: 0.4rem 0.8rem;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    line-height: 1.3;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.dropdown-item i {
    margin-right: 0.4rem;
    width: 14px;
    text-align: center;
    font-size: 0.8rem;
}

.dropdown-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    padding: 0.4rem 0.8rem 0.2rem;
}

.dropdown-divider {
    margin: 0.25rem 0;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #007bff 0%, #17a2b8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-body {
    padding: 2rem;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    transition: transform 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

.border-left-primary {
    border-left: 4px solid #007bff !important;
}

.border-left-success {
    border-left: 4px solid #28a745 !important;
}

.border-left-info {
    border-left: 4px solid #17a2b8 !important;
}

.border-left-warning {
    border-left: 4px solid #ffc107 !important;
}

.text-primary {
    color: #007bff !important;
}

.text-success {
    color: #28a745 !important;
}

.text-info {
    color: #17a2b8 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

/* Botões */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color);
    border: none;
}

.btn-danger {
    background: var(--danger-color);
    border: none;
}

.btn-warning {
    background: var(--warning-color);
    border: none;
    color: var(--dark-color);
}

/* Formulários */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    transition: all 0.2s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Tabelas */
.table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
}

.table tbody tr {
    transition: background-color 0.2s ease-in-out;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Alertas */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* Dashboard */
.stats-card {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease-in-out;
}

.stats-card:hover::before {
    transform: scale(1.2);
}

.stats-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stats-number {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Badges */
.badge {
    border-radius: 6px;
    font-weight: 500;
}

/* Footer */
footer {
    margin-left: -15px !important;
    margin-right: -15px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    background-color: #343a40 !important;
    color: white !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    overflow-x: hidden !important;
}

/* Estados dos utilizadores */
.status-ativo {
    color: var(--success-color);
}

.status-inativo {
    color: var(--danger-color);
}

.status-bloqueado {
    color: var(--warning-color);
}

/* Drag and drop para upload de ficheiros */
.drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.05);
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Tooltips customizados */
.tooltip {
    font-size: 0.8rem;
}

.tooltip-inner {
    background: var(--dark-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Responsividade simples e funcional */
@media (max-width: 1200px) {
    .navbar-nav .nav-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .login-card {
        margin: 1rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .navbar-collapse {
        background: rgba(0, 123, 255, 0.95);
        border-radius: 8px;
        margin-top: 1rem;
        padding: 1rem;
    }
}

/* ====================================================
   OVERRIDE FINAL - MENUS NÍVEL 3 COM LARGURA AUTOMÁTICA
   ==================================================== */
.navbar-navigation .dropdown-submenu > .dropdown-menu,
.navbar-navigation .dropdown-submenu > .dropdown-menu.show,
.navbar-navigation .dropdown-submenu > .dropdown-menu[data-level="3"] {
    max-width: 400px !important;
    width: auto !important;
    min-width: 200px !important;
}
