/* === General Page Layout === */
* {
    box-sizing: border-box; /* Ensure consistent box sizing */
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* === Table Styling === */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 8px;
    border: 1px solid #ccc;
    text-align: left; /* Default LTR, overridden per context */
}

th {
    background-color: #eee;
}

/* === Buttons === */
button {
    padding: 6px 12px;
    background-color: #007bff;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
}

button:hover {
    background-color: #0056b3;
}

/* === Form Inputs (Global) === */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
input[type="file"] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

input:focus,
textarea:focus {
    border-color: #007bff;
    outline: none;
}

/* === Sidebar Styling === */
#sidebar {
    width: 200px;
    float: left;
    background-color: #f1f1f1;
    padding: 10px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* === Main Content Area === */
#content {
    margin-left: 220px;
    padding: 10px;
    overflow: hidden;
    box-sizing: border-box;
}

/* === Tree Display Area === */
#tree {
    width: 100%;
    height: 80vh;
    min-height: 500px;
    overflow: auto;
    box-sizing: border-box;
    direction: ltr;
    background-color: #fff;
    border: 1px solid #ccc;
}

/* === Tree Page Specific Fixes === */
.tree-page {
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
}

/* === OrgChart Avatar Styling === */
.orgchart .node img {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    object-fit: cover;
    object-position: center;
    margin-top: 5px;
}

/* === OrgChart Node Title Text Fix === */
.orgchart .node .field_0 {
    text-align: center;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    display: block;
    margin-top: 6px;
    color: #333;
    transform: translateX(5px); /* Optional small adjustment */
}

/* === Add User Form - RTL Fixed Width Layout (manage_users only) === */
#add-user-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px; /* row and column spacing */
    margin-top: 20px;
    direction: rtl; /* Right-to-left for Arabic layout */
    justify-content: flex-start;
    align-items: flex-start;
}

#add-user-form label {
    display: flex;
    flex-direction: column;
    width: 200px; /* Limit width of form fields */
    font-size: 14px;
    margin-bottom: 4px;
    text-align: right;
    font-family: 'Tajawal', sans-serif;
    color: #333;
}

/* === Wider input only for fullname === */
#add-user-form input[name="fullname"] {
    width: 260px;
}

/* === Inputs inside add-user-form only === */
#add-user-form input[type="text"],
#add-user-form input[type="email"],
#add-user-form input[type="password"],
#add-user-form input[type="file"],
#add-user-form textarea {
    padding: 6px;
    margin: 2px 0 6px 0;
    font-size: 13px;
    width: 100%;
}

/* === Submit button in add user form === */
#add-user-form button {
    margin-top: 12px;
    align-self: flex-end; /* Align button to right */
    width: 120px;
}
