/* Cascading Menu Styles - 3 Column Layout */
.cascading-menu-container {
    position: relative;
    width: 100%;
}

.cascading-menu-trigger {
    cursor: pointer;
    background-color: white;
}

.cascading-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    background-color: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 0.375rem;
    
    /* Column Layout */
    display: none;
    flex-direction: row;
    width: 600px;
    height: 350px;
    overflow: hidden;
}

@media (max-width: 640px) {
    .cascading-menu {
        width: 90vw;
        height: 300px;
        position: fixed;
        left: 5vw;
        top: 50%;
        transform: translateY(-50%);
    }
}

.cascading-menu.show {
    display: flex;
}

.cascading-column {
    flex: 1;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.cascading-column:last-child {
    border-right: none;
}

.cascading-header {
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}

.cascading-list {
    flex: 1;
    overflow-y: auto;
}

.cascading-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cascading-item:last-child {
    border-bottom: none;
}

.cascading-item:hover {
    background-color: #f3f4f6;
}

.cascading-item.active {
    background-color: #eff6ff;
    color: #1d4ed8;
    font-weight: 500;
}

.cascading-item.active::after {
    content: '›';
    font-weight: bold;
    font-size: 1.2em;
}

.cascading-placeholder {
    padding: 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
}

/* Scrollbar styling for columns */
.cascading-column::-webkit-scrollbar {
    width: 6px;
}

.cascading-column::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cascading-column::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.cascading-column::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Timesheet day input styles */
.holiday-input {
    background-color: #fef3c7;
    border-color: #fbbf24;
}

.sunday-input {
    background-color: #fee2e2;
    border-color: #f87171;
}

.non-working-saturday-input {
    background-color: #e0f2fe;
    border-color: #7dd3fc;
    opacity: 0.9;
}

.holiday-input:focus {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.sunday-input:focus {
    background-color: #fee2e2;
    border-color: #ef4444;
}

.non-working-saturday-input:focus {
    background-color: #e0f2fe;
    border-color: #38bdf8;
}

/* ST/ET input container */
.st-et-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* ST/ET input sizing */
.st-hours-input,
.et-hours-input {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

/* Ensure holiday/sunday classes work on both */
.st-hours-input.holiday-input,
.et-hours-input.holiday-input {
    background-color: #fef3c7;
    border-color: #fbbf24;
}

.st-hours-input.sunday-input,
.et-hours-input.sunday-input {
    background-color: #fee2e2;
    border-color: #f87171;
}

.st-hours-input.non-working-saturday-input,
.et-hours-input.non-working-saturday-input {
    background-color: #e0f2fe;
    border-color: #7dd3fc;
}

/* Hierarchy Tree Styles */
.hierarchy-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    min-height: 400px;
}

.hierarchy-node {
    margin: 1rem 0;
    position: relative;
}

.hierarchy-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    min-width: 280px;
    max-width: 320px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.hierarchy-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.ceo-node .hierarchy-card {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.hod-node .hierarchy-card {
    border-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.emp-node .hierarchy-card {
    border-color: #9ca3af;
    background: #ffffff;
}

.hierarchy-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.hierarchy-card-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.hierarchy-card-code {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.hierarchy-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hierarchy-card-role {
    margin-bottom: 0.25rem;
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-badge.role-ceo {
    background-color: #3b82f6;
    color: white;
}

.role-badge.role-manager {
    background-color: #10b981;
    color: white;
}

.role-badge.role-employee {
    background-color: #6b7280;
    color: white;
}

.role-badge.role-superadmin {
    background-color: #8b5cf6;
    color: white;
}

.hierarchy-card-designation {
    font-size: 0.875rem;
    color: #374151;
    font-weight: 500;
}

.hierarchy-card-department {
    font-size: 0.875rem;
    color: #6b7280;
}

.hierarchy-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    justify-content: flex-end;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.edit-btn:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #3b82f6;
}

.impersonate-btn:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #f59e0b;
}

.hierarchy-children {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    position: relative;
}

.hierarchy-children::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1rem;
    background: #d1d5db;
}

.hierarchy-children.collapsed {
    display: none;
}

.hierarchy-children.expanded {
    display: flex;
}

/* Connect lines between parent and children */
.hierarchy-node:has(.hierarchy-children)::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1rem;
    background: #d1d5db;
    z-index: 0;
}

.hierarchy-node:has(.hierarchy-children.expanded)::after {
    display: block;
}

.hierarchy-node:has(.hierarchy-children.collapsed)::after {
    display: none;
}

/* Horizontal layout for multiple children */
.hierarchy-children {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding-left: 0;
    padding-right: 0;
}

.hierarchy-children > .hierarchy-node {
    position: relative;
    flex: 0 0 auto;
}

/* Connect lines for horizontal layout */
.hierarchy-children > .hierarchy-node::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1rem;
    background: #d1d5db;
}

.hierarchy-children > .hierarchy-node:first-child::after,
.hierarchy-children > .hierarchy-node:last-child::after {
    content: '';
    position: absolute;
    top: -1rem;
    width: 50%;
    height: 2px;
    background: #d1d5db;
}

.hierarchy-children > .hierarchy-node:first-child::after {
    left: 50%;
}

.hierarchy-children > .hierarchy-node:last-child::after {
    right: 50%;
}

.hierarchy-children > .hierarchy-node:only-child::after {
    display: none;
}

/* Password Toggle Styles */
.password-toggle-btn {
    transition: color 0.2s ease-in-out;
}

.password-toggle-btn:hover {
    color: #4b5563;
}

.password-toggle-btn:focus {
    outline: none;
    color: #2563eb;
}

/* Ensure proper positioning for password input with toggle */
.password-input-container {
    position: relative;
}

.password-input-with-toggle {
    padding-right: 3rem !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hierarchy-tree {
        padding: 1rem 0.5rem;
    }
    
    .hierarchy-card {
        min-width: 240px;
        max-width: 280px;
    }
    
    .hierarchy-children {
        flex-direction: column;
        gap: 1rem;
    }
}