/* --- 1. GLOBAL VARIABLES & RESET --- */
:root {
    /* Updated with your actual brand blue */
    --primary: #3b4cb4; 
    --primary-hover: #2e3b8f;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --bg-light: #f8fafc;
    --white: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow: hidden; 
}

body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
}

/* --- 2. LAYOUT & NAVIGATION --- */
.top-bar {
    width: 100%;
    height: 65px;
    background: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 1000; 
}

.top-bar-left, .top-bar-right, .top-bar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    height: 70px;
    width: auto;
    margin-left: 5px;
}

.main-logo {
    max-width: 220px; 
    height: auto;     
    margin-bottom: 10px;
}

.hamburger {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    color: var(--text-main);
}

.dashboard-wrapper {
    display: flex;
    height: calc(100vh - 65px); 
    width: 100%;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--white);
    border-right: 1px solid var(--border);
    transition: margin-left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 500; 
}

.sidebar.collapsed {
    margin-left: -250px;
}

.nav-list, .submenu {
    list-style: none;
    margin: 0;
}

.nav-list { padding: 10px 0 !important; }
.submenu { display: none; background: #fafafa; width: 100%; }
.nav-item.active .submenu { display: block; }

.nav-link, .dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
    transition: all 0.2s;
}

.dropdown-trigger span, .dropdown-trigger i, .dropdown-trigger .chevron {
    pointer-events: none;
}

.nav-link:hover, .dropdown-trigger:hover, .nav-item.active .dropdown-trigger {
    background: #eff6ff !important;
    color: var(--primary) !important;
}

.submenu li a {
    display: block;
    width: 100%;
    padding: 10px 20px 10px 45px; 
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.2s;
}

.submenu li a:hover {
    color: var(--primary);
    background: #f1f7ff;
}

.chevron { font-size: 0.7rem; transition: transform 0.3s; }
.nav-item.active .chevron { transform: rotate(180deg); }
.sidebar-divider { height: 1px; background: var(--border); margin: 10px 0; }

/* --- 3. USER MENU --- */
.user-menu-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-menu-container:hover { background: #f1f5f9; }

.user-avatar {
    width: 35px;
    height: 35px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-welcome { font-size: 0.9rem; color: var(--text-muted); }

.dropdown-menu {
    position: absolute;
    top: 55px;
    right: 0;
    width: 200px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    padding: 8px 0;
    z-index: 3000;
}

.dropdown-menu.show { display: flex; }

.dropdown-menu a {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: var(--bg-light);
    color: var(--primary);
}

/* --- 4. CONTENT & CARDS --- */
.content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px;
}

.content-header { width: 100%; margin-bottom: 30px; }
.content-header h2 { font-size: 1.8rem; font-weight: 700; }

.registration-card, .login-container {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    width: 100%;
}

.registration-card {
    padding: 40px;
    max-width: 500px;
    margin: 0 auto;
}

.login-container {
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}

/* --- 5. FORMS & INPUTS --- */
.standard-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
}

/* Consolidated Input Styles */
.login-form input, 
.standard-form input:not([type="checkbox"]), 
.standard-form select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box; 
}

.standard-form input[type="checkbox"] {
    width: auto !important;
    cursor: pointer;
}

.password-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

#toggle-text {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

/* --- 6. BUTTONS --- */
/* Consolidated Button Styles */
.btn-primary, 
.login-form button, 
.btn-table-edit {
    display: inline-block;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.btn-primary, .login-form button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

.btn-table-edit {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-primary:hover, .login-form button:hover, .btn-table-edit:hover {
    background-color: var(--primary-hover);
}

.btn-table-delete {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    background-color: var(--danger);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-table-delete:hover {
    background-color: var(--danger-hover);
}

/* --- 7. TABLES --- */
.table-container {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.table-responsive { overflow-x: auto; width: 100%; }

.portal-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.portal-table th {
    background-color: var(--bg-light);
    color: var(--text-muted);
    font-weight: 600;
    padding: 16px 24px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.portal-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.portal-table tbody tr { transition: background-color 0.2s ease; }
.portal-table tbody tr:hover { background-color: var(--bg-light); }
.table-actions { text-align: right; white-space: nowrap; }

/* --- 8. BADGES --- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-admin { background-color: #fee2e2; color: var(--danger); }
.badge-contractor-boss { background-color: #fef3c7; color: #d97706; }
.badge-contractor-worker { background-color: #e0f2fe; color: #0284c7; }
.badge-employee { background-color: #dcfce7; color: #16a34a; }