:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --background-color: #f8f9fa;
    --sidebar-width: 260px;
    --header-height: 70px;
    --text-color: #2b2d42;
    --text-muted: #8d99ae;
    --white: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: #f0f4ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.top-header {
    height: var(--header-height);
    background: var(--white);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.content-wrapper {
    padding: 30px;
    flex: 1;
}

/* Cards & Components */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: #fdfdfd;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

.btn-danger {
    background: #ef233c;
    color: white;
}

.btn-danger:hover {
    background: #d90429;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 15px;
    background: #f8f9fa;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    color: var(--text-color);
}

.table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--white);
    border-top: 1px solid #eee;
}

/* Auth Pages */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid;
    font-size: 0.9rem;
}

.alert-error {
    background: #fff2f2;
    color: #d63031;
    border-color: #d63031;
}

.alert-success {
    background: #f0fff4;
    color: #27ae60;
    border-color: #27ae60;
}

/* --- Responsive Sidebar & Toggle --- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    margin-right: 15px;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-header {
        padding: 0 15px;
    }

    .card {
        padding: 15px;
    }

    .table-responsive {
        overflow-x: auto;
    }
}

/* --- Password Toggle Icon --- */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 40px;
    /* Space for the icon */
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.toggle-password:hover {
    color: var(--primary-color);
}